Add history window

This commit is contained in:
dismine 2013-08-15 23:39:00 +03:00
parent 67dd88145c
commit ece5024156
46 changed files with 888 additions and 320 deletions

View File

@ -56,7 +56,9 @@ SOURCES += main.cpp\
dialogs/dialogsplinepath.cpp \
widgets/vmaingraphicsscene.cpp \
widgets/vmaingraphicsview.cpp \
tools/vdatatool.cpp
tools/vdatatool.cpp \
xml/vtoolrecord.cpp \
dialogs/dialoghistory.cpp
HEADERS += mainwindow.h \
widgets/vmaingraphicsscene.h \
@ -103,7 +105,9 @@ HEADERS += mainwindow.h \
tools/vtoolsplinepath.h \
dialogs/dialogsplinepath.h \
widgets/vmaingraphicsview.h \
tools/vdatatool.h
tools/vdatatool.h \
xml/vtoolrecord.h \
dialogs/dialoghistory.h
FORMS += mainwindow.ui \
dialogs/dialogsinglepoint.ui \
@ -117,7 +121,8 @@ FORMS += mainwindow.ui \
dialogs/dialoglineintersect.ui \
dialogs/dialogspline.ui \
dialogs/dialogarc.ui \
dialogs/dialogsplinepath.ui
dialogs/dialogsplinepath.ui \
dialogs/dialoghistory.ui
RESOURCES += \
icon.qrc \

View File

@ -1,11 +1,16 @@
#ifndef CALCULATOR_H
#define CALCULATOR_H
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
#pragma GCC diagnostic ignored "-Wsign-conversion"
#pragma GCC diagnostic ignored "-Wctor-dtor-privacy"
#include <QtGlobal>
#include <QString>
#include <QMap>
#include <QLineF>
#include <QPointF>
#pragma GCC diagnostic pop
#include "vcontainer.h"
/**

View File

@ -3,13 +3,33 @@
#include "../options.h"
qint64 VContainer::_id = 0;
VContainer::VContainer(){
_id = 0;
SetSize(500);
SetGrowth(1760);
CreateManTableIGroup ();
}
const VContainer &VContainer::operator =(const VContainer &data){
setData(data);
return *this;
}
void VContainer::setData(const VContainer &data){
base = *data.DataBase();
points = *data.DataPoints();
standartTable = *data.DataStandartTable();
incrementTable = *data.DataIncrementTable();
lengthLines = *data.DataLengthLines();
lineArcs = *data.DataLengthArcs();
splines = *data.DataSplines();
lengthSplines = *data.DataLengthSplines();
arcs = *data.DataArcs();
lengthArcs = *data.DataLengthArcs();
splinePaths = *data.DataSplinePaths();
}
template <typename key, typename val>
val VContainer::GetObject(const QMap<key,val> &obj, key id)const{
if(obj.contains(id)){
@ -151,17 +171,21 @@ qreal VContainer::GetValueIncrementTableRow(const QString& name) const{
void VContainer::Clear(){
_id = 0;
points.clear();
standartTable.clear();
incrementTable.clear();
lengthLines.clear();
splines.clear();
arcs.clear();
lengthArcs.clear();
lineArcs.clear();
ClearObject();
CreateManTableIGroup ();
}
void VContainer::ClearObject(){
points.clear();
splines.clear();
arcs.clear();
}
void VContainer::ClearIncrementTable(){
incrementTable.clear();
}

View File

@ -1,13 +1,16 @@
#ifndef VCONTAINER_H
#define VCONTAINER_H
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
#pragma GCC diagnostic ignored "-Wsign-conversion"
#pragma GCC diagnostic ignored "-Wctor-dtor-privacy"
#include <QMap>
#include <QTableWidget>
#pragma GCC diagnostic pop
#include "vpointf.h"
#include "vstandarttablecell.h"
#include "vincrementtablerow.h"
#pragma GCC diagnostic warning "-Weffc++"
#include "../geometry/vspline.h"
#include "../geometry/varc.h"
#include "../geometry/vsplinepath.h"
@ -22,6 +25,8 @@ public:
* @brief VContainer
*/
VContainer();
const VContainer &operator=(const VContainer &data);
void setData(const VContainer &data);
/**
* @brief GetPoint
* @param id
@ -63,6 +68,7 @@ public:
qreal GetValueStandartTableCell(const QString& name) const;
qreal GetValueIncrementTableRow(const QString& name) const;
void Clear();
void ClearObject();
void ClearIncrementTable();
void ClearLengthLines();
void ClearLengthSplines();
@ -89,7 +95,7 @@ public:
const QMap<qint64, VSplinePath> *DataSplinePaths() const;
void UpdateId(qint64 newId);
private:
qint64 _id;
static qint64 _id;
QMap<QString, qint32> base;
QMap<qint64, VPointF> points;
QMap<QString, VStandartTableCell> standartTable;

View File

@ -1,26 +1,14 @@
#include "vpointf.h"
VPointF::VPointF(){
_mx = 0;
_my = 0;
this->_x = 0;
this->_y = 0;
VPointF::VPointF():_name(QString()), _mx(0), _my(0), _x(0), _y(0){
}
VPointF::VPointF ( const VPointF & point ){
_name = point.name();
_mx = point.mx();
_my = point.my();
this->_x = point.x();
this->_y = point.y();
VPointF::VPointF ( const VPointF & point ):_name(point.name()), _mx(point.mx()), _my(point.my()),
_x(point.x()), _y(point.y()){
}
VPointF::VPointF (qreal x, qreal y , QString name, qreal mx, qreal my){
_name = name;
_mx = mx;
_my = my;
this->_x = x;
this->_y = y;
VPointF::VPointF (qreal x, qreal y , QString name, qreal mx, qreal my):_name(name), _mx(mx), _my(my), _x(x),
_y(y){
}
VPointF::~VPointF(){

View File

@ -1,10 +1,13 @@
#ifndef VPOINTF_H
#define VPOINTF_H
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
#pragma GCC diagnostic ignored "-Wconversion"
#pragma GCC diagnostic ignored "-Wsign-conversion"
#include <QPointF>
#include <QString>
#pragma GCC diagnostic warning "-Weffc++"
#pragma GCC diagnostic pop
class VPointF
{

View File

@ -1,6 +1,5 @@
<RCC>
<qresource prefix="/">
<file>cursor/spoint_cursor.png</file>
<file>cursor/endline_cursor.png</file>
<file>cursor/line_cursor.png</file>
<file>cursor/alongline_cursor.png</file>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

248
dialogs/dialoghistory.cpp Normal file
View File

@ -0,0 +1,248 @@
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
#include "dialoghistory.h"
#include "ui_dialoghistory.h"
#pragma GCC diagnostic pop
#include "geometry/varc.h"
#include "geometry/vspline.h"
#include "geometry/vsplinepath.h"
DialogHistory::DialogHistory(VContainer *data, VDomDocument *doc, QWidget *parent) :
DialogTool(data, parent), ui(new Ui::DialogHistory), doc(doc), cursorRow(0), cursorToolRecordRow(0){
ui->setupUi(this);
bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
connect(bOk, &QPushButton::clicked, this, &DialogHistory::DialogAccepted);
FillTable();
InitialTable();
connect(ui->tableWidget, &QTableWidget::cellClicked, this, &DialogHistory::cellClicked);
connect(this, &DialogHistory::ShowHistoryTool, doc, &VDomDocument::ShowHistoryTool);
connect(doc, &VDomDocument::ChangedCursor, this, &DialogHistory::ChangedCursor);
connect(doc, &VDomDocument::haveChange, this, &DialogHistory::UpdateHistory);
connect(doc, &VDomDocument::ChangedActivDraw, this, &DialogHistory::UpdateHistory);
ShowPoint();
}
DialogHistory::~DialogHistory(){
delete ui;
}
void DialogHistory::DialogAccepted(){
QTableWidgetItem *item = ui->tableWidget->item(cursorToolRecordRow, 0);
qint64 id = qvariant_cast<qint64>(item->data(Qt::UserRole));
emit ShowHistoryTool(id, Qt::green, false);
emit DialogClosed(QDialog::Accepted);
}
void DialogHistory::cellClicked(int row, int column){
if(column == 0){
QTableWidgetItem *item = ui->tableWidget->item(cursorRow, 0);
item->setIcon(QIcon());
item = ui->tableWidget->item(row, 0);
cursorRow = row;
item->setIcon(QIcon("://icon/32x32/put_after.png"));
qint64 id = qvariant_cast<qint64>(item->data(Qt::UserRole));
disconnect(doc, &VDomDocument::ChangedCursor, this, &DialogHistory::ChangedCursor);
doc->setCursor(id);
connect(doc, &VDomDocument::ChangedCursor, this, &DialogHistory::ChangedCursor);
} else {
QTableWidgetItem *item = ui->tableWidget->item(cursorToolRecordRow, 0);
qint64 id = qvariant_cast<qint64>(item->data(Qt::UserRole));
emit ShowHistoryTool(id, Qt::green, false);
cursorToolRecordRow = row;
item = ui->tableWidget->item(cursorToolRecordRow, 0);
id = qvariant_cast<qint64>(item->data(Qt::UserRole));
emit ShowHistoryTool(id, Qt::green, true);
}
}
void DialogHistory::ChangedCursor(qint64 id){
for(qint32 i = 0; i< ui->tableWidget->rowCount(); ++i){
QTableWidgetItem *item = ui->tableWidget->item(i, 0);
qint64 rId = qvariant_cast<qint64>(item->data(Qt::UserRole));
if(rId == id){
QTableWidgetItem *oldCursorItem = ui->tableWidget->item(cursorRow, 0);
oldCursorItem->setIcon(QIcon());
cursorRow = i;
item->setIcon(QIcon("://icon/32x32/put_after.png"));
}
}
}
void DialogHistory::UpdateHistory(){
FillTable();
InitialTable();
}
void DialogHistory::FillTable(){
ui->tableWidget->clear();
QVector<VToolRecord> *history = doc->getHistory();
qint32 currentRow = -1;
qint32 count = 0;
ui->tableWidget->setRowCount(history->size());
for(qint32 i = 0; i< history->size(); ++i){
VToolRecord tool = history->at(i);
if(tool.getNameDraw() != doc->GetNameActivDraw()){
continue;
}
currentRow++;
QTableWidgetItem *item = new QTableWidgetItem(QString());
item->setTextAlignment(Qt::AlignHCenter);
item->setData(Qt::UserRole, tool.getId());
ui->tableWidget->setItem(currentRow, 0, item);
QString historyRecord = Record(tool);
item = new QTableWidgetItem(historyRecord);
item->setFont(QFont("Times", 12, QFont::Bold));
item->setFlags(item->flags() ^ Qt::ItemIsEditable);
ui->tableWidget->setItem(currentRow, 1, item);
++count;
}
ui->tableWidget->setRowCount(count);
if(history->size()>0){
cursorRow = currentRow;
QTableWidgetItem *item = ui->tableWidget->item(cursorRow, 0);
item->setIcon(QIcon("://icon/32x32/put_after.png"));
}
ui->tableWidget->resizeColumnsToContents();
ui->tableWidget->resizeRowsToContents();
ui->tableWidget->verticalHeader()->setDefaultSectionSize(20);
}
QString DialogHistory::Record(const VToolRecord &tool){
QString record = QString();
qint64 basePointId = 0;
qint64 secondPointId = 0;
qint64 firstPointId = 0;
qint64 thirdPointId = 0;
qint64 p1Line1 = 0;
qint64 p2Line1 = 0;
qint64 p1Line2 = 0;
qint64 p2Line2 = 0;
QDomElement domElement;
switch( tool.getTypeTool() ){
case Tools::ArrowTool:
break;
case Tools::SinglePointTool:
record = QString("%1 - Базова точка").arg(data->GetPoint(tool.getId()).name());
break;
case Tools::EndLineTool:
domElement = doc->elementById(QString().setNum(tool.getId()));
if(domElement.isElement()){
basePointId = domElement.attribute("basePoint", "").toLongLong();
}
record = QString("%1_%2 - Відрізок з точки %1 до точки %2").arg(data->GetPoint(basePointId).name(),
data->GetPoint(tool.getId()).name());
break;
case Tools::LineTool:
domElement = doc->elementById(QString().setNum(tool.getId()));
if(domElement.isElement()){
firstPointId = domElement.attribute("firstPoint", "").toLongLong();
secondPointId = domElement.attribute("secondPoint", "").toLongLong();
}
record = QString("%1_%2 - Лінія з точки %1 до точки %2").arg(data->GetPoint(firstPointId).name(),
data->GetPoint(secondPointId).name());
break;
case Tools::AlongLineTool:
domElement = doc->elementById(QString().setNum(tool.getId()));
if(domElement.isElement()){
basePointId = domElement.attribute("firstPoint", "").toLongLong();
secondPointId = domElement.attribute("secondPoint", "").toLongLong();
}
record = QString("%3 - Точка на відрізку %1_%2").arg(data->GetPoint(basePointId).name(),
data->GetPoint(secondPointId).name(),
data->GetPoint(tool.getId()).name());
break;
case Tools::ShoulderPointTool:
record = QString("%1 - Плечева точка").arg(data->GetPoint(tool.getId()).name());
break;
case Tools::NormalTool:
domElement = doc->elementById(QString().setNum(tool.getId()));
if(domElement.isElement()){
basePointId = domElement.attribute("firstPoint", "").toLongLong();
secondPointId = domElement.attribute("secondPoint", "").toLongLong();
}
record = QString("%3 - Перпендикуляр до відрузку %1_%2").arg(data->GetPoint(basePointId).name(),
data->GetPoint(secondPointId).name(),
data->GetPoint(tool.getId()).name());
break;
case Tools::BisectorTool:
domElement = doc->elementById(QString().setNum(tool.getId()));
if(domElement.isElement()){
firstPointId = domElement.attribute("firstPoint", "").toLongLong();
basePointId = domElement.attribute("secondPoint", "").toLongLong();
thirdPointId = domElement.attribute("thirdPoint", "").toLongLong();
}
record = QString("%4 - Бісектриса кута %1_%2_%3").arg(data->GetPoint(firstPointId).name(),
data->GetPoint(basePointId).name(),
data->GetPoint(thirdPointId).name(),
data->GetPoint(tool.getId()).name());
break;
case Tools::LineIntersectTool:
domElement = doc->elementById(QString().setNum(tool.getId()));
if(domElement.isElement()){
p1Line1 = domElement.attribute("p1Line1", "").toLongLong();
p2Line1 = domElement.attribute("p2Line1", "").toLongLong();
p1Line2 = domElement.attribute("p1Line2", "").toLongLong();
p2Line2 = domElement.attribute("p2Line2", "").toLongLong();
}
record = QString("%5 - Точка перетину відрузку %1_%2 і %3_%4").arg(data->GetPoint(p1Line1).name(),
data->GetPoint(p2Line1).name(),
data->GetPoint(p1Line2).name(),
data->GetPoint(p2Line2).name(),
data->GetPoint(tool.getId()).name());
break;
case Tools::SplineTool:{
VSpline spl = data->GetSpline(tool.getId());
record = QString("Сплайн %1_%2").arg(data->GetPoint(spl.GetP1()).name(),
data->GetPoint(spl.GetP4()).name());
}
break;
case Tools::ArcTool:{
VArc arc = data->GetArc(tool.getId());
record = QString("Дуга з центром в точці %1").arg(data->GetPoint(arc.GetCenter()).name());
}
break;
case Tools::SplinePathTool:{
VSplinePath splPath = data->GetSplinePath(tool.getId());
QVector<VSplinePoint> points = splPath.GetSplinePath();
if(points.size() != 0 ){
record = QString("Шлях сплайну %1").arg(data->GetPoint(points[0].P()).name());
for(qint32 i = 1; i< points.size(); ++i){
QString name = QString("_%1").arg(data->GetPoint(points[i].P()).name());
record.append(name);
}
}
}
break;
}
return record;
}
void DialogHistory::InitialTable(){
ui->tableWidget->setSortingEnabled(false);
ui->tableWidget->setHorizontalHeaderItem(0, new QTableWidgetItem(" "));
ui->tableWidget->setHorizontalHeaderItem(1, new QTableWidgetItem("Інструмент"));
}
void DialogHistory::ShowPoint(){
QVector<VToolRecord> *history = doc->getHistory();
if(history->size()>0){
QTableWidgetItem *item = ui->tableWidget->item(0, 1);
item->setSelected(true);
cursorToolRecordRow = 0;
item = ui->tableWidget->item(0, 0);
qint64 id = qvariant_cast<qint64>(item->data(Qt::UserRole));
emit ShowHistoryTool(id, Qt::green, true);
}
}
void DialogHistory::closeEvent(QCloseEvent *event){
QTableWidgetItem *item = ui->tableWidget->item(cursorToolRecordRow, 0);
qint64 id = qvariant_cast<qint64>(item->data(Qt::UserRole));
emit ShowHistoryTool(id, Qt::green, false);
DialogTool::closeEvent(event);
}

41
dialogs/dialoghistory.h Normal file
View File

@ -0,0 +1,41 @@
#ifndef DIALOGHISTORY_H
#define DIALOGHISTORY_H
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
#include "dialogtool.h"
#include "../xml/vdomdocument.h"
#pragma GCC diagnostic pop
namespace Ui {
class DialogHistory;
}
class DialogHistory : public DialogTool
{
Q_OBJECT
public:
explicit DialogHistory(VContainer *data, VDomDocument *doc, QWidget *parent = 0);
virtual ~DialogHistory();
public slots:
virtual void DialogAccepted();
void cellClicked(int row, int column);
void ChangedCursor(qint64 id);
void UpdateHistory();
signals:
void ShowHistoryTool(qint64 id, Qt::GlobalColor color, bool enable);
protected:
virtual void closeEvent ( QCloseEvent * event );
private:
Ui::DialogHistory *ui;
VDomDocument *doc;
qint32 cursorRow;
qint32 cursorToolRecordRow;
void FillTable();
QString Record(const VToolRecord &tool);
void InitialTable();
void ShowPoint();
};
#endif // DIALOGHISTORY_H

99
dialogs/dialoghistory.ui Normal file
View File

@ -0,0 +1,99 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DialogHistory</class>
<widget class="QDialog" name="DialogHistory">
<property name="windowModality">
<enum>Qt::NonModal</enum>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>488</width>
<height>420</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTableWidget" name="tableWidget">
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<attribute name="horizontalHeaderVisible">
<bool>true</bool>
</attribute>
<attribute name="horizontalHeaderHighlightSections">
<bool>false</bool>
</attribute>
<attribute name="horizontalHeaderStretchLastSection">
<bool>true</bool>
</attribute>
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
<attribute name="verticalHeaderHighlightSections">
<bool>false</bool>
</attribute>
<column>
<property name="text">
<string/>
</property>
</column>
<column>
<property name="text">
<string>Інструмент</string>
</property>
</column>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>DialogHistory</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>DialogHistory</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -40,11 +40,11 @@ void DialogIncrements::FillStandartTable(){
const QMap<QString, VStandartTableCell> *standartTable = data->DataStandartTable();
qint32 currentRow = -1;
QMapIterator<QString, VStandartTableCell> i(*standartTable);
ui->tableWidgetStandart->setRowCount ( standartTable->size() );
while (i.hasNext()) {
i.next();
VStandartTableCell cell = i.value();
currentRow++;
ui->tableWidgetStandart->setRowCount ( standartTable->size() );
QTableWidgetItem *item = new QTableWidgetItem(QString(i.key()));
item->setTextAlignment(Qt::AlignHCenter);

View File

@ -127,8 +127,8 @@ bool DialogLineIntersect::CheckIntersecion(){
VPointF p1L2 = data->GetPoint(p1Line2);
VPointF p2L2 = data->GetPoint(p2Line2);
QLineF line1(p1L1, p2L1);
QLineF line2(p1L2, p2L2);
QLineF line1(p1L1.toQPointF(), p2L1.toQPointF());
QLineF line2(p1L2.toQPointF(), p2L2.toQPointF());
QPointF fPoint;
QLineF::IntersectType intersect = line1.intersect(line2, &fPoint);
if(intersect == QLineF::UnboundedIntersection || intersect == QLineF::BoundedIntersection){

View File

@ -62,8 +62,8 @@ protected:
QRadioButton *radioButtonStandartTable;
QRadioButton *radioButtonIncrements;
QRadioButton *radioButtonLengthLine;
void closeEvent ( QCloseEvent * event );
void showEvent( QShowEvent *event );
virtual void closeEvent ( QCloseEvent * event );
virtual void showEvent( QShowEvent *event );
void FillComboBoxPoints(QComboBox *box, const qint64 &id = 0)const;
void FillComboBoxTypeLine(QComboBox *box) const;
virtual void CheckState();

View File

@ -3,7 +3,6 @@
<file>icon/64x64/icon64x64.png</file>
<file>icon/32x32/draw.png</file>
<file>icon/32x32/kontur.png</file>
<file>icon/32x32/spoint.png</file>
<file>icon/32x32/arrow_cursor.png</file>
<file>icon/32x32/new_draw.png</file>
<file>icon/32x32/option_draw.png</file>
@ -29,5 +28,7 @@
<file>icon/32x32/arc.png</file>
<file>icon/24x24/putHereLeft.png</file>
<file>icon/32x32/splinePath.png</file>
<file>icon/32x32/history.png</file>
<file>icon/32x32/put_after.png</file>
</qresource>
</RCC>

BIN
icon/32x32/history.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

BIN
icon/32x32/put_after.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 520 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -21,7 +21,6 @@
#include "tools/vtoolarc.h"
#include "tools/vtoolsplinepath.h"
#pragma GCC diagnostic warning "-Weffc++"
#include "options.h"
#include "geometry/vspline.h"
MainWindow::MainWindow(QWidget *parent) :
@ -40,11 +39,8 @@ MainWindow::MainWindow(QWidget *parent) :
QSizePolicy policy(QSizePolicy::Expanding, QSizePolicy::Expanding);
policy.setHorizontalStretch(12);
view->setSizePolicy(policy);
//view->setMinimumSize(800, 600);
connect(scene, &VMainGraphicsScene::mouseMove, this, &MainWindow::mouseMove);
connect(ui->toolButtonSinglePoint, &QToolButton::clicked, this,
&MainWindow::ToolSinglePoint);
helpLabel = new QLabel("Створіть новий файл для початку роботи.");
ui->statusBar->addWidget(helpLabel);
@ -58,30 +54,21 @@ MainWindow::MainWindow(QWidget *parent) :
connect(ui->actionOpen, &QAction::triggered, this, &MainWindow::ActionOpen);
connect(ui->actionNew, &QAction::triggered, this, &MainWindow::ActionNew);
connect(ui->actionTable, &QAction::triggered, this, &MainWindow::ActionTable);
connect(ui->toolButtonEndLine, &QToolButton::clicked, this,
&MainWindow::ToolEndLine);
connect(ui->toolButtonLine, &QToolButton::clicked, this,
&MainWindow::ToolLine);
connect(ui->toolButtonAlongLine, &QToolButton::clicked, this,
&MainWindow::ToolAlongLine);
connect(ui->toolButtonShoulderPoint, &QToolButton::clicked, this,
&MainWindow::ToolShoulderPoint);
connect(ui->toolButtonNormal, &QToolButton::clicked, this,
&MainWindow::ToolNormal);
connect(ui->toolButtonBisector, &QToolButton::clicked, this,
&MainWindow::ToolBisector);
connect(ui->toolButtonLineIntersect, &QToolButton::clicked, this,
&MainWindow::ToolLineIntersect);
connect(ui->toolButtonSpline, &QToolButton::clicked, this,
&MainWindow::ToolSpline);
connect(ui->toolButtonArc, &QToolButton::clicked, this,
&MainWindow::ToolArc);
connect(ui->toolButtonSplinePath, &QToolButton::clicked, this,
&MainWindow::ToolSplinePath);
connect(ui->actionHistory, &QAction::triggered, this, &MainWindow::ActionHistory);
connect(ui->toolButtonEndLine, &QToolButton::clicked, this, &MainWindow::ToolEndLine);
connect(ui->toolButtonLine, &QToolButton::clicked, this, &MainWindow::ToolLine);
connect(ui->toolButtonAlongLine, &QToolButton::clicked, this, &MainWindow::ToolAlongLine);
connect(ui->toolButtonShoulderPoint, &QToolButton::clicked, this, &MainWindow::ToolShoulderPoint);
connect(ui->toolButtonNormal, &QToolButton::clicked, this, &MainWindow::ToolNormal);
connect(ui->toolButtonBisector, &QToolButton::clicked, this, &MainWindow::ToolBisector);
connect(ui->toolButtonLineIntersect, &QToolButton::clicked, this, &MainWindow::ToolLineIntersect);
connect(ui->toolButtonSpline, &QToolButton::clicked, this, &MainWindow::ToolSpline);
connect(ui->toolButtonArc, &QToolButton::clicked, this, &MainWindow::ToolArc);
connect(ui->toolButtonSplinePath, &QToolButton::clicked, this, &MainWindow::ToolSplinePath);
data = new VContainer;
doc = new VDomDocument(data);
doc = new VDomDocument(data, comboBoxDraws);
doc->CreateEmptyFile();
connect(doc, &VDomDocument::haveChange, this, &MainWindow::haveChange);
@ -123,13 +110,28 @@ void MainWindow::ActionNewDraw(){
qCritical()<<"Помилка створення креслення з ім'ям"<<nameDraw<<".";
return;//не змогли додати креслення.
}
comboBoxDraws->addItem(nameDraw, true);
disconnect(comboBoxDraws, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
this, &MainWindow::currentDrawChanged);
comboBoxDraws->addItem(nameDraw);
index = comboBoxDraws->findText(nameDraw);
if ( index != -1 ) { // -1 for not found
comboBoxDraws->setCurrentIndex(index);
currentDrawChanged( index );
}
connect(comboBoxDraws, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
this, &MainWindow::currentDrawChanged);
data->ClearObject();
//Create single point
qint64 id = data->AddPoint(VPointF((10+comboBoxDraws->count()*5)*PrintDPI/25.4, 10*PrintDPI/25.4, "А", 5,
10));
VToolSinglePoint *spoint = new VToolSinglePoint(doc, data, id, Tool::FromGui);
scene->addItem(spoint);
connect(spoint, &VToolPoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
QMap<qint64, VDataTool*>* tools = doc->getTools();
tools->insert(id, spoint);
VAbstractTool::AddRecord(id, Tools::SinglePointTool, doc);
SetEnableTool(true);
SetEnableWidgets(true);
SetEnableTool(false);
}
void MainWindow::OptionDraw(){
@ -186,49 +188,6 @@ void MainWindow::SetToolButton(bool checked, Tools::Enum t, const QString &curso
}
}
/*
* Інструмет базова точка креслення.
*/
void MainWindow::ToolSinglePoint(bool checked){
if(checked){
CanselTool();
tool = Tools::SinglePointTool;
QPixmap pixmap(":/cursor/spoint_cursor.png");
QCursor cur(pixmap, 2, 3);
view->setCursor(cur);
helpLabel->setText("Виберіть розташування для точки.");
dialogSinglePoint = new DialogSinglePoint(data);
//покажемо вікно як тільки буде вибрано місце розташування для точки
connect(scene, &VMainGraphicsScene::mousePress, dialogSinglePoint,
&DialogSinglePoint::mousePress);
connect(dialogSinglePoint, &DialogSinglePoint::DialogClosed, this,
&MainWindow::ClosedDialogSinglePoint);
} else { //не даємо користувачу зняти виділення кнопки
ui->toolButtonSinglePoint->setChecked(true);
}
}
void MainWindow::ClosedDialogSinglePoint(int result){
if(result == QDialog::Accepted){
QPointF point = dialogSinglePoint->getPoint();
QString name = dialogSinglePoint->getName();
qint64 id = data->AddPoint(VPointF(point.x(), point.y(), name, 5, 10));
VToolSinglePoint *spoint = new VToolSinglePoint(doc, data, id, Tool::FromGui);
scene->addItem(spoint);
connect(spoint, &VToolPoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
QMap<qint64, VDataTool*>* tools = doc->getTools();
tools->insert(id, spoint);
ArrowTool();
ui->toolButtonSinglePoint->setEnabled(false);
qint32 index = comboBoxDraws->currentIndex();
comboBoxDraws->setItemData(index, false);
ui->actionSave->setEnabled(true);
SetEnableTool(true);
}
ArrowTool();
}
void MainWindow::ToolEndLine(bool checked){
SetToolButton(checked, Tools::EndLineTool, ":/cursor/endline_cursor.png", dialogEndLine,
&MainWindow::ClosedDialogEndLine);
@ -423,25 +382,22 @@ void MainWindow::ToolBarDraws(){
ui->toolBarDraws->addAction(ui->actionTable);
ui->actionTable->setEnabled(false);
ui->toolBarDraws->addAction(ui->actionHistory);
ui->actionHistory->setEnabled(false);
}
void MainWindow::currentDrawChanged( int index ){
if(index != -1) {
bool status = qvariant_cast<bool>(comboBoxDraws->itemData(index));
ui->toolButtonSinglePoint->setEnabled(status);
if(ui->toolButtonSinglePoint->isEnabled() == false){
SetEnableTool(true);
} else {
SetEnableTool(false);
}
doc->setCurrentData();
doc->ChangeActivDraw(comboBoxDraws->itemText(index));
}
}
void MainWindow::mouseMove(QPointF scenePos){
QString string = QString("%1, %2")
.arg((qint32)(scenePos.x()/PrintDPI*25.4))
.arg((qint32)(scenePos.y()/PrintDPI*25.4));
.arg(static_cast<qint32>(scenePos.x()/PrintDPI*25.4))
.arg(static_cast<qint32>(scenePos.y()/PrintDPI*25.4));
mouseCoordinate->setText(string);
}
@ -452,9 +408,7 @@ void MainWindow::CanselTool(){
ui->actionArrowTool->setChecked(false);
break;
case Tools::SinglePointTool:
//Знищимо діалогове вікно.
delete dialogSinglePoint;
ui->toolButtonSinglePoint->setChecked(false);
//Nothing to do here because we can't create this tool from main window.
break;
case Tools::EndLineTool:
dialogEndLine.clear();
@ -611,30 +565,22 @@ void MainWindow::ActionOpen(){
QFile file(fileName);
if(file.open(QIODevice::ReadOnly)){
if(doc->setContent(&file)){
scene->clear();
comboBoxDraws->clear();
// ui->toolButtonSinglePoint->setEnabled(true);
disconnect(comboBoxDraws, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
this, &MainWindow::currentDrawChanged);
doc->Parse(Document::FullParse, scene, comboBoxDraws);
doc->Parse(Document::FullParse, scene);
connect(comboBoxDraws, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
this, &MainWindow::currentDrawChanged);
ui->actionSave->setEnabled(true);
ui->actionSaveAs->setEnabled(true);
ui->actionTable->setEnabled(true);
QString nameDraw = doc->GetNameActivDraw();
qint32 index = comboBoxDraws->findText(nameDraw);
if ( index != -1 ) { // -1 for not found
comboBoxDraws->setCurrentIndex(index);
}
if(comboBoxDraws->count() == 1){
if(ui->toolButtonSinglePoint->isEnabled()==false){
SetEnableTool(true);
} else {
SetEnableTool(false);
}
if(comboBoxDraws->count() > 0){
SetEnableTool(true);
} else {
SetEnableTool(false);
}
SetEnableWidgets(true);
}
file.close();
}
@ -649,7 +595,6 @@ void MainWindow::ActionNew(){
CanselTool();
comboBoxDraws->clear();
fileName.clear();
ui->toolButtonSinglePoint->setEnabled(true);
ui->actionOptionDraw->setEnabled(false);
ui->actionSave->setEnabled(false);
SetEnableTool(false);
@ -677,12 +622,12 @@ void MainWindow::SetEnableWidgets(bool enable){
ui->actionSaveAs->setEnabled(enable);
ui->actionDraw->setEnabled(enable);
ui->actionDetails->setEnabled(enable);
ui->toolButtonSinglePoint->setEnabled(enable);
ui->actionOptionDraw->setEnabled(enable);
if(enable == true && !fileName.isEmpty()){
ui->actionSave->setEnabled(enable);
}
ui->actionTable->setEnabled(enable);
ui->actionHistory->setEnabled(enable);
}
void MainWindow::ActionTable(bool checked){
@ -702,6 +647,24 @@ void MainWindow::ClosedActionTable(){
delete dialogTable;
}
void MainWindow::ActionHistory(bool checked){
if(checked){
dialogHistory = new DialogHistory(data, doc, this);
dialogHistory->setWindowFlags(Qt::Window);
connect(dialogHistory, &DialogHistory::DialogClosed, this,
&MainWindow::ClosedActionHistory);
dialogHistory->show();
} else {
ui->actionHistory->setChecked(true);
dialogHistory->activateWindow();
}
}
void MainWindow::ClosedActionHistory(){
ui->actionHistory->setChecked(false);
delete dialogHistory;
}
void MainWindow::SetEnableTool(bool enable){
ui->toolButtonEndLine->setEnabled(enable);
ui->toolButtonLine->setEnabled(enable);

View File

@ -12,7 +12,6 @@
#include "widgets/vmaingraphicsscene.h"
#include "widgets/vmaingraphicsview.h"
#include "dialogs/dialogsinglepoint.h"
#include "dialogs/dialogincrements.h"
#include "dialogs/dialogline.h"
#include "dialogs/dialogalongline.h"
@ -24,33 +23,17 @@
#include "dialogs/dialogspline.h"
#include "dialogs/dialogarc.h"
#include "dialogs/dialogsplinepath.h"
#include "dialogs/dialoghistory.h"
#include "tools/vtoolsinglepoint.h"
#include "xml/vdomdocument.h"
#pragma GCC diagnostic warning "-Weffc++"
#include "container/vcontainer.h"
#include "options.h"
namespace Ui {
class MainWindow;
}
namespace Tools{
enum Enum
{
ArrowTool,
SinglePointTool,
EndLineTool,
LineTool,
AlongLineTool,
ShoulderPointTool,
NormalTool,
BisectorTool,
LineIntersectTool,
SplineTool,
ArcTool,
SplinePathTool
};
}
class MainWindow : public QMainWindow
{
Q_OBJECT
@ -59,11 +42,9 @@ public:
~MainWindow();
public slots:
void mouseMove(QPointF scenePos);
void ToolSinglePoint(bool checked);
void ActionAroowTool();
void ActionDraw(bool checked);
void ActionDetails(bool checked);
void ClosedDialogSinglePoint(int result);
void ActionNewDraw();
void currentDrawChanged( int index );
void OptionDraw();
@ -76,6 +57,8 @@ public slots:
void ChangedGrowth(const QString & text);
void ActionTable(bool checked);
void ClosedActionTable();
void ActionHistory(bool checked);
void ClosedActionHistory();
void ToolEndLine(bool checked);
void ClosedDialogEndLine(int result);
void ToolLine(bool checked);
@ -107,7 +90,6 @@ private:
QLabel *helpLabel;
VMainGraphicsView *view;
bool isInitialized;
DialogSinglePoint *dialogSinglePoint;
DialogIncrements *dialogTable;
QSharedPointer<DialogEndLine> dialogEndLine;
QSharedPointer<DialogLine> dialogLine;
@ -119,6 +101,7 @@ private:
QSharedPointer<DialogSpline> dialogSpline;
QSharedPointer<DialogArc> dialogArc;
QSharedPointer<DialogSplinePath> dialogSplinePath;
DialogHistory *dialogHistory;
VDomDocument *doc;
VContainer *data;
QComboBox *comboBoxDraws;

View File

@ -51,81 +51,6 @@
<string>Точка</string>
</attribute>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="1">
<widget class="QToolButton" name="toolButtonEndLine">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="icon.qrc">
<normaloff>:/icon/32x32/segment.png</normaloff>:/icon/32x32/segment.png</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QToolButton" name="toolButtonAlongLine">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="icon.qrc">
<normaloff>:/icon/32x32/along_line.png</normaloff>:/icon/32x32/along_line.png</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QToolButton" name="toolButtonSinglePoint">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Точка</string>
</property>
<property name="statusTip">
<string/>
</property>
<property name="text">
<string>Точка</string>
</property>
<property name="icon">
<iconset resource="icon.qrc">
<normaloff>:/icon/32x32/spoint.png</normaloff>:/icon/32x32/spoint.png</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QToolButton" name="toolButtonNormal">
<property name="enabled">
@ -172,7 +97,53 @@
</property>
</widget>
</item>
<item row="1" column="2">
<item row="0" column="0">
<widget class="QToolButton" name="toolButtonEndLine">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="icon.qrc">
<normaloff>:/icon/32x32/segment.png</normaloff>:/icon/32x32/segment.png</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QToolButton" name="toolButtonAlongLine">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="icon.qrc">
<normaloff>:/icon/32x32/along_line.png</normaloff>:/icon/32x32/along_line.png</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QToolButton" name="toolButtonBisector">
<property name="enabled">
<bool>false</bool>
@ -202,7 +173,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>1074</width>
<width>100</width>
<height>58</height>
</rect>
</property>
@ -269,7 +240,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>1074</width>
<width>100</width>
<height>58</height>
</rect>
</property>
@ -336,7 +307,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>1074</width>
<width>87</width>
<height>58</height>
</rect>
</property>
@ -378,7 +349,7 @@
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="LayoutView" stretch="">
<layout class="QHBoxLayout" name="LayoutView">
<property name="spacing">
<number>10</number>
</property>
@ -600,6 +571,18 @@
<string>Таблиці змінних</string>
</property>
</action>
<action name="actionHistory">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="icon.qrc">
<normaloff>:/icon/32x32/history.png</normaloff>:/icon/32x32/history.png</iconset>
</property>
<property name="text">
<string>History</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources>

View File

@ -17,4 +17,22 @@ namespace Scene{
};
}
namespace Tools{
enum Enum
{
ArrowTool,
SinglePointTool,
EndLineTool,
LineTool,
AlongLineTool,
ShoulderPointTool,
NormalTool,
BisectorTool,
LineIntersectTool,
SplineTool,
ArcTool,
SplinePathTool
};
}
#endif // OPTIONS_H

View File

@ -4,9 +4,8 @@
#pragma GCC diagnostic pop
VAbstractTool::VAbstractTool(VDomDocument *doc, VContainer *data, qint64 id, QObject *parent):
VDataTool(data, parent){
VDataTool(data, parent), baseColor(Qt::black), currentColor(Qt::black){
this->doc = doc;
this->id = id;
nameActivDraw = doc->GetNameActivDraw();
ignoreContextMenuEvent = false;//don't ignore context menu events;
@ -16,6 +15,7 @@ VAbstractTool::VAbstractTool(VDomDocument *doc, VContainer *data, qint64 id, QOb
connect(this, &VAbstractTool::toolhaveChange, this->doc, &VDomDocument::haveLiteChange);
connect(this->doc, &VDomDocument::FullUpdateFromFile, this, &VAbstractTool::FullUpdateFromFile);
connect(this, &VAbstractTool::FullUpdateTree, this->doc, &VDomDocument::FullUpdateTree);
connect(this->doc, &VDomDocument::ShowTool, this, &VAbstractTool::ShowTool);
}
void VAbstractTool::ChangedNameDraw(const QString oldName, const QString newName){
@ -32,6 +32,12 @@ void VAbstractTool::ChangedActivDraw(const QString newName){
}
}
void VAbstractTool::ShowTool(qint64 id, Qt::GlobalColor color, bool enable){
Q_UNUSED(id);
Q_UNUSED(color);
Q_UNUSED(enable);
}
void VAbstractTool::AddAttribute(QDomElement &domElement, const QString &name, const qint64 &value){
QDomAttr domAttr = doc->createAttribute(name);
domAttr.setValue(QString().setNum(value));
@ -63,10 +69,22 @@ void VAbstractTool::AddToCalculation(const QDomElement &domElement){
QDomElement calcElement;
bool ok = doc->GetActivCalculationElement(calcElement);
if(ok){
calcElement.appendChild(domElement);
qint64 id = doc->getCursor();
if(id <= 0){
calcElement.appendChild(domElement);
} else {
QDomElement refElement = doc->elementById(QString().setNum(doc->getCursor()));
if(refElement.isElement()){
calcElement.insertAfter(domElement,refElement);
doc->setCursor(0);
} else {
qCritical()<<"Не можу знайти елемент після якого потрібно вставляти."<< Q_FUNC_INFO;
}
}
} else {
qCritical()<<"Не можу знайти тег калькуляції."<< Q_FUNC_INFO;
}
emit toolhaveChange();
}
const VContainer *VAbstractTool::getData()const{
@ -79,3 +97,21 @@ void VAbstractTool::setData(const VContainer &value){
void VAbstractTool::setDialog(){
}
void VAbstractTool::AddRecord(const qint64 id, Tools::Enum toolType, VDomDocument *doc){
qint64 cursor = doc->getCursor();
QVector<VToolRecord> *history = doc->getHistory();
if(cursor <= 0){
history->append(VToolRecord(id, toolType, doc->GetNameActivDraw()));
} else {
qint32 index = 0;
for(qint32 i = 0; i<history->size(); ++i){
VToolRecord rec = history->at(i);
if(rec.getId() == cursor){
index = i;
break;
}
}
history->insert(index+1, VToolRecord(id, toolType, doc->GetNameActivDraw()));
}
}

View File

@ -23,11 +23,13 @@ public:
VAbstractTool(VDomDocument *doc, VContainer *data, qint64 id, QObject *parent = 0);
virtual ~VAbstractTool();
virtual void setDialog();
static void AddRecord(const qint64 id, Tools::Enum toolType, VDomDocument *doc);
public slots:
virtual void FullUpdateFromFile()=0;
void ChangedNameDraw(const QString oldName, const QString newName);
virtual void ChangedActivDraw(const QString newName);
virtual void FullUpdateFromGui(int result)=0;
virtual void ShowTool(qint64 id, Qt::GlobalColor color, bool enable);
signals:
void toolhaveChange();
void ChoosedTool(qint64 id, Scene::Type type);
@ -37,6 +39,8 @@ protected:
qint64 id;
bool ignoreContextMenuEvent;
QString nameActivDraw;
const Qt::GlobalColor baseColor;
Qt::GlobalColor currentColor;
virtual void AddToFile()=0;
void AddAttribute(QDomElement &domElement, const QString &name, const qint64 &value);
void AddAttribute(QDomElement &domElement, const QString &name, const qint32 &value);

View File

@ -63,7 +63,6 @@ void VToolAlongLine::AddToFile(){
AddAttribute(domElement, "secondPoint", secondPointId);
AddToCalculation(domElement);
emit toolhaveChange();
}
void VToolAlongLine::setDialog(){
@ -113,6 +112,7 @@ void VToolAlongLine::Create(const qint64 _id, const QString &pointName, const QS
tools->insert(id, tool);
}
}
VAbstractTool::AddRecord(id, Tools::AlongLineTool, doc);
data->AddLine(firstPointId, id);
data->AddLine(id, secondPointId);
if(parse == Document::FullParse){
@ -122,6 +122,7 @@ void VToolAlongLine::Create(const qint64 _id, const QString &pointName, const QS
connect(point, &VToolAlongLine::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
QMap<qint64, VDataTool*>* tools = doc->getTools();
tools->insert(id,point);
}
}
}

View File

@ -76,6 +76,7 @@ void VToolArc::Create(const qint64 _id, const qint64 &center, const QString &rad
}
}
data->AddLengthArc(data->GetNameArc(center,id), arc.GetLength());
VAbstractTool::AddRecord(id, Tools::ArcTool, doc);
if(parse == Document::FullParse){
VToolArc *toolArc = new VToolArc(doc, data, id, typeCreation);
scene->addItem(toolArc);
@ -117,6 +118,18 @@ void VToolArc::ChangedActivDraw(const QString newName){
}
}
void VToolArc::ShowTool(qint64 id, Qt::GlobalColor color, bool enable){
if(id == this->id){
if(enable == false){
this->setPen(QPen(baseColor, widthHairLine));
currentColor = baseColor;
} else {
this->setPen(QPen(color, widthHairLine));
currentColor = color;
}
}
}
void VToolArc::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
ContextMenu(dialogArc, this, event);
}
@ -133,7 +146,6 @@ void VToolArc::AddToFile(){
AddAttribute(domElement, "angle2", arc.GetFormulaF2());
AddToCalculation(domElement);
emit toolhaveChange();
}
void VToolArc::mouseReleaseEvent(QGraphicsSceneMouseEvent *event){
@ -145,12 +157,12 @@ void VToolArc::mouseReleaseEvent(QGraphicsSceneMouseEvent *event){
void VToolArc::hoverMoveEvent(QGraphicsSceneHoverEvent *event){
Q_UNUSED(event);
this->setPen(QPen(Qt::black, widthMainLine));
this->setPen(QPen(currentColor, widthMainLine));
}
void VToolArc::hoverLeaveEvent(QGraphicsSceneHoverEvent *event){
Q_UNUSED(event);
this->setPen(QPen(Qt::black, widthHairLine));
this->setPen(QPen(currentColor, widthHairLine));
}
void VToolArc::RefreshGeometry(){

View File

@ -24,6 +24,7 @@ public slots:
virtual void FullUpdateFromFile();
virtual void FullUpdateFromGui(int result);
virtual void ChangedActivDraw(const QString newName);
virtual void ShowTool(qint64 id, Qt::GlobalColor color, bool enable);
protected:
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
virtual void AddToFile();

View File

@ -81,6 +81,7 @@ void VToolBisector::Create(const qint64 _id, const QString &formula, const qint6
}
}
data->AddLine(firstPointId, id);
VAbstractTool::AddRecord(id, Tools::BisectorTool, doc);
if(parse == Document::FullParse){
VToolBisector *point = new VToolBisector(doc, data, id, typeLine, formula,
firstPointId, secondPointId, thirdPointId,
@ -142,5 +143,4 @@ void VToolBisector::AddToFile(){
AddAttribute(domElement, "thirdPoint", thirdPointId);
AddToCalculation(domElement);
emit toolhaveChange();
}

View File

@ -63,6 +63,7 @@ void VToolEndLine::Create(const qint64 _id, const QString &pointName, const QStr
}
}
data->AddLine(basePointId, id);
VAbstractTool::AddRecord(id, Tools::EndLineTool, doc);
if(parse == Document::FullParse){
VToolEndLine *point = new VToolEndLine(doc, data, id, typeLine, formula, angle,
basePointId, typeCreation);
@ -120,6 +121,5 @@ void VToolEndLine::AddToFile(){
AddAttribute(domElement, "basePoint", basePointId);
AddToCalculation(domElement);
emit toolhaveChange();
}

View File

@ -43,6 +43,7 @@ void VToolLine::Create(const qint64 &id, const qint64 &firstPoint, const qint64
tool->VDataTool::setData(data);
tools->insert(id, tool);
}
VAbstractTool::AddRecord(id, Tools::LineTool, doc);
if(parse == Document::FullParse){
qint64 id = data->getNextId();
VToolLine *line = new VToolLine(doc, data, id, firstPoint, secondPoint, typeCreation);
@ -76,6 +77,18 @@ void VToolLine::FullUpdateFromGui(int result){
dialogLine.clear();
}
void VToolLine::ShowTool(qint64 id, Qt::GlobalColor color, bool enable){
if(id == this->id){
if(enable == false){
this->setPen(QPen(baseColor, widthHairLine));
currentColor = baseColor;
} else {
this->setPen(QPen(color, widthHairLine));
currentColor = color;
}
}
}
void VToolLine::ChangedActivDraw(const QString newName){
if(nameActivDraw == newName){
this->setPen(QPen(Qt::black, widthHairLine));
@ -100,16 +113,15 @@ void VToolLine::AddToFile(){
AddAttribute(domElement, "secondPoint", secondPoint);
AddToCalculation(domElement);
emit toolhaveChange();
}
void VToolLine::hoverMoveEvent(QGraphicsSceneHoverEvent *event){
Q_UNUSED(event);
this->setPen(QPen(Qt::black, widthMainLine));
this->setPen(QPen(currentColor, widthMainLine));
}
void VToolLine::hoverLeaveEvent(QGraphicsSceneHoverEvent *event){
Q_UNUSED(event);
this->setPen(QPen(Qt::black, widthHairLine));
this->setPen(QPen(currentColor, widthHairLine));
}

View File

@ -21,6 +21,7 @@ public slots:
virtual void FullUpdateFromFile();
virtual void ChangedActivDraw(const QString newName);
virtual void FullUpdateFromGui(int result);
virtual void ShowTool(qint64 id, Qt::GlobalColor color, bool enable);
protected:
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
virtual void AddToFile();

View File

@ -67,6 +67,7 @@ void VToolLineIntersect::Create(const qint64 _id, const qint64 &p1Line1Id, const
data->AddLine(id, p2Line1Id);
data->AddLine(p1Line2Id, id);
data->AddLine(id, p2Line2Id);
VAbstractTool::AddRecord(id, Tools::LineIntersectTool, doc);
if(parse == Document::FullParse){
VToolLineIntersect *point = new VToolLineIntersect(doc, data, id, p1Line1Id,
p2Line1Id, p1Line2Id,
@ -126,5 +127,4 @@ void VToolLineIntersect::AddToFile(){
AddAttribute(domElement, "p2Line2", p2Line2);
AddToCalculation(domElement);
emit toolhaveChange();
}

View File

@ -63,6 +63,7 @@ void VToolNormal::Create(const qint64 _id, const QString &formula, const qint64
}
}
data->AddLine(firstPointId, id);
VAbstractTool::AddRecord(id, Tools::NormalTool, doc);
if(parse == Document::FullParse){
VToolNormal *point = new VToolNormal(doc, data, id, typeLine, formula, angle,
firstPointId, secondPointId, typeCreation);
@ -132,5 +133,4 @@ void VToolNormal::AddToFile(){
AddAttribute(domElement, "secondPoint", secondPointId);
AddToCalculation(domElement);
emit toolhaveChange();
}

View File

@ -169,6 +169,18 @@ void VToolPoint::ChangedActivDraw(const QString newName){
}
}
void VToolPoint::ShowTool(qint64 id, Qt::GlobalColor color, bool enable){
if(id == this->id){
if(enable == false){
this->setPen(QPen(baseColor, widthHairLine));
currentColor = baseColor;
} else {
this->setPen(QPen(color, widthHairLine));
currentColor = color;
}
}
}
void VToolPoint::RefreshGeometry(){
VPointF point = VAbstractTool::data.GetPoint(id);
QRectF rec = QRectF(0, 0, radius*2, radius*2);
@ -194,12 +206,12 @@ void VToolPoint::mouseReleaseEvent(QGraphicsSceneMouseEvent *event){
void VToolPoint::hoverMoveEvent(QGraphicsSceneHoverEvent *event){
Q_UNUSED(event);
this->setPen(QPen(Qt::black, widthMainLine));
this->setPen(QPen(currentColor, widthMainLine));
}
void VToolPoint::hoverLeaveEvent(QGraphicsSceneHoverEvent *event){
Q_UNUSED(event);
this->setPen(QPen(Qt::black, widthHairLine));
this->setPen(QPen(currentColor, widthHairLine));
}
VToolPoint::~VToolPoint(){

View File

@ -19,6 +19,7 @@ public slots:
void NameChangePosition(const QPointF pos);
virtual void ChangedActivDraw(const QString newName);
virtual void FullUpdateFromGui(int result) = 0;
virtual void ShowTool(qint64 id, Qt::GlobalColor color, bool enable);
protected:
qreal radius;
VGraphicsSimpleTextItem *namePoint;

View File

@ -91,6 +91,7 @@ void VToolShoulderPoint::Create(const qint64 _id, const QString &formula, const
}
data->AddLine(p1Line, id);
data->AddLine(p2Line, id);
VAbstractTool::AddRecord(id, Tools::ShoulderPointTool, doc);
if(parse == Document::FullParse){
VToolShoulderPoint *point = new VToolShoulderPoint(doc, data, id, typeLine, formula,
p1Line, p2Line, pShoulder,
@ -153,5 +154,4 @@ void VToolShoulderPoint::AddToFile(){
AddAttribute(domElement, "pShoulder", pShoulder);
AddToCalculation(domElement);
emit toolhaveChange();
}

View File

@ -19,6 +19,14 @@ VToolSinglePoint::VToolSinglePoint (VDomDocument *doc, VContainer *data, qint64
}
}
void VToolSinglePoint::setDialog(){
Q_ASSERT(!dialogSinglePoint.isNull());
if(!dialogSinglePoint.isNull()){
VPointF p = VAbstractTool::data.GetPoint(id);
dialogSinglePoint->setData(p.name(), p.toQPointF());
}
}
void VToolSinglePoint::AddToFile(){
VPointF point = VAbstractTool::data.GetPoint(id);
QDomElement domElement = doc->createElement("point");
@ -32,7 +40,6 @@ void VToolSinglePoint::AddToFile(){
AddAttribute(domElement, "my", point.my()/PrintDPI*25.4);
AddToCalculation(domElement);
emit toolhaveChange();
}
QVariant VToolSinglePoint::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value){

View File

@ -12,6 +12,7 @@ class VToolSinglePoint : public VToolPoint
public:
VToolSinglePoint (VDomDocument *doc, VContainer *data, qint64 id,
Tool::Enum typeCreation, QGraphicsItem * parent = 0 );
virtual void setDialog();
public slots:
virtual void FullUpdateFromFile();
virtual void FullUpdateFromGui(int result);

View File

@ -81,6 +81,7 @@ void VToolSpline::Create(const qint64 _id, const qint64 &p1, const qint64 &p4, c
}
}
data->AddLengthSpline(data->GetNameSpline(p1, p4), spline.GetLength());
VAbstractTool::AddRecord(id, Tools::SplineTool, doc);
if(parse == Document::FullParse){
VToolSpline *spl = new VToolSpline(doc, data, id, typeCreation);
scene->addItem(spl);
@ -167,7 +168,6 @@ void VToolSpline::AddToFile(){
AddAttribute(domElement, "kCurve", spl.GetKcurve());
AddToCalculation(domElement);
emit toolhaveChange();
}
void VToolSpline::mouseReleaseEvent(QGraphicsSceneMouseEvent *event){
@ -179,12 +179,12 @@ void VToolSpline::mouseReleaseEvent(QGraphicsSceneMouseEvent *event){
void VToolSpline::hoverMoveEvent(QGraphicsSceneHoverEvent *event){
Q_UNUSED(event);
this->setPen(QPen(Qt::black, widthMainLine));
this->setPen(QPen(currentColor, widthMainLine));
}
void VToolSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event){
Q_UNUSED(event);
this->setPen(QPen(Qt::black, widthHairLine));
this->setPen(QPen(currentColor, widthHairLine));
}
void VToolSpline::RefreshGeometry(){
@ -228,3 +228,15 @@ void VToolSpline::ChangedActivDraw(const QString newName){
VAbstractTool::ChangedActivDraw(newName);
}
}
void VToolSpline::ShowTool(qint64 id, Qt::GlobalColor color, bool enable){
if(id == this->id){
if(enable == false){
this->setPen(QPen(baseColor, widthHairLine));
currentColor = baseColor;
} else {
this->setPen(QPen(color, widthHairLine));
currentColor = color;
}
}
}

View File

@ -33,6 +33,7 @@ public slots:
SplinePoint::Position position,
const QPointF pos);
virtual void ChangedActivDraw ( const QString newName );
virtual void ShowTool(qint64 id, Qt::GlobalColor color, bool enable);
protected:
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
virtual void AddToFile ();

View File

@ -67,6 +67,7 @@ void VToolSplinePath::Create(const qint64 _id, const VSplinePath &path, VMainGra
}
}
data->AddLengthSpline(data->GetNameSplinePath(path), path.GetLength());
VAbstractTool::AddRecord(id, Tools::SplinePathTool, doc);
if(parse == Document::FullParse){
VToolSplinePath *spl = new VToolSplinePath(doc, data, id, typeCreation);
scene->addItem(spl);
@ -201,6 +202,18 @@ void VToolSplinePath::ChangedActivDraw(const QString newName){
}
}
void VToolSplinePath::ShowTool(qint64 id, Qt::GlobalColor color, bool enable){
if(id == this->id){
if(enable == false){
this->setPen(QPen(baseColor, widthHairLine));
currentColor = baseColor;
} else {
this->setPen(QPen(color, widthHairLine));
currentColor = color;
}
}
}
void VToolSplinePath::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
ContextMenu(dialogSplinePath, this, event);
}
@ -218,7 +231,6 @@ void VToolSplinePath::AddToFile(){
}
AddToCalculation(domElement);
emit toolhaveChange();
}
void VToolSplinePath::AddPathPoint(QDomElement &domElement, const VSplinePoint &splPoint){
@ -241,12 +253,12 @@ void VToolSplinePath::mouseReleaseEvent(QGraphicsSceneMouseEvent *event){
void VToolSplinePath::hoverMoveEvent(QGraphicsSceneHoverEvent *event){
Q_UNUSED(event);
this->setPen(QPen(Qt::black, widthMainLine));
this->setPen(QPen(currentColor, widthMainLine));
}
void VToolSplinePath::hoverLeaveEvent(QGraphicsSceneHoverEvent *event){
Q_UNUSED(event);
this->setPen(QPen(Qt::black, widthHairLine));
this->setPen(QPen(currentColor, widthHairLine));
}
void VToolSplinePath::RefreshGeometry(){

View File

@ -30,6 +30,7 @@ public slots:
SplinePoint::Position position,
const QPointF pos);
virtual void ChangedActivDraw(const QString newName);
virtual void ShowTool(qint64 id, Qt::GlobalColor color, bool enable);
protected:
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
virtual void AddToFile();

View File

@ -19,16 +19,20 @@
VDomDocument::VDomDocument(VContainer *data) : QDomDocument() {
VDomDocument::VDomDocument(VContainer *data, QComboBox *comboBoxDraws) : QDomDocument(), cursor(0){
this->data = data;
this->comboBoxDraws = comboBoxDraws;
}
VDomDocument::VDomDocument(const QString& name, VContainer *data) : QDomDocument(name) {
VDomDocument::VDomDocument(const QString& name, VContainer *data, QComboBox *comboBoxDraws) : QDomDocument(name), cursor(0) {
this->data = data;
this->comboBoxDraws = comboBoxDraws;
}
VDomDocument::VDomDocument(const QDomDocumentType& doctype, VContainer *data) : QDomDocument(doctype){
VDomDocument::VDomDocument(const QDomDocumentType& doctype, VContainer *data, QComboBox *comboBoxDraws) : QDomDocument(doctype),
cursor(0){
this->data = data;
this->comboBoxDraws = comboBoxDraws;
}
VDomDocument::~VDomDocument(){
@ -132,17 +136,12 @@ bool VDomDocument::appendDraw(const QString& name){
return false;
}
void VDomDocument::ChangeActivDraw(const QString& name){
void VDomDocument::ChangeActivDraw(const QString& name, Document::Enum parse){
if(CheckNameDraw(name) == true){
this->nameActivDraw = name;
VMainGraphicsScene *scene = new VMainGraphicsScene();
QDomElement domElement;
bool ok = GetActivDrawElement(domElement);
if(ok){
ParseDrawElement(scene, domElement, Document::LiteParse);
if(parse == Document::FullParse){
emit ChangedActivDraw(name);
}
delete scene;
emit ChangedActivDraw(name);
}
}
@ -225,19 +224,20 @@ bool VDomDocument::GetActivNodeElement(const QString& name, QDomElement &element
}
}
void VDomDocument::Parse(Document::Enum parse, VMainGraphicsScene *scene, QComboBox *comboBoxDraws){
void VDomDocument::Parse(Document::Enum parse, VMainGraphicsScene *scene){
if(parse == Document::FullParse){
data->Clear();
nameActivDraw.clear();
scene->clear();
comboBoxDraws->clear();
tools.clear();
} else {
data->ClearLengthLines();
data->ClearLengthArcs();
data->ClearLengthSplines();
data->ClearLineArcs();
cursor = 0;
}
data->ClearLengthLines();
data->ClearLengthArcs();
data->ClearLengthSplines();
data->ClearLineArcs();
history.clear();
QDomElement rootElement = this->documentElement();
QDomNode domNode = rootElement.firstChild();
while(!domNode.isNull()){
@ -251,7 +251,9 @@ void VDomDocument::Parse(Document::Enum parse, VMainGraphicsScene *scene, QCombo
} else {
ChangeActivDraw(domElement.attribute("name"));
}
AddNewDraw(domElement, comboBoxDraws);
comboBoxDraws->addItem(domElement.attribute("name"));
} else {
ChangeActivDraw(domElement.attribute("name"), Document::LiteParse);
}
ParseDrawElement(scene, domElement, parse);
}
@ -268,6 +270,10 @@ QMap<qint64, VDataTool *> *VDomDocument::getTools(){
return &tools;
}
QVector<VToolRecord> *VDomDocument::getHistory(){
return &history;
}
void VDomDocument::ParseIncrementsElement(const QDomNode &node){
QDomNode domNode = node.firstChild();
while(!domNode.isNull()){
@ -295,38 +301,6 @@ void VDomDocument::ParseIncrementsElement(const QDomNode &node){
}
}
void VDomDocument::AddNewDraw(const QDomElement& node, QComboBox *comboBoxDraws)const{
QString name = node.attribute("name");
QDomNode domNode = node.firstChild();
if(!domNode.isNull()){
if(domNode.isElement()){
QDomElement domElement = domNode.toElement();
if(!domElement.isNull()){
if(domElement.tagName() == "calculation"){
QDomNode domCal = domElement.firstChild();
if(!domCal.isNull()){
if(domCal.isElement()){
QDomElement domElementPoint = domCal.toElement();
if(!domElementPoint.isNull()){
if(domElementPoint.tagName() == "point"){
if(domElementPoint.attribute("type","") == "single"){
comboBoxDraws->addItem(name, false);
return;
} else {
comboBoxDraws->addItem(name, true);
return;
}
}
}
}
}
comboBoxDraws->addItem(name, true);
}
}
}
}
}
void VDomDocument::ParseDrawElement(VMainGraphicsScene *scene, const QDomNode& node,
Document::Enum parse){
QDomNode domNode = node.firstChild();
@ -335,6 +309,7 @@ void VDomDocument::ParseDrawElement(VMainGraphicsScene *scene, const QDomNode& n
QDomElement domElement = domNode.toElement();
if(!domElement.isNull()){
if(domElement.tagName() == "calculation"){
data->ClearObject();
ParseCalculationElement(scene, domElement, parse);
}
if(domElement.tagName() == "modeling"){
@ -388,6 +363,7 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen
my = domElement.attribute("my","").toDouble()*PrintDPI/25.4;
data->UpdatePoint(id, VPointF(x, y, name, mx, my));
VAbstractTool::AddRecord(id, Tools::SinglePointTool, this);
if(parse != Document::FullParse){
VToolSinglePoint *spoint = qobject_cast<VToolSinglePoint*>(tools[id]);
spoint->VDataTool::setData(data);
@ -568,10 +544,9 @@ void VDomDocument::ParseArcElement(VMainGraphicsScene *scene, const QDomElement
void VDomDocument::FullUpdateTree(){
VMainGraphicsScene *scene = new VMainGraphicsScene();
QComboBox *comboBoxDraws = new QComboBox();
Parse(Document::LiteParse, scene, comboBoxDraws );
Parse(Document::LiteParse, scene);
delete scene;
delete comboBoxDraws;
setCurrentData();
emit FullUpdateFromFile();
emit haveChange();
}
@ -579,3 +554,42 @@ void VDomDocument::FullUpdateTree(){
void VDomDocument::haveLiteChange(){
emit haveChange();
}
void VDomDocument::ShowHistoryTool(qint64 id, Qt::GlobalColor color, bool enable){
emit ShowTool(id, color, enable);
}
qint64 VDomDocument::getCursor() const{
return cursor;
}
void VDomDocument::setCursor(const qint64 &value){
cursor = value;
emit ChangedCursor(cursor);
}
void VDomDocument::setCurrentData(){
QString nameDraw = comboBoxDraws->itemText(comboBoxDraws->currentIndex());
nameActivDraw = nameDraw;
qint64 id = 0;
if(history.size() == 0){
return;
}
for(qint32 i = 0; i < history.size(); ++i){
VToolRecord tool = history.at(i);
if(tool.getNameDraw() == nameDraw){
id = tool.getId();
}
}
if(id == 0){
VToolRecord tool = history.at(history.size()-1);
id = tool.getId();
if(id == 0){
return;
}
}
if(tools.size() > 0){
VDataTool *vTool = tools.value(id);
data->setData(vTool->getData());
}
}

View File

@ -10,6 +10,7 @@
#include "../widgets/vmaingraphicsscene.h"
#include "../tools/vdatatool.h"
#pragma GCC diagnostic warning "-Weffc++"
#include "vtoolrecord.h"
namespace Document{
enum Enum
@ -23,13 +24,13 @@ class VDomDocument : public QObject, public QDomDocument
{
Q_OBJECT
public:
VDomDocument(VContainer *data);
VDomDocument(const QString& name, VContainer *data);
VDomDocument(const QDomDocumentType& doctype, VContainer *data);
VDomDocument(VContainer *data,QComboBox *comboBoxDraws);
VDomDocument(const QString& name, VContainer *data,QComboBox *comboBoxDraws);
VDomDocument(const QDomDocumentType& doctype, VContainer *data, QComboBox *comboBoxDraws);
~VDomDocument();
QDomElement elementById(const QString& id);
void CreateEmptyFile();
void ChangeActivDraw(const QString& name);
void ChangeActivDraw(const QString& name, Document::Enum parse = Document::FullParse);
QString GetNameActivDraw() const;
bool GetActivDrawElement(QDomElement &element);
bool GetActivCalculationElement(QDomElement &element);
@ -37,21 +38,31 @@ public:
bool GetActivPathsElement(QDomElement &element);
bool appendDraw(const QString& name);
void SetNameDraw(const QString& name);
void Parse(Document::Enum parse, VMainGraphicsScene *scene, QComboBox *comboBoxDraws);
void Parse(Document::Enum parse, VMainGraphicsScene *scene);
QMap<qint64, VDataTool*>* getTools();
QVector<VToolRecord> *getHistory();
qint64 getCursor() const;
void setCursor(const qint64 &value);
void setCurrentData();
signals:
void ChangedActivDraw(const QString newName);
void ChangedNameDraw(const QString oldName, const QString newName);
void FullUpdateFromFile();
void haveChange();
void ShowTool(qint64 id, Qt::GlobalColor color, bool enable);
void ChangedCursor(qint64 id);
public slots:
void FullUpdateTree();
void haveLiteChange();
void ShowHistoryTool(qint64 id, Qt::GlobalColor color, bool enable);
private:
QMap<QString, QDomElement> map;
QString nameActivDraw;
VContainer *data;
QMap<qint64, VDataTool*> tools;
QVector<VToolRecord> history;
qint64 cursor;
QComboBox *comboBoxDraws;
bool find(QDomElement node, const QString& id);
bool CheckNameDraw(const QString& name) const;
void SetActivDraw(const QString& name);
@ -69,7 +80,6 @@ private:
void ParseArcElement(VMainGraphicsScene *scene, const QDomElement& domElement,
Document::Enum parse, const QString& type);
void ParseIncrementsElement(const QDomNode& node);
void AddNewDraw(const QDomElement &node, QComboBox *comboBoxDraws)const;
};
#endif // VDOMDOCUMENT_H

32
xml/vtoolrecord.cpp Normal file
View File

@ -0,0 +1,32 @@
#include "vtoolrecord.h"
VToolRecord::VToolRecord():id(0), typeTool(Tools::ArrowTool), nameDraw(QString()){
}
VToolRecord::VToolRecord(const qint64 &id, const Tools::Enum &typeTool, const QString &nameDraw):id(id),
typeTool(typeTool), nameDraw(nameDraw){
}
QString VToolRecord::getNameDraw() const{
return nameDraw;
}
void VToolRecord::setNameDraw(const QString &value){
nameDraw = value;
}
Tools::Enum VToolRecord::getTypeTool() const{
return typeTool;
}
void VToolRecord::setTypeTool(const Tools::Enum &value){
typeTool = value;
}
qint64 VToolRecord::getId() const{
return id;
}
void VToolRecord::setId(const qint64 &value){
id = value;
}

32
xml/vtoolrecord.h Normal file
View File

@ -0,0 +1,32 @@
#ifndef VTOOLRECORD_H
#define VTOOLRECORD_H
#pragma GCC diagnostic ignored "-Weffc++"
#pragma GCC diagnostic ignored "-Wsign-conversion"
#include <QtGlobal>
#include <QString>
#pragma GCC diagnostic warning "-Wsign-conversion"
#pragma GCC diagnostic warning "-Weffc++"
#include "../options.h"
class VToolRecord
{
public:
VToolRecord();
VToolRecord(const qint64 &id, const Tools::Enum &typeTool, const QString &nameDraw);
qint64 getId() const;
void setId(const qint64 &value);
Tools::Enum getTypeTool() const;
void setTypeTool(const Tools::Enum &value);
QString getNameDraw() const;
void setNameDraw(const QString &value);
private:
qint64 id;
Tools::Enum typeTool;
QString nameDraw;
};
#endif // VTOOLRECORD_H