From 9e78a12d6285f826714662012156c136eb943c04 Mon Sep 17 00:00:00 2001 From: dismine Date: Thu, 25 Jul 2013 15:00:51 +0300 Subject: [PATCH] Add tool endLine. --- Valentina.pro | 11 +- container/calculator.cpp | 19 +- container/calculator.h | 7 +- container/vcontainer.cpp | 120 +++----- container/vcontainer.h | 12 +- cursor.qrc | 1 + cursor/endline_cursor.png | Bin 0 -> 1301 bytes dialogs/dialogendline.cpp | 369 +++++++++++++++++++++++++ dialogs/dialogendline.h | 84 ++++++ dialogs/dialogendline.ui | 487 +++++++++++++++++++++++++++++++++ dialogs/dialogincrements.cpp | 173 +++++++++--- dialogs/dialogincrements.h | 4 + dialogs/dialogincrements.ui | 4 +- icon.qrc | 11 + icon/24x24/arrowDown.png | Bin 0 -> 716 bytes icon/24x24/arrowLeft.png | Bin 0 -> 649 bytes icon/24x24/arrowLeftDown.png | Bin 0 -> 893 bytes icon/24x24/arrowLeftUp.png | Bin 0 -> 808 bytes icon/24x24/arrowRight.png | Bin 0 -> 736 bytes icon/24x24/arrowRightDown.png | Bin 0 -> 925 bytes icon/24x24/arrowRightUp.png | Bin 0 -> 864 bytes icon/24x24/arrowUp.png | Bin 0 -> 655 bytes icon/24x24/equal.png | Bin 0 -> 255 bytes icon/24x24/putHere.png | Bin 0 -> 1209 bytes icon/32x32/segment.png | Bin 0 -> 676 bytes main.cpp | 26 +- mainwindow.cpp | 126 +++++++-- mainwindow.h | 32 ++- mainwindow.ui | 20 +- options.h | 10 + tools/vtoolendline.cpp | 152 ++++++++++ tools/vtoolendline.h | 34 +++ tools/vtoolpoint.cpp | 64 ++++- tools/vtoolpoint.h | 17 +- tools/vtoolsimplepoint.cpp | 54 +--- tools/vtoolsimplepoint.h | 5 - widgets/vmaingraphicsscene.cpp | 4 + widgets/vmaingraphicsscene.h | 5 + xml/vdomdocument.cpp | 53 +++- 39 files changed, 1666 insertions(+), 238 deletions(-) create mode 100644 cursor/endline_cursor.png create mode 100644 dialogs/dialogendline.cpp create mode 100644 dialogs/dialogendline.h create mode 100644 dialogs/dialogendline.ui create mode 100644 icon/24x24/arrowDown.png create mode 100644 icon/24x24/arrowLeft.png create mode 100644 icon/24x24/arrowLeftDown.png create mode 100644 icon/24x24/arrowLeftUp.png create mode 100644 icon/24x24/arrowRight.png create mode 100644 icon/24x24/arrowRightDown.png create mode 100644 icon/24x24/arrowRightUp.png create mode 100644 icon/24x24/arrowUp.png create mode 100644 icon/24x24/equal.png create mode 100644 icon/24x24/putHere.png create mode 100644 icon/32x32/segment.png create mode 100644 tools/vtoolendline.cpp create mode 100644 tools/vtoolendline.h diff --git a/Valentina.pro b/Valentina.pro index bb5c3ee31..98eeaa0e4 100644 --- a/Valentina.pro +++ b/Valentina.pro @@ -26,7 +26,9 @@ SOURCES += main.cpp\ container/vstandarttablecell.cpp \ container/vincrementtablerow.cpp \ widgets/delegate.cpp \ - widgets/doubledelegate.cpp + widgets/doubledelegate.cpp \ + dialogs/dialogendline.cpp \ + tools/vtoolendline.cpp HEADERS += mainwindow.h \ widgets/vmaingraphicsscene.h \ @@ -43,11 +45,14 @@ HEADERS += mainwindow.h \ container/vstandarttablecell.h \ container/vincrementtablerow.h \ widgets/delegate.h \ - widgets/doubledelegate.h + widgets/doubledelegate.h \ + dialogs/dialogendline.h \ + tools/vtoolendline.h FORMS += mainwindow.ui \ dialogs/dialogsinglepoint.ui \ - dialogs/dialogincrements.ui + dialogs/dialogincrements.ui \ + dialogs/dialogendline.ui RESOURCES += \ icon.qrc \ diff --git a/container/calculator.cpp b/container/calculator.cpp index b455951a2..e3f16094f 100644 --- a/container/calculator.cpp +++ b/container/calculator.cpp @@ -12,13 +12,15 @@ #define FINISHED 10 #define EOL 9 -Calculator::Calculator(VContainer *data){ +Calculator::Calculator(const VContainer *data){ index = 0; this->data = data; } -qreal Calculator::eval(QString prog){ +qreal Calculator::eval(QString prog, QString *errorMsg){ + this->errorMsg = errorMsg; + this->errorMsg->clear(); debugFormula.clear(); this->prog = prog; qDebug()<<"Формула: "<clear(); + *errorMsg = e[error]; qDebug()< i(standartTable); - while (i.hasNext()) { - i.next(); - VStandartTableCell cell = i.value(); - currentRow++; - table->setRowCount ( standartTable.size() ); - - QTableWidgetItem *item = new QTableWidgetItem(QString(i.key())); - item->setTextAlignment(Qt::AlignHCenter); - item->setFont(QFont("Times", 12, QFont::Bold)); - table->setItem(currentRow, 0, item); - - item = new QTableWidgetItem(QString().setNum(GetValueStandartTableCell(i.key()))); - item->setTextAlignment(Qt::AlignHCenter); - table->setItem(currentRow, 1, item); - - item = new QTableWidgetItem(QString().setNum(cell.GetBase())); - item->setTextAlignment(Qt::AlignHCenter); - table->setItem(currentRow, 2, item); - - item = new QTableWidgetItem(QString().setNum(cell.GetKsize())); - item->setTextAlignment(Qt::AlignHCenter); - table->setItem(currentRow, 3, item); - - item = new QTableWidgetItem(QString().setNum(cell.GetKgrowth())); - item->setTextAlignment(Qt::AlignHCenter); - table->setItem(currentRow, 4, item); - - item = new QTableWidgetItem(cell.GetDescription()); - item->setTextAlignment(Qt::AlignHCenter); - table->setItem(currentRow, 5, item); - } +const QMap *VContainer::DataPoints() const{ + return &points; } -void VContainer::FillIncrementTable(QTableWidget *table) const{ - qint32 currentRow = -1; - QMapIterator i(incrementTable); - while (i.hasNext()) { - i.next(); - VIncrementTableRow cell = i.value(); - currentRow++; - table->setRowCount ( incrementTable.size() ); - - QTableWidgetItem *item = new QTableWidgetItem(QString(i.key())); - item->setTextAlignment(Qt::AlignHCenter); - item->setFont(QFont("Times", 12, QFont::Bold)); - item->setData(Qt::UserRole, cell.getId()); - table->setItem(currentRow, 0, item); - - item = new QTableWidgetItem(QString().setNum(GetValueIncrementTableRow(i.key()))); - item->setTextAlignment(Qt::AlignHCenter); - // set the item non-editable (view only), and non-selectable - Qt::ItemFlags flags = item->flags(); - flags &= ~(Qt::ItemIsSelectable | Qt::ItemIsEditable); // reset/clear the flag - item->setFlags(flags); - table->setItem(currentRow, 1, item); - - item = new QTableWidgetItem(QString().setNum(cell.getBase())); - item->setTextAlignment(Qt::AlignHCenter); - table->setItem(currentRow, 2, item); - - item = new QTableWidgetItem(QString().setNum(cell.getKsize())); - item->setTextAlignment(Qt::AlignHCenter); - table->setItem(currentRow, 3, item); - - item = new QTableWidgetItem(QString().setNum(cell.getKgrowth())); - item->setTextAlignment(Qt::AlignHCenter); - table->setItem(currentRow, 4, item); - - item = new QTableWidgetItem(cell.getDescription()); - item->setTextAlignment(Qt::AlignHCenter); - table->setItem(currentRow, 5, item); - } +const QMap *VContainer::DataBase() const{ + return &base; +} + +const QMap *VContainer::DataStandartTable() const{ + return &standartTable; +} + +const QMap *VContainer::DataIncrementTable() const{ + return &incrementTable; +} + +const QMap *VContainer::DataLengthLines() const{ + return &lengthLines; +} + +void VContainer::AddLine(const QString &name, const qreal &value){ + Q_ASSERT(!name.isEmpty()); + lengthLines[name] = value/PrintDPI*25.4; +} + +qreal VContainer::GetLine(const QString &name) const{ + Q_ASSERT(!name.isEmpty()); + if(lengthLines.contains(name)){ + return lengthLines.value(name); + } else { + qCritical()<<"Не можу знайти лінію за імям = "< *DataPoints() const; + const QMap *DataBase() const; + const QMap *DataStandartTable() const; + const QMap *DataIncrementTable() const; + const QMap * DataLengthLines() const; + private: qint64 _id; QMap base; QMap points; QMap standartTable; QMap incrementTable; + QMap lengthLines; }; #endif // VCONTAINER_H diff --git a/cursor.qrc b/cursor.qrc index bacb46320..faa2ed138 100644 --- a/cursor.qrc +++ b/cursor.qrc @@ -1,5 +1,6 @@ cursor/spoint_cursor.png + cursor/endline_cursor.png diff --git a/cursor/endline_cursor.png b/cursor/endline_cursor.png new file mode 100644 index 0000000000000000000000000000000000000000..4bd4c890292236c964fa2295265507f2ad11cff4 GIT binary patch literal 1301 zcmV+w1?u{VP)Vl&|00006VoOIv0RI60 z0RN!9r;`8x010qNS#tmY3ljhU3ljkVnw%H_000McNliru-3Jm27zCqdRrCM=06}y` zSad^gZEa<4bO1wAML|?gQaT`KWG!lNWoICEF)lD5D0OpbZf77#N=G0{P(?=|b~Z98 zEFf`pVQgu1c_2L?IWP*aMOc#n00dP@L_t(Y$HkXjXjDfO$A9PEyQU`DXtvee20_sx z6tdPp3Xv#rY6!<6B9LGyLa#DgZC~Qjgr)?Juq-*?lAu||NohDX5jy{y?ggg>etrR$`f^< zp`oEC91d$`Wu>a>^G_7KqN1V$(B;dQYx;P5dwWK4Eda~102mw`)JPjD^^5` zi;E9seCO-eukQfVG))x|1+=lTu{G1UMtUciOrm;^`M$os=j!Y0cQ!UQmOYW3d%O3V zh-g_^nYOmJ&d-?U>E<{N0IG^%7zBesHgDcMlrh>x?j3CrNqu{cG&eURA{q*Xbk(X= z*%{N^(>vWn1k18eRnDC|H|mWaKYm;?Mti#1w#~r6fY#L1sBPQS)YPzP)27)0pK8aR znWjlHnFNrQmKFfY%gbk<_NgehZ5vfZRa42RySp18uzL0CC9`_e(wmoXL?qR`e_2^s zx@gfNeQes(Bm7|jC?b>k6B83;XJ-?O#g?5uecHcf&6>WoYuDa*tbm(}`l%cd5xTm% zh(sb?LqkL4<>h?BJKg=0b#c>=|m5UcI(%;|D=;&zNo72|THhu6%Mf+5eSe7+O z2FGzYb?Ve7RaI42nwpw=OG-)}Uvtl~`<=6G`++&JSS$bpLZQ%q3pmp>Q%Ocda2yA} z->=2R#WFH7GAZNPww=m+s!Ae}03aL=&rHXS8#kuvIiQANq>flsRn?4-)7i6UWyYF2 zj)P$ssfy+WRx}!&QAsT=E!Az?wlX$8<~wrqh`;uoh_UtU_vFxb-*dI+PpR9v>p|K* zssZZi>Mj=)6#N_r1b(lsuJ%f*2_&cEz~Ie+oUL!YIX*l*awo^1&%$Sy(titP3&F$Q?XV1s(ua&?{z+#{SXnGXzj_uox-rk(_dn(XnxE z4c;Vr>}V-a2oP;P(q6aY{Yw^*3YPr*eBH8T%k={X4t$+RB)Z+T<^t8gZday3zz6&# zB5^m}&H-#70hs#_9>irx0H3PP1KtH*zK0jz|Ks5wJ_TUix^*3Z78Vvx6iiLq-`Uxz7cN|=EGjBG zkp_MT_y+jQ?Vkh=1OJGK?Jj1hYTS*XIU-`XPKwJ)E)W4;ao0Eu#HV{9SO&c40(AlB zA2oU37oXGeQxi9bhVeb+(3!;Rs) z`JVTB@pJUNz zX23U8mh;PrlkEO*mk|sFtutq0NmEP>zpzr~&6`jC&W2?5Yp?Pz!}!~+GR^_;00000 LNkvXXu0mjfY|~s( literal 0 HcmV?d00001 diff --git a/dialogs/dialogendline.cpp b/dialogs/dialogendline.cpp new file mode 100644 index 000000000..8e3c7e11c --- /dev/null +++ b/dialogs/dialogendline.cpp @@ -0,0 +1,369 @@ +#include "dialogendline.h" +#include "ui_dialogendline.h" +#include +#include + +#include "../container/vpointf.h" +#include "../container/calculator.h" + +DialogEndLine::DialogEndLine(const VContainer *data, QWidget *parent) : + QDialog(parent), ui(new Ui::DialogEndLine) +{ + ui->setupUi(this); + flagFormula = false; + flagName = false; + this->data = data; + bOk = ui->buttonBox->button(QDialogButtonBox::Ok); + connect(bOk, &QPushButton::clicked, this, &DialogEndLine::DialogAccepted); + bOk->setEnabled(false); + FillComboBoxBasePoint(); + QStringList list; + list<<"Лінія"<<"Без лінії"; + ui->comboBoxLineType->addItems(list); + + connect(ui->toolButtonArrowDown, &QPushButton::clicked, this, + &DialogEndLine::ArrowDown); + connect(ui->toolButtonArrowUp, &QPushButton::clicked, this, + &DialogEndLine::ArrowUp); + connect(ui->toolButtonArrowLeft, &QPushButton::clicked, this, + &DialogEndLine::ArrowLeft); + connect(ui->toolButtonArrowRight, &QPushButton::clicked, this, + &DialogEndLine::ArrowRight); + connect(ui->toolButtonArrowLeftUp, &QPushButton::clicked, this, + &DialogEndLine::ArrowLeftUp); + connect(ui->toolButtonArrowLeftDown, &QPushButton::clicked, this, + &DialogEndLine::ArrowLeftDown); + connect(ui->toolButtonArrowRightUp, &QPushButton::clicked, this, + &DialogEndLine::ArrowRightUp); + connect(ui->toolButtonArrowRightDown, &QPushButton::clicked, this, + &DialogEndLine::ArrowRightDown); + connect(ui->toolButtonPutHere, &QPushButton::clicked, this, + &DialogEndLine::ClickedToolButtonPutHere); + connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogEndLine::PutVal); + connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogEndLine::ValChenged); + + ShowBase(); + connect(ui->radioButtonSizeGrowth, &QRadioButton::clicked, this, + &DialogEndLine::ClickedSizeGrowth); + connect(ui->radioButtonStandartTable, &QRadioButton::clicked, this, + &DialogEndLine::ClickedStandartTable); + connect(ui->radioButtonIncrements, &QRadioButton::clicked, this, + &DialogEndLine::ClickedIncrements); + connect(ui->radioButtonLengthLine, &QRadioButton::clicked, this, + &DialogEndLine::ClickedLengthLines); + connect(ui->toolButtonEqual, &QPushButton::clicked, this, + &DialogEndLine::ClickedToolButtonEqual); + connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogEndLine::NameChanged); + connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogEndLine::FormulaChanged); + + timerFormula = new QTimer(this); + connect(timerFormula, &QTimer::timeout, this, &DialogEndLine::ClickedToolButtonEqual); +} + +void DialogEndLine::ShowBase(){ + disconnect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogEndLine::ValChenged); + ui->listWidget->clear(); + connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogEndLine::ValChenged); + const QMap *base = data->DataBase(); + QMapIterator i(*base); + while (i.hasNext()) { + i.next(); + QListWidgetItem *item = new QListWidgetItem(i.key()); + item->setFont(QFont("Times", 12, QFont::Bold)); + ui->listWidget->addItem(item); + } + ui->listWidget->setCurrentRow (0); +} + +void DialogEndLine::ShowStandartTable(){ + disconnect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogEndLine::ValChenged); + ui->listWidget->clear(); + connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogEndLine::ValChenged); + const QMap *standartTable = data->DataStandartTable(); + QMapIterator i(*standartTable); + while (i.hasNext()) { + i.next(); + QListWidgetItem *item = new QListWidgetItem(i.key()); + item->setFont(QFont("Times", 12, QFont::Bold)); + ui->listWidget->addItem(item); + } + ui->listWidget->setCurrentRow (0); +} + +void DialogEndLine::ShowIncrementTable(){ + disconnect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogEndLine::ValChenged); + ui->listWidget->clear(); + connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogEndLine::ValChenged); + const QMap *incrementTable = data->DataIncrementTable(); + QMapIterator i(*incrementTable); + while (i.hasNext()) { + i.next(); + QListWidgetItem *item = new QListWidgetItem(i.key()); + item->setFont(QFont("Times", 12, QFont::Bold)); + ui->listWidget->addItem(item); + } + ui->listWidget->setCurrentRow (0); +} + +void DialogEndLine::ShowLengthLines(){ + disconnect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogEndLine::ValChenged); + ui->listWidget->clear(); + connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogEndLine::ValChenged); + const QMap *linesTable = data->DataLengthLines(); + QMapIterator i(*linesTable); + while (i.hasNext()) { + i.next(); + QListWidgetItem *item = new QListWidgetItem(i.key()); + item->setFont(QFont("Times", 12, QFont::Bold)); + ui->listWidget->addItem(item); + } + ui->listWidget->setCurrentRow (0); +} + +void DialogEndLine::CheackState(){ + bOk->setEnabled(flagFormula & flagName); +} + +void DialogEndLine::ClickedSizeGrowth(){ + ShowBase(); +} + +void DialogEndLine::ClickedStandartTable(){ + ShowStandartTable(); +} + +void DialogEndLine::ClickedLengthLines(){ + ShowLengthLines(); +} + +void DialogEndLine::ClickedIncrements(){ + ShowIncrementTable(); +} + +void DialogEndLine::ChoosedPoint(qint64 id, Scene::Type type){ + if(type == Scene::Point){ + VPointF point = data->GetPoint(id); + qint32 index = ui->comboBoxBasePoint->findText(point.name()); + if ( index != -1 ) { // -1 for not found + ui->comboBoxBasePoint->setCurrentIndex(index); + } + this->show(); + } +} + +QString DialogEndLine::getPointName() const{ + return pointName; +} + +void DialogEndLine::setPointName(const QString &value){ + pointName = value; + ui->lineEditNamePoint->setText(pointName); +} + +QString DialogEndLine::getTypeLine() const{ + return typeLine; +} + +void DialogEndLine::setTypeLine(const QString &value){ + typeLine = value; + if(typeLine == "hair"){ + qint32 index = ui->comboBoxLineType->findText("Лінія"); + if(index != -1){ + ui->comboBoxLineType->setCurrentIndex(index); + } + } + if(typeLine == "none"){ + qint32 index = ui->comboBoxLineType->findText("Без лінії"); + if(index != -1){ + ui->comboBoxLineType->setCurrentIndex(index); + } + } +} + +QString DialogEndLine::getFormula() const{ + return formula; +} + +void DialogEndLine::setFormula(const QString &value){ + formula = value; + ui->lineEditFormula->setText(formula); +} + +qint32 DialogEndLine::getAngle() const{ + return angle; +} + +void DialogEndLine::setAngle(const qint32 &value){ + angle = value; + ui->spinBoxAngle->setValue(angle); +} + +void DialogEndLine::closeEvent ( QCloseEvent * event ){ + DialogClosed(QDialog::Rejected); + event->accept(); +} + +qint64 DialogEndLine::getBasePointId() const +{ + return basePointId; +} + +void DialogEndLine::setBasePointId(const qint64 &value) +{ + basePointId = value; + qint32 index = ui->comboBoxBasePoint->findData(basePointId); + if(index != -1){ + ui->comboBoxBasePoint->setCurrentIndex(index); + } +} + +void DialogEndLine::FillComboBoxBasePoint(){ + const QMap *points = data->DataPoints(); + QMapIterator i(*points); + while (i.hasNext()) { + i.next(); + VPointF point = i.value(); + ui->comboBoxBasePoint->addItem(point.name(), i.key()); + } +} + +void DialogEndLine::ArrowUp(){ + ui->spinBoxAngle->setValue(90); +} + +void DialogEndLine::ArrowDown(){ + ui->spinBoxAngle->setValue(270); +} + +void DialogEndLine::ArrowLeft(){ + ui->spinBoxAngle->setValue(180); +} + +void DialogEndLine::ArrowRight(){ + ui->spinBoxAngle->setValue(0); +} + +void DialogEndLine::ArrowLeftUp(){ + ui->spinBoxAngle->setValue(135); +} + +void DialogEndLine::ArrowLeftDown(){ + ui->spinBoxAngle->setValue(225); +} + +void DialogEndLine::ArrowRightUp(){ + ui->spinBoxAngle->setValue(45); +} + +void DialogEndLine::ArrowRightDown(){ + ui->spinBoxAngle->setValue(315); +} + +void DialogEndLine::ClickedToolButtonPutHere(){ + QListWidgetItem *item = ui->listWidget->currentItem(); + QString val = item->text(); + ui->lineEditFormula->setText(ui->lineEditFormula->text().append(val)); +} + +void DialogEndLine::PutVal(QListWidgetItem *item){ + QString val = item->text(); + ui->lineEditFormula->setText(ui->lineEditFormula->text().append(val)); +} + +void DialogEndLine::ValChenged(int row){ + if(ui->listWidget->count() == 0){ + return; + } + QListWidgetItem *item = ui->listWidget->item( row ); + if(ui->radioButtonSizeGrowth->isChecked()){ + if(item->text()=="Р"){ + QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->growth()).arg("Зріст"); + ui->labelDescription->setText(desc); + } + if(item->text()=="Сг"){ + QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->size()).arg("Розмір"); + ui->labelDescription->setText(desc); + } + } + if(ui->radioButtonStandartTable->isChecked()){ + VStandartTableCell stable = data->GetStandartTableCell(item->text()); + QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->GetValueStandartTableCell(item->text())) + .arg(stable.GetDescription()); + ui->labelDescription->setText(desc); + } + if(ui->radioButtonIncrements->isChecked()){ + VIncrementTableRow itable = data->GetIncrementTableRow(item->text()); + QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->GetValueIncrementTableRow(item->text())) + .arg(itable.getDescription()); + ui->labelDescription->setText(desc); + } +} + +void DialogEndLine::ClickedToolButtonEqual(){ + if(ui->lineEditFormula->text().isEmpty()){ + flagFormula = false; + } else { + Calculator cal(data); + QString errorMsg; + qreal result = cal.eval(ui->lineEditFormula->text(),&errorMsg); + if(!errorMsg.isEmpty()){ + ui->labelResultCalculation->setText("Помилка."); + flagFormula = false; + } else { + ui->labelResultCalculation->setText(QString().setNum(result)); + flagFormula = true; + } + } + CheackState(); + timerFormula->stop(); +} + +void DialogEndLine::NameChanged(){ + QString name = ui->lineEditNamePoint->text(); + if(name.isEmpty() || name.contains(" ")){ + flagName = false; + } else { + flagName = true; + } + CheackState(); +} + +void DialogEndLine::FormulaChanged(){ + if(ui->lineEditFormula->text().isEmpty()){ + flagFormula = false; + CheackState(); + return; + } + timerFormula->start(1000); +} + +void DialogEndLine::DialogAccepted(){ + pointName = ui->lineEditNamePoint->text(); + if(ui->comboBoxLineType->currentText()=="Лінія"){ + typeLine = QString("hair"); + } else { + typeLine = QString("none"); + } + formula = ui->lineEditFormula->text(); + angle = ui->spinBoxAngle->value(); + qint32 index = ui->comboBoxBasePoint->currentIndex(); + basePointId = qvariant_cast(ui->comboBoxBasePoint->itemData(index)); + DialogClosed(QDialog::Accepted); +} + +void DialogEndLine::UpdateList(){ + if(ui->radioButtonSizeGrowth->isChecked()){ + ShowBase(); + } + if(ui->radioButtonStandartTable->isChecked()){ + ShowStandartTable(); + } + if(ui->radioButtonIncrements->isChecked()){ + ShowIncrementTable(); + } +} + +DialogEndLine::~DialogEndLine() +{ + delete ui; +} diff --git a/dialogs/dialogendline.h b/dialogs/dialogendline.h new file mode 100644 index 000000000..9166f4704 --- /dev/null +++ b/dialogs/dialogendline.h @@ -0,0 +1,84 @@ +#ifndef DIALOGENDLINE_H +#define DIALOGENDLINE_H + +#include +#include +#include +#include + +#include "../options.h" +#include "../container/vcontainer.h" +#include "../container/calculator.h" + +namespace Ui { +class DialogEndLine; +} + +class DialogEndLine : public QDialog +{ + Q_OBJECT + +public: + explicit DialogEndLine(const VContainer *data, QWidget *parent = 0); + ~DialogEndLine(); + QString getPointName() const; + void setPointName(const QString &value); + + QString getTypeLine() const; + void setTypeLine(const QString &value); + + QString getFormula() const; + void setFormula(const QString &value); + + qint32 getAngle() const; + void setAngle(const qint32 &value); + + qint64 getBasePointId() const; + void setBasePointId(const qint64 &value); +signals: + void DialogClosed(int result); +public slots: + void ChoosedPoint(qint64 id, Scene::Type type); + void ArrowUp(); + void ArrowDown(); + void ArrowLeft(); + void ArrowRight(); + void ArrowLeftUp(); + void ArrowLeftDown(); + void ArrowRightUp(); + void ArrowRightDown(); + void ClickedSizeGrowth(); + void ClickedStandartTable(); + void ClickedLengthLines(); + void ClickedIncrements(); + void ClickedToolButtonPutHere(); + void PutVal(QListWidgetItem * item); + void ValChenged(int row); + void ClickedToolButtonEqual(); + void NameChanged(); + void FormulaChanged(); + void DialogAccepted(); + void UpdateList(); +protected: + void closeEvent ( QCloseEvent * event ); +private: + Ui::DialogEndLine *ui; + const VContainer *data; + QPushButton *bOk; + QTimer *timerFormula; + bool flagFormula; + bool flagName; + QString pointName; + QString typeLine; + QString formula; + qint32 angle; + qint64 basePointId; + void FillComboBoxBasePoint(); + void ShowBase(); + void ShowStandartTable(); + void ShowIncrementTable(); + void ShowLengthLines(); + void CheackState(); +}; + +#endif // DIALOGENDLINE_H diff --git a/dialogs/dialogendline.ui b/dialogs/dialogendline.ui new file mode 100644 index 000000000..badf97c3c --- /dev/null +++ b/dialogs/dialogendline.ui @@ -0,0 +1,487 @@ + + + DialogEndLine + + + + 0 + 0 + 539 + 559 + + + + Dialog + + + + + + + + + 0 + 0 + + + + Відстань + + + + + + + + 0 + 0 + + + + + + + + ... + + + + :/icon/24x24/equal.png:/icon/24x24/equal.png + + + + 24 + 24 + + + + + + + + + 0 + 0 + + + + + 87 + 0 + + + + _ + + + + + + + + + + + + + + + + 0 + 0 + + + + Базова точка + + + + + + + + + + ... + + + + :/icon/24x24/putHere.png:/icon/24x24/putHere.png + + + + 24 + 24 + + + + + + + + + + + + + 0 + 0 + + + + Ім'я нової точки + + + + + + + + + + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + Кут градуси + + + + + + + QLayout::SetMinimumSize + + + 29 + + + 6 + + + + + ... + + + + :/icon/24x24/arrowRightUp.png:/icon/24x24/arrowRightUp.png + + + + 32 + 32 + + + + + + + + ... + + + + :/icon/24x24/arrowLeftUp.png:/icon/24x24/arrowLeftUp.png + + + + 32 + 32 + + + + + + + + ... + + + + :/icon/24x24/arrowLeft.png:/icon/24x24/arrowLeft.png + + + + 32 + 32 + + + + + + + + ... + + + + :/icon/24x24/arrowRight.png:/icon/24x24/arrowRight.png + + + + 32 + 32 + + + + + + + + + 0 + 0 + + + + ... + + + + :/icon/24x24/arrowUp.png:/icon/24x24/arrowUp.png + + + + 32 + 32 + + + + + + + + ... + + + + :/icon/24x24/arrowDown.png:/icon/24x24/arrowDown.png + + + + 32 + 32 + + + + + + + + ... + + + + :/icon/24x24/arrowLeftDown.png:/icon/24x24/arrowLeftDown.png + + + + 32 + 32 + + + + + + + + ... + + + + :/icon/24x24/arrowRightDown.png:/icon/24x24/arrowRightDown.png + + + + 32 + 32 + + + + + + + + + 0 + 0 + + + + + 52 + 0 + + + + 360 + + + 0 + + + + + + + + + + + + + + + Тип лінії + + + + + + + + + + + + + + Вихідні данні + + + + + + + Розмір і зріст + + + true + + + + + + + Стандартна таблиця + + + + + + + Прибавки + + + + + + + true + + + Довжини ліній + + + + + + + false + + + Довжини дуг + + + + + + + false + + + Довжини сплайні + + + + + + + + + + + + + + + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + + + buttonBox + accepted() + DialogEndLine + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + DialogEndLine + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/dialogs/dialogincrements.cpp b/dialogs/dialogincrements.cpp index 8f5635c20..0a4fc3ccb 100644 --- a/dialogs/dialogincrements.cpp +++ b/dialogs/dialogincrements.cpp @@ -12,24 +12,9 @@ DialogIncrements::DialogIncrements(VContainer *data, VDomDocument *doc, QWidget ui->setupUi(this); this->data = data; this->doc = doc; - ui->tableWidgetStandart->resizeColumnsToContents(); - ui->tableWidgetStandart->resizeRowsToContents(); - ui->tableWidgetStandart->verticalHeader()->setDefaultSectionSize(20); - ui->tableWidgetStandart->setHorizontalHeaderItem(0, new QTableWidgetItem("Позначення")); - ui->tableWidgetStandart->setHorizontalHeaderItem(1, new QTableWidgetItem("Розрах. знач.")); - ui->tableWidgetStandart->setHorizontalHeaderItem(2, new QTableWidgetItem("Базове знач.")); - ui->tableWidgetStandart->setHorizontalHeaderItem(3, new QTableWidgetItem("В розмірі")); - ui->tableWidgetStandart->setHorizontalHeaderItem(4, new QTableWidgetItem("В рості")); - ui->tableWidgetStandart->setHorizontalHeaderItem(5, new QTableWidgetItem("Опис")); - ui->tableWidgetIncrement->resizeColumnsToContents(); - ui->tableWidgetIncrement->resizeRowsToContents(); - ui->tableWidgetIncrement->verticalHeader()->setDefaultSectionSize(20); - ui->tableWidgetIncrement->setHorizontalHeaderItem(0, new QTableWidgetItem("Позначення")); - ui->tableWidgetIncrement->setHorizontalHeaderItem(1, new QTableWidgetItem("Розрах. знач.")); - ui->tableWidgetIncrement->setHorizontalHeaderItem(2, new QTableWidgetItem("Базове знач.")); - ui->tableWidgetIncrement->setHorizontalHeaderItem(3, new QTableWidgetItem("В розмірі")); - ui->tableWidgetIncrement->setHorizontalHeaderItem(4, new QTableWidgetItem("В рості")); - ui->tableWidgetIncrement->setHorizontalHeaderItem(5, new QTableWidgetItem("Опис")); + InitialStandartTable(); + InitialIncrementTable(); + InitialLinesTable(); SpinBoxDelegate *delegate = new SpinBoxDelegate(ui->tableWidgetIncrement); DoubleSpinBoxDelegate *doubleDelegate = new DoubleSpinBoxDelegate(ui->tableWidgetIncrement); ui->tableWidgetIncrement->setItemDelegateForColumn(2, delegate); @@ -37,6 +22,7 @@ DialogIncrements::DialogIncrements(VContainer *data, VDomDocument *doc, QWidget ui->tableWidgetIncrement->setItemDelegateForColumn(4, doubleDelegate); FillStandartTable(); FillIncrementTable(); + FillLengthLines(); connect(ui->toolButtonAdd, &QPushButton::clicked, this, &DialogIncrements::clickedToolButtonAdd); connect(ui->toolButtonRemove, &QPushButton::clicked, this, @@ -52,35 +38,124 @@ DialogIncrements::DialogIncrements(VContainer *data, VDomDocument *doc, QWidget } void DialogIncrements::FillStandartTable(){ - data->FillStandartTable(ui->tableWidgetStandart); + const QMap *standartTable = data->DataStandartTable(); + qint32 currentRow = -1; + QMapIterator i(*standartTable); + 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); + item->setFont(QFont("Times", 12, QFont::Bold)); + ui->tableWidgetStandart->setItem(currentRow, 0, item); + + item = new QTableWidgetItem(QString().setNum(data->GetValueStandartTableCell(i.key()))); + item->setTextAlignment(Qt::AlignHCenter); + ui->tableWidgetStandart->setItem(currentRow, 1, item); + + item = new QTableWidgetItem(QString().setNum(cell.GetBase())); + item->setTextAlignment(Qt::AlignHCenter); + ui->tableWidgetStandart->setItem(currentRow, 2, item); + + item = new QTableWidgetItem(QString().setNum(cell.GetKsize())); + item->setTextAlignment(Qt::AlignHCenter); + ui->tableWidgetStandart->setItem(currentRow, 3, item); + + item = new QTableWidgetItem(QString().setNum(cell.GetKgrowth())); + item->setTextAlignment(Qt::AlignHCenter); + ui->tableWidgetStandart->setItem(currentRow, 4, item); + + item = new QTableWidgetItem(cell.GetDescription()); + item->setTextAlignment(Qt::AlignHCenter); + ui->tableWidgetStandart->setItem(currentRow, 5, item); + } } void DialogIncrements::FillIncrementTable(){ - data->FillIncrementTable(ui->tableWidgetIncrement); + const QMap *incrementTable = data->DataIncrementTable(); + qint32 currentRow = -1; + QMapIterator i(*incrementTable); + while (i.hasNext()) { + i.next(); + VIncrementTableRow cell = i.value(); + currentRow++; + ui->tableWidgetIncrement->setRowCount ( incrementTable->size() ); + + QTableWidgetItem *item = new QTableWidgetItem(QString(i.key())); + item->setTextAlignment(Qt::AlignHCenter); + item->setFont(QFont("Times", 12, QFont::Bold)); + item->setData(Qt::UserRole, cell.getId()); + ui->tableWidgetIncrement->setItem(currentRow, 0, item); + + item = new QTableWidgetItem(QString().setNum(data->GetValueIncrementTableRow(i.key()))); + item->setTextAlignment(Qt::AlignHCenter); + // set the item non-editable (view only), and non-selectable + Qt::ItemFlags flags = item->flags(); + flags &= ~(Qt::ItemIsSelectable | Qt::ItemIsEditable); // reset/clear the flag + item->setFlags(flags); + ui->tableWidgetIncrement->setItem(currentRow, 1, item); + + item = new QTableWidgetItem(QString().setNum(cell.getBase())); + item->setTextAlignment(Qt::AlignHCenter); + ui->tableWidgetIncrement->setItem(currentRow, 2, item); + + item = new QTableWidgetItem(QString().setNum(cell.getKsize())); + item->setTextAlignment(Qt::AlignHCenter); + ui->tableWidgetIncrement->setItem(currentRow, 3, item); + + item = new QTableWidgetItem(QString().setNum(cell.getKgrowth())); + item->setTextAlignment(Qt::AlignHCenter); + ui->tableWidgetIncrement->setItem(currentRow, 4, item); + + item = new QTableWidgetItem(cell.getDescription()); + item->setTextAlignment(Qt::AlignHCenter); + ui->tableWidgetIncrement->setItem(currentRow, 5, item); + } if(ui->tableWidgetIncrement->rowCount()>0){ ui->toolButtonRemove->setEnabled(true); } } +void DialogIncrements::FillLengthLines(){ + const QMap *linesTable = data->DataLengthLines(); + qint32 currentRow = -1; + QMapIterator i(*linesTable); + while (i.hasNext()) { + i.next(); + qreal length = i.value(); + currentRow++; + ui->tableWidgetLines->setRowCount ( linesTable->size() ); + + QTableWidgetItem *item = new QTableWidgetItem(QString(i.key())); + item->setTextAlignment(Qt::AlignHCenter); + item->setFont(QFont("Times", 12, QFont::Bold)); + ui->tableWidgetLines->setItem(currentRow, 0, item); + + item = new QTableWidgetItem(QString().setNum(length)); + item->setTextAlignment(Qt::AlignHCenter); + ui->tableWidgetLines->setItem(currentRow, 1, item); + } +} + void DialogIncrements::FullUpdateFromFile(){ disconnect(ui->tableWidgetIncrement, &QTableWidget::cellChanged, this, &DialogIncrements::cellChanged); + ui->tableWidgetStandart->clear(); - ui->tableWidgetStandart->setHorizontalHeaderItem(0, new QTableWidgetItem("Позначення")); - ui->tableWidgetStandart->setHorizontalHeaderItem(1, new QTableWidgetItem("Розрах. знач.")); - ui->tableWidgetStandart->setHorizontalHeaderItem(2, new QTableWidgetItem("Базове знач.")); - ui->tableWidgetStandart->setHorizontalHeaderItem(3, new QTableWidgetItem("В розмірі")); - ui->tableWidgetStandart->setHorizontalHeaderItem(4, new QTableWidgetItem("В рості")); - ui->tableWidgetStandart->setHorizontalHeaderItem(5, new QTableWidgetItem("Опис")); - ui->tableWidgetIncrement->clear(); - ui->tableWidgetIncrement->setHorizontalHeaderItem(0, new QTableWidgetItem("Позначення")); - ui->tableWidgetIncrement->setHorizontalHeaderItem(1, new QTableWidgetItem("Розрах. знач.")); - ui->tableWidgetIncrement->setHorizontalHeaderItem(2, new QTableWidgetItem("Базове знач.")); - ui->tableWidgetIncrement->setHorizontalHeaderItem(3, new QTableWidgetItem("В розмірі")); - ui->tableWidgetIncrement->setHorizontalHeaderItem(4, new QTableWidgetItem("В рості")); - ui->tableWidgetIncrement->setHorizontalHeaderItem(5, new QTableWidgetItem("Опис")); + InitialStandartTable(); FillStandartTable(); + + ui->tableWidgetIncrement->clear(); + InitialIncrementTable(); FillIncrementTable(); + + ui->tableWidgetLines->clear(); + InitialLinesTable(); + FillLengthLines(); + connect(ui->tableWidgetIncrement, &QTableWidget::cellChanged, this, &DialogIncrements::cellChanged); } @@ -265,6 +340,38 @@ void DialogIncrements::closeEvent ( QCloseEvent * event ){ event->accept(); } +void DialogIncrements::InitialStandartTable(){ + ui->tableWidgetStandart->resizeColumnsToContents(); + ui->tableWidgetStandart->resizeRowsToContents(); + ui->tableWidgetStandart->verticalHeader()->setDefaultSectionSize(20); + ui->tableWidgetStandart->setHorizontalHeaderItem(0, new QTableWidgetItem("Позначення")); + ui->tableWidgetStandart->setHorizontalHeaderItem(1, new QTableWidgetItem("Розрах. знач.")); + ui->tableWidgetStandart->setHorizontalHeaderItem(2, new QTableWidgetItem("Базове знач.")); + ui->tableWidgetStandart->setHorizontalHeaderItem(3, new QTableWidgetItem("В розмірі")); + ui->tableWidgetStandart->setHorizontalHeaderItem(4, new QTableWidgetItem("В рості")); + ui->tableWidgetStandart->setHorizontalHeaderItem(5, new QTableWidgetItem("Опис")); +} + +void DialogIncrements::InitialIncrementTable(){ + ui->tableWidgetIncrement->resizeColumnsToContents(); + ui->tableWidgetIncrement->resizeRowsToContents(); + ui->tableWidgetIncrement->verticalHeader()->setDefaultSectionSize(20); + ui->tableWidgetIncrement->setHorizontalHeaderItem(0, new QTableWidgetItem("Позначення")); + ui->tableWidgetIncrement->setHorizontalHeaderItem(1, new QTableWidgetItem("Розрах. знач.")); + ui->tableWidgetIncrement->setHorizontalHeaderItem(2, new QTableWidgetItem("Базове знач.")); + ui->tableWidgetIncrement->setHorizontalHeaderItem(3, new QTableWidgetItem("В розмірі")); + ui->tableWidgetIncrement->setHorizontalHeaderItem(4, new QTableWidgetItem("В рості")); + ui->tableWidgetIncrement->setHorizontalHeaderItem(5, new QTableWidgetItem("Опис")); +} + +void DialogIncrements::InitialLinesTable(){ + ui->tableWidgetLines->resizeColumnsToContents(); + ui->tableWidgetLines->resizeRowsToContents(); + ui->tableWidgetLines->verticalHeader()->setDefaultSectionSize(20); + ui->tableWidgetLines->setHorizontalHeaderItem(0, new QTableWidgetItem("Лінія")); + ui->tableWidgetLines->setHorizontalHeaderItem(1, new QTableWidgetItem("Довжина")); +} + void DialogIncrements::clickedButtonOk(){ emit closedActionTable(); } diff --git a/dialogs/dialogincrements.h b/dialogs/dialogincrements.h index 80d96880c..cf57cc331 100644 --- a/dialogs/dialogincrements.h +++ b/dialogs/dialogincrements.h @@ -34,8 +34,12 @@ private: Ui::DialogIncrements *ui; VContainer *data; VDomDocument *doc; + void InitialStandartTable(); + void InitialIncrementTable(); + void InitialLinesTable(); void FillStandartTable(); void FillIncrementTable(); + void FillLengthLines(); void AddIncrementToFile(quint64 id, QString name, qint32 base, qreal ksize, qreal kgrowth, QString description); }; diff --git a/dialogs/dialogincrements.ui b/dialogs/dialogincrements.ui index 0d0a95600..010025acc 100644 --- a/dialogs/dialogincrements.ui +++ b/dialogs/dialogincrements.ui @@ -20,7 +20,7 @@ QTabWidget::North - 4 + 2 @@ -209,7 +209,7 @@ - + QAbstractItemView::NoEditTriggers diff --git a/icon.qrc b/icon.qrc index 8c4421cf2..83f15dfdf 100644 --- a/icon.qrc +++ b/icon.qrc @@ -8,5 +8,16 @@ icon/32x32/new_draw.png icon/32x32/option_draw.png icon/32x32/table.png + icon/24x24/putHere.png + icon/24x24/arrowDown.png + icon/24x24/arrowUp.png + icon/24x24/arrowRightUp.png + icon/24x24/arrowRightDown.png + icon/24x24/arrowRight.png + icon/24x24/arrowLeftUp.png + icon/24x24/arrowLeftDown.png + icon/24x24/arrowLeft.png + icon/24x24/equal.png + icon/32x32/segment.png diff --git a/icon/24x24/arrowDown.png b/icon/24x24/arrowDown.png new file mode 100644 index 0000000000000000000000000000000000000000..817af191de0cf9b7f1cf57df84ec1dc8e1b93399 GIT binary patch literal 716 zcmV;-0yF)IP)j0?z;d0$E8! zK~y-)?UT)J6Im35zjOQEZtOJOZX9B_?F>#J8X+OE=FND7c{4OCBoGoJiKC2_z{H7z zW0TnZb1n-cL>BgF_SCKx=Tk{l2Y&0nB)^)s@Bao7>Z0K0^A}DIM}GXz7>_dO_1NFr zlkT7oQAj25^5v_axAs?%Hvt4fUBKe{>va6-kPq+P17Kd<(a$pP@~(J+O717R2ND4h zgAswM&UCe;zP$xw@I{HJVgwYAdffo>V1NL@c*Ws~#3KeG0qeo2Qmdle2bp_DJ%M@x zRh(A1x+JVi!m7koC9W(nRkbf#1Acv?Z;J)<#hlsY#a~yWW2RRV%3=u!)5(O>lMz00 z$2NZ~w2}>=*$t;BBR@Vmgrg($>$a;)3~f#>LH?q8VZa`T9gzlF*7{V(VxXu(N`;3Q-V%S5QT~Cv7xH z(sVs2%`&>Z9#_3S@%dNWoyXK3V=ZAM#Bqb>cANJ0W74#>9;A(kbdXE$`GK!a&$wQ# zSgr~#EqsfcnC=ekg9Fme&Qs^?`uZziE6eB(hs50->W2+xMwuC+8w!QdeLtZa5(9ccj{SfChqWOyvEKijCm9 yosrug5^9CDmaQkdMB9(3LyMOmfB9SgPu~IiVE>haXU@?80000Xh&@&7q<=0brE6y(xcdr#GvZo2WC`4#+P?u^mYMXhZuwiXx)6c`v7 zX3lZZ#Kf{dmnJ^TH#zSw&zl4Pdc@h>0! zyF2}IxwNJ%f!686V=a04>h*8?)MFq`H6$}sIPFcl-D0+^GhPJmafAd)$S zY_{k-4%muRCxAdmd!fMsFbPNR<5uT5|M8UY>WWG07QfTQ>-SloMTAj|?X56C;RSa_ z*owK)D90gFsV-b)0r-4!avWWKXZOP?BDlj1L-OGiYZ?)ya~j$H@LXGApClXdwGE$Mr1T(5{;J{Tn#sqh+#V*2t#boBUKiOl8BWYPOZKi zP|C(w7JWxDa|D^xU|W)ml*FlIWCEvWs?MVB!dCN zVaRx#5X}vkaTxMk36qHk`PbYMJ< zG364a-5p9V4ymr!!LfrT7}B~ z9?za1Qh&N3r0Xy@8f`#JYdK&kg^-eXbxq)9->wu(Z)CMj(rRORJ#@w+zh1*G7D!wd jX)6ro;cpuL=kN0qDjeWwORkH~00000NkvXXu0mjf<@_A2 literal 0 HcmV?d00001 diff --git a/icon/24x24/arrowLeftDown.png b/icon/24x24/arrowLeftDown.png new file mode 100644 index 0000000000000000000000000000000000000000..f77bdf6961ba33889e0e4b5f00ce8e79dd7e04f5 GIT binary patch literal 893 zcmV-@1A_dCP)8%Gp|zwVhq8fgY3E)wD8Ecyf%#`CM0}6{Y=F72q(`Su zx~;#YwfVZbyY=Sj(SAohulH{Qcmnw#XPA!&#K*@6V@Z#We}CU<{qlCZMf<4Bc&!R! z*Ux(mApbH?2?QdfXXo@zPNhUZK?g6Kv5yY+_SpGzi=CYo$smK0j}f^Y;I5hr;42|E z^6Q6pdr!AtzM_Ip{9J~8_?04E^{e=3$JgeWXvAnVN*lMRPYjJ2p60M{(?j3DAT?Hqo5 zzultH?-PthBm%pI07@aM5~J_U(b!mJVr7|9x%60T50N_n#8}ca^fSrw99s%0f4@X!YKp1a3}ekj!upIV zRwq!!A};W7p1z7w-8e7TEz+7GEcB)uvsEXK#@Z^C$w|UEz8_4)yIvS#3uAynP*=XI zs{y*hSD}1OJU%|TymC)!jaeG2D=La3eBVbag#(OpVBO^y3YTB`|J>lKzP$bhT6^eR^wiAbt*hxeX5^a$ZKmxUuNI|GVjl`g-)LEY*c?5Wa z&MMRyNL&U8wHQz$1cQ*EqM#xmO5;o7#6I>h&T(v?%kBsX!lf}281PGbu-D#NpVq(h z!)JYLiJgVa&8rWpdU-tHSVX(Ss8Q|I*WaGW?7E?Ny`^{OhwSRV<4+bI65gzkO7t)^ zGIDdNT;t2Lzlhx8+{wYQ?=qcC@CLx=^Pvb2)s-wtegjvpvQ{pV&8^62UoWMq&e->7 z#Rmf-kqF5|f^4%ztyIC?+CnLzG;_uU>C?1J$0jDHI^KbllIs_KlTUyD zgZgS7VcDoc5bX{Tj%(Nhd!c_1N?#vpGD)a^&%*JOKOWxo4gh)*ah%j3#d@7au|%pN z(abuE(WGFQ)HW+P0|vr!P$KGhM-~AbJ@b=zG`}d_vd)HX5H~GiEgQGdBG+hOHd|N- zV!cUZ%YLs#o_9SYMn?&yQ#92GMwh}1zk=!YvMs@OB_5B5P@s#T-%rOA0C>_vRaq=) zt+fr-+sl~Z1)i3JE*-X|LznF!9T(AdK5PO@i%)seLj*?mVZ7eV9QXO(ffm z21cbqtx{qBcII5ifWd=@GHNV(et7>VzIXznQM|Dj;htV>MIpbr!Q!L8S$h1Kd^SJ* zaQ4nfM-~Abo;W@8XT3VzedG|n_5r@|dQsapZZ1!KHA|sZ!+ib^EiZH_&N7@39RUFR zarJzB?5k;iz)v_BJSCd#i}KmBW`;wQmX;_RI?D4W4D|PM_r?{uGh6=)IPuL7Gr-I% zrPzJ@vJ46Zj}WZqa!AL)vMgLz?k>r@(Y?Q}$--IzUDs(_7DL0sO#b|<*qLPB2I%D6 mn!SGU#_enJ<^8ihJ^cr`p+k(>LuN|=0000$6)A`?X;G?!k-cP)I`7lMr6L;P`rWYGV9=jlG-<3}{2XglDK7ccbW;E>f~iSH~WXEAAte>7n*oe`xefr2KN zxYIfE_k@Gj2fY35cOBguZv5*8U~zQB$zNkG&dvy|#dDTwp3}KVh|-L{Q)-#TT{~A>3<{CJ7aFh_w`} z6?XiJ<2Q$#&Cc;X!T13t+@aQrXx{&X;K7JEj<*APk3W@0e}K(0$^z;v>3pt76^~hA zxiU(9Z;znaBD~wii#zo0k0=dd3BuZTz+T)VDnJXRTozp6NY2k?zMSiPo#28h>ahb~|`?8n<3@`G3#*#!n-LO0~+JcKh4X{{GiG91;(QM711d>G zK~zY`?Ug-q8&wpBpL6$GT3KJVWJ{KlD8|4*#xt1#I%>P1pyV&mQ73ki}bm>?LFL^JDTd|2ITb~BY@ zk!BcU$mQ3_=X2Lm$Za|90%TY+Yne{x^v`@|mm#@@Wj)g!iL)c?=x)3;-Po9KE8F#F zxyIIY8-iH18lYX5k3W4Zv(VTiGK9yc4C4;R{(4_2bGVuFUf|%Aar5dM~K69 z5?zc@^BEgyO3PU8CmHoHVR=5l@Aa4t2Q1?`cX)goAYu^_($p}U&z=Th$ix_8?Xbw@ zNVFzKu`rhKa?1Fu&*;=+Hl11}yo*E`mK4OI*IhOa9%1qYCbccRV~@9^F@HWQ z>>wZQeWO14U^M`HC7f~`@`b_=#hntxYF%p0mNktg$<7Jk@dAC2`6n%y!L|+q*b@A9Z|+IXz==5pZErHYede&|R@A1TsJz zuwaxzp%A4=Dj3mH(HHDc3V%@ya$MPM)BS*xqP9!a$W!W`->afQ3L8KR~8%# zVo?Ut>6}?G!Sg+H=;W00000NkvXXu0mjfyg{$l literal 0 HcmV?d00001 diff --git a/icon/24x24/arrowRightUp.png b/icon/24x24/arrowRightUp.png new file mode 100644 index 0000000000000000000000000000000000000000..4a17aede6bbbfdeac5e8ae1580342046ecb5c519 GIT binary patch literal 864 zcmV-m1E2hfP)ch~vq)PI35`rK0gz4-0dpMmV3=gda15Ty|tQd=;} zK%9_HCIq9g^!t6>yhpXZ!S_G>_>rf*%oISO{`F0XfEY+J)O=1HhsKPM6ExfZ=dN97X728SQ#20A!IM z6N6-iIE)FWfkfjQvdb<>_nhEum+{qz;3hyv8P#=I8Hz;++3b|twy8Kpj4@3T{rjF{RQQ*;Qb1-6e5sWrE;bM6WWlpsohWuuiw-%e43A=Y05%GWb?W(l*x_~txSARHSYx|1g$iV*0{#tM04WV3@42767bNtmc@Fh0Na~X_nKsWQH84j zl;}nG7{L;SN(X}#L2VYS+JR&Xl-x=*-XX;^q$snHGz38_)ygL1z?wd9y z2=U5gbfrXK!Nh``@3Y%#;WzhGyp|(2n$zvK{A3e>NO3y`WJTdP(B4bXvSebJF z(pduJ^Lb8APS|a15vK|D)-L7E`m=)XKSwJvk>$bvA1whK%b~iv^E6+r{A7$F=NHtP q=OLE8@Y0|^xGE6QtC7Cwv*~Z_bx{VZzu%Dn0000`;0vt(1 zK~y-)?UYYX(*PL8e_gvRY-O{PK_H+(5=@kfiHR5ENsT7PnLs>!2{yNIQc1c& zgg=^l3A`GbXye=RHS6#Qr=o&s;u*(usybFx=kLmrH8fGT+1hKB4+(2^7J(`o8+fYF9MEibmnM$!xdJOxI=9FbNLI^vZ{9E`5m3Bxzxo$Gn z?viml(vm>C)nQQ8vG)%UCa2FPY8ocB@)4fZB-wMx`T=qfAvrEyqd}vh(lX7{jeagK zMfFC5Bf~&*9JDAv6Ty%Kj-!Bj-$iX%)Gd?Mm68>^n(g;-69R#p!N|+>qkxp}b0P`2 zsWhRSMb69gB>~UtDX~VOB$6K=XKH>Pga}Jj=~+$ugg~aCpiE9un43i&FCa=oyvX`$ z>3wJ8_p_ZJ>+Jp6Vjw1%yK$YHw{LM}VS)K4i^5O`dFTG)Me+)6Hiw-a!A_;=XEF%6 zJn2iy+__$)Cnd4P6m2m{mfHzX=Q0X|kio#m_dSpx3?rgbk|Ne9naeUV pF@`)dg^+-eVi8duy$Ig_&_57d`1H|?-W31<002ovPDHLkV1m*ADBA!4 literal 0 HcmV?d00001 diff --git a/icon/24x24/equal.png b/icon/24x24/equal.png new file mode 100644 index 0000000000000000000000000000000000000000..ff7ca48453da84639b96ef13e6e736dcf68b788e GIT binary patch literal 255 zcmeAS@N?(olHy`uVBq!ia0vp^5|gW!U_%O?XxI14-? ziy0WWg+Z8+Vb&aw9`+JXUsv|K?EIWO>|4z{%z;8Zo-U3d7N_@K*~ojyK&0j2dASC) zkU$q#=feRZJuXv?PN_*YwsE8v&*K{NLL?>3#j-y=VEv8 zd{*sb-ZSyS=Oi|2|G(zMsUH(;Y4Pa7ho&CuZ5b@DxU1%T$ei)}$YP@%Q-ijod^pCs u?7$*lNoR$ohx)GFGE03Mcf06VmDta5&U~o$-Sr00T@0SCelF{r5}E*4f?6#A literal 0 HcmV?d00001 diff --git a/icon/24x24/putHere.png b/icon/24x24/putHere.png new file mode 100644 index 0000000000000000000000000000000000000000..00e4d8f1d7c15adde3474b32adc5044008055bdb GIT binary patch literal 1209 zcmV;q1V;ObP)b{w3<5D2hUd@U!~JMB3*;2vNrMV2Ly5ZfeneP2V z@)uMsW2-Dxjl1W)e*IeV?dlWdvcyc;E&;5)H-5Dg+uJ1~2*Nzi@n%K{fe->_wn-rJ z>jdlVO#<6XkT}P(Eb(Tb8i`u(C)h)?zE#Y0??74BL7cZR0TG;Y8{Ddf2Wh@yZGv5}NsFdAooS@17L3N% zceDHa1ao-rTmaWovz>-F&7?|9m}2DWRO(iYnx&R;BRH-s1 zIH@5DRar6lp788>pU%OcF+Cinx`RO02^#KAn@Uux!0mm()nvw(anAQyWVTvyJDWGB z3r37e8K78sjI@cdo>eW^e&2^0H&s>YI*`vFY&tENPD{!MV=-SbXVp*;6%hx64s}Q{ z6V{)#lggH&A19SHL#V2uj`#psgeqSWmsNAb2rf(M_Ydfj;P$)e|2kQ44l>_iI5?I! z&tIAZr7TOrvTBlIh=TW?!Q&xsp1!1)b~b8}9lP*rYgJX$6o*5^k!BgE!zY;9yVK*x z7a;_q#*IRpLFy9v{XWlLoJlw9KpSWCGN6i&F;Z0(RaK#?2#qU>2*bxij)y1zSc`f0 zWDX%|pG}&fA7X3}w0lAb_&m=UjYce&OQLGSUz=d3EBG-%Gnclb)NK9ovQ040=YReO Xvy_;TBOW&q00000NkvXXu0mjfJU%nH literal 0 HcmV?d00001 diff --git a/icon/32x32/segment.png b/icon/32x32/segment.png new file mode 100644 index 0000000000000000000000000000000000000000..f3ad434f6d83f473ff95bc6181d56331c062bb7e GIT binary patch literal 676 zcmV;V0$crwP)|sfopS&H0x?NM zK~z}7y_Yd-6j2bzfA7sE(d2d`f{37qtq>4mrJkTcxU^RY7S>kU+WQgwB4Q&p!A2t% z7Z4#=?4gw?rb0kBGyn&z*Tk%kfHe-_fv+_&d$BF} z1-uKMkJDkz-prEFYB_KTxCkU+PXpk$(3bCkVGIC(ec&yy4SWJ#1G~Ua;JWvI+00gB zK`>JJ)#rhTyZ}r@-T;q7XEdIHvFda>y*$rbNs=rSMR7|+R?MtXJ8A(2g8@KKRaZoW zq9``J_l-ixBtan)nTVjO8zM5dny5lhtqJe_b`v!rlLnS{m|06ioT}dT-nVA8L#D_? zFVFMTId^DgcjnomN9uOFr5!ITc08QM4w(j^-|v@poOaG-W_C?PGBaBU7uYZ=Kt;R2 zB5=~oZi-0D%odLWF)P3@9CpGv*HYE?aUrCEk|-gToO79~-Vl-1N$rq^>T)<@M>|Q9 zOjZ92Aq_UiksZLYs #include -int main(int argc, char *argv[]) -{ +void myMessageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg){ + QByteArray localMsg = msg.toLocal8Bit(); + switch (type) { + case QtDebugMsg: + fprintf(stderr, "Debug: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, + context.function); + break; + case QtWarningMsg: + fprintf(stderr, "Warning: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, + context.function); + break; + case QtCriticalMsg: + fprintf(stderr, "Critical: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, + context.function); + break; + case QtFatalMsg: + fprintf(stderr, "Fatal: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, + context.function); + abort(); + } +} + +int main(int argc, char *argv[]){ + qInstallMessageHandler(myMessageOutput); QApplication app(argc, argv); MainWindow w; app.setWindowIcon(QIcon(":/icon/64x64/icon64x64.png")); diff --git a/mainwindow.cpp b/mainwindow.cpp index 1fd4d1d39..36d958703 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -8,8 +8,10 @@ #include #include #include +#include #include "options.h" +#include "tools/vtoolendline.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) @@ -25,20 +27,22 @@ MainWindow::MainWindow(QWidget *parent) : connect(scene, &VMainGraphicsScene::mouseMove, this, &MainWindow::mouseMove); connect(ui->toolButtonSinglePoint, &QToolButton::clicked, this, - &MainWindow::clickedToolButtonSinglePoint); + &MainWindow::ToolSinglePoint); helpLabel = new QLabel("Створіть новий файл для початку роботи."); ui->statusBar->addWidget(helpLabel); - connect(ui->actionArrowTool, &QAction::triggered, this, &MainWindow::triggeredActionAroowTool); - connect(ui->actionDraw, &QAction::triggered, this, &MainWindow::triggeredActionDraw); - connect(ui->actionDetails, &QAction::triggered, this, &MainWindow::triggeredActionDetails); - connect(ui->actionNewDraw, &QAction::triggered, this, &MainWindow::triggeredActionNewDraw); - connect(ui->actionOptionDraw, &QAction::triggered, this, &MainWindow::triggeredOptionDraw); - connect(ui->actionSaveAs, &QAction::triggered, this, &MainWindow::triggeredActionSaveAs); - connect(ui->actionSave, &QAction::triggered, this, &MainWindow::triggeredActionSave); - connect(ui->actionOpen, &QAction::triggered, this, &MainWindow::triggeredActionOpen); - connect(ui->actionNew, &QAction::triggered, this, &MainWindow::triggeredActionNew); - connect(ui->actionTable, &QAction::triggered, this, &MainWindow::triggeredActionTable); + connect(ui->actionArrowTool, &QAction::triggered, this, &MainWindow::ActionAroowTool); + connect(ui->actionDraw, &QAction::triggered, this, &MainWindow::ActionDraw); + connect(ui->actionDetails, &QAction::triggered, this, &MainWindow::ActionDetails); + connect(ui->actionNewDraw, &QAction::triggered, this, &MainWindow::ActionNewDraw); + connect(ui->actionOptionDraw, &QAction::triggered, this, &MainWindow::OptionDraw); + connect(ui->actionSaveAs, &QAction::triggered, this, &MainWindow::ActionSaveAs); + connect(ui->actionSave, &QAction::triggered, this, &MainWindow::ActionSave); + 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); data = new VContainer; CreateManTableIGroup (); @@ -49,9 +53,10 @@ MainWindow::MainWindow(QWidget *parent) : fileName.clear(); changeInFile = false; + } -void MainWindow::triggeredActionNewDraw(){ +void MainWindow::ActionNewDraw(){ QString nameDraw; bool bOk; qint32 index; @@ -90,9 +95,10 @@ void MainWindow::triggeredActionNewDraw(){ comboBoxDraws->setCurrentIndex(index); } SetEnableWidgets(true); + SetEnableTool(false); } -void MainWindow::triggeredOptionDraw(){ +void MainWindow::OptionDraw(){ QString nameDraw; bool bOk; qint32 index; @@ -128,7 +134,7 @@ void MainWindow::triggeredOptionDraw(){ /* * Інструмет базова точка креслення. */ -void MainWindow::clickedToolButtonSinglePoint(bool checked){ +void MainWindow::ToolSinglePoint(bool checked){ if(checked){ CanselTool(); tool = Tools::SinglePointTool; @@ -149,6 +155,52 @@ void MainWindow::clickedToolButtonSinglePoint(bool checked){ } } +void MainWindow::ToolEndLine(bool checked){ + if(checked){ + CanselTool(); + tool = Tools::EndLineTool; + QPixmap pixmap(":/cursor/endline_cursor.png"); + QCursor cur(pixmap, 2, 3); + ui->graphicsView->setCursor(cur); + helpLabel->setText("Заповніть усі поля."); + dialogEndLine = new DialogEndLine(data, this); + connect(scene, &VMainGraphicsScene::ChoosedObject, dialogEndLine, + &DialogEndLine::ChoosedPoint); + connect(dialogEndLine, &DialogEndLine::DialogClosed, this, + &MainWindow::ClosedDialogEndLine); + connect(doc, &VDomDocument::FullUpdateFromFile, dialogEndLine, &DialogEndLine::UpdateList); + } else { + ui->toolButtonEndLine->setChecked(true); + } +} + +void MainWindow::ClosedDialogEndLine(int result){ + if(result == QDialog::Accepted){ + QString pointName = dialogEndLine->getPointName(); + QString typeLine = dialogEndLine->getTypeLine(); + QString formula = dialogEndLine->getFormula(); + qint32 angle = dialogEndLine->getAngle(); + qint64 basePointId = dialogEndLine->getBasePointId(); + + VPointF basePoint = data->GetPoint(basePointId); + QLineF line = QLineF(basePoint.toQPointF(), QPointF(basePoint.x()+100, basePoint.y())); + Calculator cal(data); + QString errorMsg; + qreal result = cal.eval(formula, &errorMsg); + if(errorMsg.isEmpty()){ + line.setLength(result*PrintDPI/25.4); + line.setAngle(angle); + qint64 id = data->AddPoint(VPointF(line.p2().x(), line.p2().y(), pointName, 5, 10)); + VToolEndLine *point = new VToolEndLine(doc, data, id, typeLine, formula, angle, basePointId, + Tool::FromGui); + scene->addItem(point); + connect(point, &VToolPoint::ChoosedPoint, scene, &VMainGraphicsScene::ChoosedItem); + } + + } + ArrowTool(); +} + void MainWindow::showEvent( QShowEvent *event ){ QMainWindow::showEvent( event ); if( event->spontaneous() ){ @@ -230,6 +282,11 @@ void MainWindow::currentDrawChanged( int index ){ if(index != -1) { bool status = qvariant_cast(comboBoxDraws->itemData(index)); ui->toolButtonSinglePoint->setEnabled(status); + if(ui->toolButtonSinglePoint->isEnabled()==false){ + SetEnableTool(true); + } else { + SetEnableTool(false); + } doc->ChangeActivDraw(comboBoxDraws->itemText(index)); } } @@ -252,6 +309,11 @@ void MainWindow::CanselTool(){ delete dialogSinglePoint; ui->toolButtonSinglePoint->setChecked(false); break; + case Tools::EndLineTool: + delete dialogEndLine; + ui->toolButtonEndLine->setChecked(false); + scene->clearSelection(); + break; } } @@ -264,7 +326,7 @@ void MainWindow::ArrowTool(){ helpLabel->setText(""); } -void MainWindow::triggeredActionAroowTool(){ +void MainWindow::ActionAroowTool(){ ArrowTool(); } @@ -285,14 +347,16 @@ void MainWindow::SinglePointCreated(const QString name, const QPointF point){ qint64 id = data->AddPoint(VPointF(point.x(), point.y(), name, 5, 10)); VToolSimplePoint *spoint = new VToolSimplePoint(doc, data, id, Tool::FromGui); scene->addItem(spoint); + connect(spoint, &VToolPoint::ChoosedPoint, scene, &VMainGraphicsScene::ChoosedItem); ArrowTool(); ui->toolButtonSinglePoint->setEnabled(false); qint32 index = comboBoxDraws->currentIndex(); comboBoxDraws->setItemData(index, false); ui->actionSave->setEnabled(true); + SetEnableTool(true); } -void MainWindow::triggeredActionDraw(bool checked){ +void MainWindow::ActionDraw(bool checked){ if(checked){ ui->actionDetails->setChecked(false); } else { @@ -300,7 +364,7 @@ void MainWindow::triggeredActionDraw(bool checked){ } } -void MainWindow::triggeredActionDetails(bool checked){ +void MainWindow::ActionDetails(bool checked){ if(checked){ ui->actionDraw->setChecked(false); } else { @@ -308,7 +372,7 @@ void MainWindow::triggeredActionDetails(bool checked){ } } -void MainWindow::triggeredActionSaveAs(){ +void MainWindow::ActionSaveAs(){ QString filters("Lekalo files (*.xml);;All files (*.*)"); QString defaultFilter("Lekalo files (*.xml)"); QString fName = QFileDialog::getSaveFileName(this, "Зберегти файл як", QDir::homePath(), @@ -333,7 +397,7 @@ void MainWindow::triggeredActionSaveAs(){ changeInFile = false; } -void MainWindow::triggeredActionSave(){ +void MainWindow::ActionSave(){ if(!fileName.isEmpty()){ QFile file(fileName); if(file.open(QIODevice::WriteOnly| QIODevice::Truncate)){ @@ -347,7 +411,7 @@ void MainWindow::triggeredActionSave(){ } } -void MainWindow::triggeredActionOpen(){ +void MainWindow::ActionOpen(){ QString filter("Lekalo files (*.xml)"); QString fName = QFileDialog::getOpenFileName(this, tr("Відкрити файл"), QDir::homePath(), filter); fileName = fName; @@ -377,9 +441,14 @@ void MainWindow::triggeredActionOpen(){ } file.close(); } + if(ui->toolButtonSinglePoint->isEnabled()==false){ + SetEnableTool(true); + } else { + SetEnableTool(false); + } } -void MainWindow::triggeredActionNew(){ +void MainWindow::ActionNew(){ setWindowTitle("Valentina"); data->Clear(); doc->clear(); @@ -390,6 +459,7 @@ void MainWindow::triggeredActionNew(){ ui->toolButtonSinglePoint->setEnabled(true); ui->actionOptionDraw->setEnabled(false); ui->actionSave->setEnabled(false); + SetEnableTool(false); } void MainWindow::haveChange(){ @@ -474,15 +544,17 @@ void MainWindow::SetEnableWidgets(bool enable){ ui->actionDetails->setEnabled(enable); ui->toolButtonSinglePoint->setEnabled(enable); ui->actionOptionDraw->setEnabled(enable); - ui->actionSave->setEnabled(enable); + if(enable == true && !fileName.isEmpty()){ + ui->actionSave->setEnabled(enable); + } ui->actionTable->setEnabled(enable); } -void MainWindow::triggeredActionTable(bool checked){ +void MainWindow::ActionTable(bool checked){ if(checked){ dialogTable = new DialogIncrements(data, doc, 0); connect(dialogTable, &DialogIncrements::closedActionTable, this, - &MainWindow::closedActionTable); + &MainWindow::ClosedActionTable); dialogTable->show(); } else { ui->actionTable->setChecked(true); @@ -490,7 +562,7 @@ void MainWindow::triggeredActionTable(bool checked){ } } -void MainWindow::closedActionTable(){ +void MainWindow::ClosedActionTable(){ ui->actionTable->setChecked(false); delete dialogTable; } @@ -502,6 +574,10 @@ void MainWindow::closeEvent ( QCloseEvent * event ){ event->accept(); } +void MainWindow::SetEnableTool(bool enable){ + ui->toolButtonEndLine->setEnabled(enable); +} + MainWindow::~MainWindow(){ CanselTool(); delete ui; diff --git a/mainwindow.h b/mainwindow.h index 54eaff847..14a6ec2de 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -12,6 +12,7 @@ #include "tools/vtoolsimplepoint.h" #include "xml/vdomdocument.h" #include "container/vcontainer.h" +#include "dialogs/dialogendline.h" namespace Ui { class MainWindow; @@ -21,7 +22,8 @@ namespace Tools{ enum Enum { ArrowTool, - SinglePointTool + SinglePointTool, + EndLineTool }; } @@ -33,24 +35,26 @@ public: ~MainWindow(); public slots: void mouseMove(QPointF scenePos); - void clickedToolButtonSinglePoint(bool checked); - void triggeredActionAroowTool(); - void triggeredActionDraw(bool checked); - void triggeredActionDetails(bool checked); + void ToolSinglePoint(bool checked); + void ActionAroowTool(); + void ActionDraw(bool checked); + void ActionDetails(bool checked); void ToolCanseled(); void SinglePointCreated(const QString name, const QPointF point); - void triggeredActionNewDraw(); + void ActionNewDraw(); void currentDrawChanged( int index ); - void triggeredOptionDraw(); - void triggeredActionSaveAs(); - void triggeredActionSave(); - void triggeredActionOpen(); - void triggeredActionNew(); + void OptionDraw(); + void ActionSaveAs(); + void ActionSave(); + void ActionOpen(); + void ActionNew(); void haveChange(); void ChangedSize(const QString &text); void ChangedGrowth(const QString & text); - void triggeredActionTable(bool checked); - void closedActionTable(); + void ActionTable(bool checked); + void ClosedActionTable(); + void ToolEndLine(bool checked); + void ClosedDialogEndLine(int result); protected: virtual void keyPressEvent ( QKeyEvent * event ); virtual void showEvent( QShowEvent *event ); @@ -64,6 +68,7 @@ private: bool isInitialized; DialogSinglePoint *dialogSinglePoint; DialogIncrements *dialogTable; + DialogEndLine *dialogEndLine; VDomDocument *doc; VContainer *data; QComboBox *comboBoxDraws; @@ -75,6 +80,7 @@ private: void ArrowTool(); void CreateManTableIGroup () const; void SetEnableWidgets(bool enable); + void SetEnableTool(bool enable); }; #endif // MAINWINDOW_H diff --git a/mainwindow.ui b/mainwindow.ui index e9fc06b2d..af4b2be80 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -51,7 +51,7 @@ - + 1 0 @@ -86,10 +86,26 @@ - + + + false + ... + + + :/icon/32x32/segment.png:/icon/32x32/segment.png + + + + 24 + 24 + + + + true + diff --git a/options.h b/options.h index 6bd4ae480..68633c0a4 100644 --- a/options.h +++ b/options.h @@ -6,4 +6,14 @@ #define WidthMainLine 0.8*PrintDPI/25.4 #define widthHairLine WidthMainLine/3 +namespace Scene{ + enum Type + { + Point, + Line, + Spline, + Arc + }; +} + #endif // OPTIONS_H diff --git a/tools/vtoolendline.cpp b/tools/vtoolendline.cpp new file mode 100644 index 000000000..add4001c9 --- /dev/null +++ b/tools/vtoolendline.cpp @@ -0,0 +1,152 @@ +#include "vtoolendline.h" +#include +#include + +#include "../widgets/vmaingraphicsscene.h" + +VToolEndLine::VToolEndLine(VDomDocument *doc, VContainer *data, const qint64 &id, + const QString &typeLine, const QString &formula, const qint32 &angle, + const qint64 &basePointId, Tool::Enum typeCreation, + QGraphicsItem *parent):VToolPoint(doc, data, id, parent){ + ignoreContextMenuEvent = false;//don't ignore context menu events; + connect(this, &VToolEndLine::FullUpdateTree, this->doc, &VDomDocument::FullUpdateTree); + this->typeLine = typeLine; + this->formula = formula; + this->angle = angle; + this->basePointId = basePointId; + + //Лінія, що з'єднує дві точки + VPointF basePoint = data->GetPoint(basePointId); + VPointF point = data->GetPoint(id); + mainLine = new QGraphicsLineItem(QLineF(basePoint.toQPointF(), point.toQPointF()), this); + mainLine->setFlag(QGraphicsItem::ItemStacksBehindParent, true); + if(typeLine == "none"){ + mainLine->setVisible(false); + } else { + mainLine->setVisible(true); + } + + QString nameLine = GetNameLine(basePointId, id); + QLineF line = QLineF(basePoint.toQPointF(), point.toQPointF()); + data->AddLine(nameLine, line.length()); + + if(typeCreation == Tool::FromGui){ + AddToFile(); + } +} + +void VToolEndLine::FullUpdateFromFile(){ + QString name; + qreal mx, my; + QDomElement domElement = doc->elementById(QString().setNum(id)); + if(domElement.isElement()){ + name = domElement.attribute("name", ""); + mx = domElement.attribute("mx", "").toDouble()*PrintDPI/25.4; + my = domElement.attribute("my", "").toDouble()*PrintDPI/25.4; + typeLine = domElement.attribute("typeLine", ""); + formula = domElement.attribute("length", ""); + basePointId = domElement.attribute("basePoint", "").toLongLong(); + angle = domElement.attribute("angle", "").toInt(); + } + VPointF point = data->GetPoint(id); + RefreshBaseGeometry(name, point.x(), point.y(), mx, my); + VPointF basePoint = data->GetPoint(basePointId); + mainLine->setLine(QLineF(basePoint.toQPointF(), point.toQPointF())); + + QString nameLine = GetNameLine(basePointId, id); + QLineF line = QLineF(basePoint.toQPointF(), point.toQPointF()); + data->AddLine(nameLine, line.length()); +} + +void VToolEndLine::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){ + if(!ignoreContextMenuEvent){ + QMenu menu; + QAction *actionOption = menu.addAction("Властивості"); + QAction *selectedAction = menu.exec(event->screenPos()); + if(selectedAction == actionOption){ + dialogEndLine = QSharedPointer(new DialogEndLine(data)); + + connect(qobject_cast< VMainGraphicsScene * >(this->scene()), &VMainGraphicsScene::ChoosedObject, + dialogEndLine.data(), &DialogEndLine::ChoosedPoint); + connect(dialogEndLine.data(), &DialogEndLine::DialogClosed, this, &VToolEndLine::ClosedDialogEndLine); + connect(doc, &VDomDocument::FullUpdateFromFile, dialogEndLine.data(), &DialogEndLine::UpdateList); + + VPointF p = data->GetPoint(id); + + dialogEndLine->setTypeLine(typeLine); + dialogEndLine->setFormula(formula); + dialogEndLine->setAngle(angle); + dialogEndLine->setBasePointId(basePointId); + dialogEndLine->setPointName(p.name()); + + dialogEndLine->show(); + } + } +} + +void VToolEndLine::ClosedDialogEndLine(int result){ + if(result == QDialog::Accepted){ + QString pointName = dialogEndLine->getPointName(); + QString typeLine = dialogEndLine->getTypeLine(); + QString formula = dialogEndLine->getFormula(); + qint32 angle = dialogEndLine->getAngle(); + qint64 basePointId = dialogEndLine->getBasePointId(); + + VPointF basePoint = data->GetPoint(basePointId); + QLineF line = QLineF(basePoint.toQPointF(), QPointF(basePoint.x()+100, basePoint.y())); + Calculator cal(data); + QString errorMsg; + qreal result = cal.eval(formula, &errorMsg); + if(errorMsg.isEmpty()){ + line.setLength(result/PrintDPI*25.4); + line.setAngle(angle); + + FullUpdateFromGui(pointName, typeLine, formula, angle, basePointId); + } + + } + dialogEndLine.clear(); +} + +void VToolEndLine::AddToFile(){ + VPointF point = data->GetPoint(id); + QDomElement domElement = doc->createElement("point"); + + AddAttribute(domElement, "id", id); + AddAttribute(domElement, "type", "endLine"); + AddAttribute(domElement, "name", point.name()); + AddAttribute(domElement, "mx", point.mx()/PrintDPI*25.4); + AddAttribute(domElement, "my", point.my()/PrintDPI*25.4); + + AddAttribute(domElement, "typeLine", typeLine); + AddAttribute(domElement, "length", formula); + AddAttribute(domElement, "angle", angle); + AddAttribute(domElement, "basePoint", basePointId); + + QDomElement calcElement; + bool ok = doc->GetActivCalculationElement(calcElement); + if(ok){ + calcElement.appendChild(domElement); + } else { + qCritical()<<"Не можу знайти тег калькуляції."<< Q_FUNC_INFO; + } +} + +void VToolEndLine::FullUpdateFromGui(const QString &name, const QString &typeLine, const QString &formula, + const qreal &angle, const qint64 &basePointId){ + QDomElement domElement = doc->elementById(QString().setNum(id)); + if(domElement.isElement()){ + this->typeLine = typeLine; + this->formula = formula; + this->angle = angle; + this->basePointId = basePointId; + + domElement.setAttribute("name", name); + + domElement.setAttribute("typeLine", typeLine); + domElement.setAttribute("length", formula); + domElement.setAttribute("angle", QString().setNum(angle)); + domElement.setAttribute("basePoint", QString().setNum(basePointId)); + emit FullUpdateTree(); + } +} diff --git a/tools/vtoolendline.h b/tools/vtoolendline.h new file mode 100644 index 000000000..322b692d3 --- /dev/null +++ b/tools/vtoolendline.h @@ -0,0 +1,34 @@ +#ifndef VTOOLENDLINE_H +#define VTOOLENDLINE_H + +#include + +#include "vtoolpoint.h" +#include "../dialogs/dialogendline.h" + +class VToolEndLine : public VToolPoint +{ + Q_OBJECT +public: + VToolEndLine(VDomDocument *doc, VContainer *data, const qint64 &id, + const QString &typeLine, const QString &formula, const qint32 &angle, + const qint64 &basePointId, Tool::Enum typeCreation, + QGraphicsItem * parent = 0); +public slots: + virtual void FullUpdateFromFile(); + void ClosedDialogEndLine(int result); +protected: + virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); + virtual void AddToFile(); +private: + QString typeLine; + QString formula; + qint32 angle; + qint64 basePointId; + QGraphicsLineItem *mainLine; + QSharedPointer dialogEndLine; + void FullUpdateFromGui(const QString &name, const QString &typeLine, const QString &formula, + const qreal &angle, const qint64 &basePointId); +}; + +#endif // VTOOLENDLINE_H diff --git a/tools/vtoolpoint.cpp b/tools/vtoolpoint.cpp index ea7402129..d0028e4e2 100644 --- a/tools/vtoolpoint.cpp +++ b/tools/vtoolpoint.cpp @@ -5,8 +5,8 @@ #include #include -#include "../options.h" #include "../container/vpointf.h" +#include "../widgets/vmaingraphicsscene.h" VToolPoint::VToolPoint(VDomDocument *doc, VContainer *data, qint64 id, QGraphicsItem *parent):QGraphicsEllipseItem(parent){ @@ -56,7 +56,7 @@ void VToolPoint::NameChangePosition(const QPointF pos){ point.setMx(pos.x() - rec.center().x()); point.setMy(pos.y() - rec.center().y()); RefreshLine(); - LiteUpdateFromGui(point.name(), point.mx(), point.my()); + LiteUpdateFromGui(point.mx(), point.my()); data->UpdatePoint(id, point); } @@ -158,10 +158,9 @@ void VToolPoint::RefreshLine(){ } } -void VToolPoint::LiteUpdateFromGui(const QString& name, qreal mx, qreal my){ +void VToolPoint::LiteUpdateFromGui(qreal mx, qreal my){ QDomElement domElement = doc->elementById(QString().setNum(id)); if(domElement.isElement()){ - domElement.setAttribute("name", name); domElement.setAttribute("mx", QString().setNum(mx/PrintDPI*25.4)); domElement.setAttribute("my", QString().setNum(my/PrintDPI*25.4)); emit haveLiteChange(); @@ -183,6 +182,7 @@ void VToolPoint::ChangedActivDraw(const QString newName){ namePoint->setFlag(QGraphicsItem::ItemSendsGeometryChanges, true); namePoint->setBrush(QBrush(Qt::black)); line->setPen(QPen(Qt::black, widthHairLine)); + ignoreContextMenuEvent = false; } else { this->setPen(QPen(Qt::gray, widthHairLine)); this->setFlag(QGraphicsItem::ItemIsSelectable, false); @@ -191,5 +191,61 @@ void VToolPoint::ChangedActivDraw(const QString newName){ namePoint->setFlag(QGraphicsItem::ItemSendsGeometryChanges, false); namePoint->setBrush(QBrush(Qt::gray)); line->setPen(QPen(Qt::gray, widthHairLine)); + ignoreContextMenuEvent = true; } } + +void VToolPoint::mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ){ + if(event->button() == Qt::LeftButton){ + emit ChoosedPoint(id, Scene::Point); + } + QGraphicsItem::mouseReleaseEvent(event); +} + +void VToolPoint::AddAttribute(QDomElement &domElement, const QString &name, const qint64 &value){ + QDomAttr domAttr = doc->createAttribute(name); + domAttr.setValue(QString().setNum(value)); + domElement.setAttributeNode(domAttr); +} + +void VToolPoint::AddAttribute(QDomElement &domElement, const QString &name, const qint32 &value){ + QDomAttr domAttr = doc->createAttribute(name); + domAttr.setValue(QString().setNum(value)); + domElement.setAttributeNode(domAttr); +} + +void VToolPoint::AddAttribute(QDomElement &domElement, const QString &name, const qreal &value){ + QDomAttr domAttr = doc->createAttribute(name); + domAttr.setValue(QString().setNum(value)); + domElement.setAttributeNode(domAttr); +} + +void VToolPoint::AddAttribute(QDomElement &domElement, const QString &name, const QString &value){ + QDomAttr domAttr = doc->createAttribute(name); + domAttr.setValue(value); + domElement.setAttributeNode(domAttr); +} + +void VToolPoint::RefreshBaseGeometry(const QString &name, const qreal &x, const qreal &y, const qreal &mx, + const qreal &my){ + QRectF rec = QRectF(x, y, radius*2, radius*2); + rec.translate(x-rec.center().x(), y-rec.center().y()); + this->setRect(rec); + + rec = this->rect(); + namePoint->setText(name); + namePoint->setPos(QPointF(rec.center().x()+mx, rec.center().y()+my)); + + RefreshLine(); +} + +QString VToolPoint::GetNameLine(qint64 firstPoint, qint64 secondPoint) const{ + VPointF first = data->GetPoint(firstPoint); + VPointF second = data->GetPoint(secondPoint); + QString name = QString("Line_%1_%2").arg(first.name(), second.name()); + return name; +} + +VToolPoint::~VToolPoint(){ + +} diff --git a/tools/vtoolpoint.h b/tools/vtoolpoint.h index 18df133f5..d64776b40 100644 --- a/tools/vtoolpoint.h +++ b/tools/vtoolpoint.h @@ -7,6 +7,7 @@ #include "../widgets/vgraphicssimpletextitem.h" #include "../container/vcontainer.h" #include "../xml/vdomdocument.h" +#include "../options.h" namespace Tool{ enum Enum @@ -21,6 +22,7 @@ class VToolPoint: public QObject, public QGraphicsEllipseItem Q_OBJECT public: VToolPoint(VDomDocument *doc, VContainer *data, qint64 id, QGraphicsItem * parent = 0); + virtual ~VToolPoint(); public slots: void NameChangePosition(const QPointF pos); virtual void ChangedActivDraw(const QString newName); @@ -28,6 +30,8 @@ public slots: void ChangedNameDraw(const QString oldName, const QString newName); signals: void haveLiteChange(); + void ChoosedPoint(qint64 id, Scene::Type type); + void FullUpdateTree(); protected: qreal radius; VDomDocument *doc; @@ -36,15 +40,24 @@ protected: QGraphicsLineItem *line; qint64 id; QString nameActivDraw; + bool ignoreContextMenuEvent; virtual void AddToFile()=0; - void RefreshLine(); + virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ); + void AddAttribute(QDomElement &domElement, const QString &name, const qint64 &value); + void AddAttribute(QDomElement &domElement, const QString &name, const qint32 &value); + void AddAttribute(QDomElement &domElement, const QString &name, const qreal &value); + void AddAttribute(QDomElement &domElement, const QString &name, const QString &value); + void RefreshBaseGeometry(const QString &name, const qreal &x, const qreal &y, + const qreal &mx, const qreal &my); + QString GetNameLine(qint64 firstPoint, qint64 secondPoint) const; private: qint32 LineIntersectCircle(QPointF center, qreal radius, QLineF line, QPointF &p1, QPointF &p2) const; QPointF LineIntersectRect(QRectF rec, QLineF line) const; QPointF ClosestPoint(QLineF line, QPointF p) const; QPointF add_vector (QPointF p, QPointF p1, QPointF p2, qreal k) const; - void LiteUpdateFromGui(const QString& name, qreal mx, qreal my); + void LiteUpdateFromGui(qreal mx, qreal my); + void RefreshLine(); }; #endif // VTOOLPOINT_H diff --git a/tools/vtoolsimplepoint.cpp b/tools/vtoolsimplepoint.cpp index eaef1faf9..bfd8cc807 100644 --- a/tools/vtoolsimplepoint.cpp +++ b/tools/vtoolsimplepoint.cpp @@ -20,47 +20,17 @@ VToolSimplePoint::VToolSimplePoint (VDomDocument *doc, VContainer *data, qint64 } } -void VToolSimplePoint::ChangedActivDraw(const QString newName){ - if(nameActivDraw == newName){ - VToolPoint::ChangedActivDraw(newName); - ignoreContextMenuEvent = false; - } else { - VToolPoint::ChangedActivDraw(newName); - ignoreContextMenuEvent = true; - } -} - void VToolSimplePoint::AddToFile(){ VPointF point = data->GetPoint(id); QDomElement domElement = doc->createElement("point"); - QDomAttr domAttr = doc->createAttribute("id"); - domAttr.setValue(QString().setNum(id)); - domElement.setAttributeNode(domAttr); - - domAttr = doc->createAttribute("type"); - domAttr.setValue("simple"); - domElement.setAttributeNode(domAttr); - - domAttr = doc->createAttribute("name"); - domAttr.setValue(point.name()); - domElement.setAttributeNode(domAttr); - - domAttr = doc->createAttribute("x"); - domAttr.setValue(QString().setNum(point.x()/PrintDPI*25.4)); - domElement.setAttributeNode(domAttr); - - domAttr = doc->createAttribute("y"); - domAttr.setValue(QString().setNum(point.y()/PrintDPI*25.4)); - domElement.setAttributeNode(domAttr); - - domAttr = doc->createAttribute("mx"); - domAttr.setValue(QString().setNum(point.mx()/PrintDPI*25.4)); - domElement.setAttributeNode(domAttr); - - domAttr = doc->createAttribute("my"); - domAttr.setValue(QString().setNum(point.my()/PrintDPI*25.4)); - domElement.setAttributeNode(domAttr); + AddAttribute(domElement, "id", id); + AddAttribute(domElement, "type", "simple"); + AddAttribute(domElement, "name", point.name()); + AddAttribute(domElement, "x", point.x()/PrintDPI*25.4); + AddAttribute(domElement, "y", point.y()/PrintDPI*25.4); + AddAttribute(domElement, "mx", point.mx()/PrintDPI*25.4); + AddAttribute(domElement, "my", point.my()/PrintDPI*25.4); QDomElement calcElement; bool ok = doc->GetActivCalculationElement(calcElement); @@ -111,13 +81,5 @@ void VToolSimplePoint::FullUpdateFromFile(){ mx = domElement.attribute("mx", "").toDouble()*PrintDPI/25.4; my = domElement.attribute("my", "").toDouble()*PrintDPI/25.4; } - QRectF rec = QRectF(x, y, radius*2, radius*2); - rec.translate(x-rec.center().x(), y-rec.center().y()); - this->setRect(rec); - - rec = this->rect(); - namePoint->setText(name); - namePoint->setPos(QPointF(rec.center().x()+mx, rec.center().y()+my)); - - RefreshLine(); + RefreshBaseGeometry(name, x, y, mx, my); } diff --git a/tools/vtoolsimplepoint.h b/tools/vtoolsimplepoint.h index 8f0608ddf..0d0bc4f41 100644 --- a/tools/vtoolsimplepoint.h +++ b/tools/vtoolsimplepoint.h @@ -12,16 +12,11 @@ public: VToolSimplePoint (VDomDocument *doc, VContainer *data, qint64 id, Tool::Enum typeCreation, QGraphicsItem * parent = 0 ); public slots: - virtual void ChangedActivDraw(const QString newName); virtual void FullUpdateFromFile(); -signals: - void FullUpdateTree(); protected: virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); virtual void AddToFile(); private: - bool ignoreContextMenuEvent; - void FullUpdateFromGui(const QString& name, qreal x, qreal y); }; diff --git a/widgets/vmaingraphicsscene.cpp b/widgets/vmaingraphicsscene.cpp index 08e6bceaa..17a82eaec 100644 --- a/widgets/vmaingraphicsscene.cpp +++ b/widgets/vmaingraphicsscene.cpp @@ -20,3 +20,7 @@ void VMainGraphicsScene::mousePressEvent(QGraphicsSceneMouseEvent *event){ emit mousePress(event->scenePos()); QGraphicsScene::mousePressEvent(event); } + +void VMainGraphicsScene::ChoosedItem(qint64 id, Scene::Type type){ + emit ChoosedObject(id, type); +} diff --git a/widgets/vmaingraphicsscene.h b/widgets/vmaingraphicsscene.h index 1a7a2bf39..794a742ef 100644 --- a/widgets/vmaingraphicsscene.h +++ b/widgets/vmaingraphicsscene.h @@ -4,18 +4,23 @@ #include #include +#include "../options.h" + class VMainGraphicsScene : public QGraphicsScene { Q_OBJECT public: VMainGraphicsScene(); VMainGraphicsScene(const QRectF & sceneRect, QObject * parent = 0); +public slots: + void ChoosedItem(qint64 id, Scene::Type type); private: void mouseMoveEvent(QGraphicsSceneMouseEvent* event); void mousePressEvent(QGraphicsSceneMouseEvent *event); signals: void mouseMove(QPointF scenePos); void mousePress(QPointF scenePos); + void ChoosedObject(qint64 id, Scene::Type type); }; #endif // VMAINGRAPHICSSCENE_H diff --git a/xml/vdomdocument.cpp b/xml/vdomdocument.cpp index a29231d4d..43a32ed82 100644 --- a/xml/vdomdocument.cpp +++ b/xml/vdomdocument.cpp @@ -1,9 +1,12 @@ #include "vdomdocument.h" -#include "../tools/vtoolsimplepoint.h" -#include "../options.h" - #include +#include "../tools/vtoolsimplepoint.h" +#include "../tools/vtoolendline.h" +#include "../options.h" +#include "../container/calculator.h" + + VDomDocument::VDomDocument(VContainer *data) : QDomDocument() { this->data = data; } @@ -214,6 +217,8 @@ void VDomDocument::Parse(Document::Enum parse, VMainGraphicsScene *scene, QCombo nameActivDraw.clear(); scene->clear(); comboBoxDraws->clear(); + } else { + data->ClearLengthLines(); } QDomElement rootElement = this->documentElement(); QDomNode domNode = rootElement.firstChild(); @@ -330,11 +335,6 @@ void VDomDocument::ParseCalculationElement(VMainGraphicsScene *scene, const QDom if(!domElement.isNull()){ if(domElement.tagName() == "point"){ ParsePointElement(scene, domElement, parse, domElement.attribute("type", "")); - qDebug()<addItem(spoint); + connect(spoint, &VToolSimplePoint::ChoosedPoint, scene, &VMainGraphicsScene::ChoosedItem); + } + } + } + } + if(type == "endLine"){ + if(!domElement.isNull()){ + QString name, typeLine, formula; + qreal mx=5, my=10; + qint64 id, basePointId; + qint32 angle; + if(!domElement.isNull()){ + id = domElement.attribute("id", "").toLongLong(); + name = domElement.attribute("name", ""); + mx = domElement.attribute("mx","").toDouble()*PrintDPI/25.4; + my = domElement.attribute("my","").toDouble()*PrintDPI/25.4; + + typeLine = domElement.attribute("typeLine", ""); + formula = domElement.attribute("length", ""); + basePointId = domElement.attribute("basePoint", "").toLongLong(); + angle = domElement.attribute("angle", "").toInt(); + + VPointF basePoint = data->GetPoint(basePointId); + QLineF line = QLineF(basePoint.toQPointF(), QPointF(basePoint.x()+100, basePoint.y())); + Calculator cal(data); + QString errorMsg; + qreal result = cal.eval(formula, &errorMsg); + if(errorMsg.isEmpty()){ + line.setLength(result*PrintDPI/25.4); + line.setAngle(angle); + data->UpdatePoint(id, VPointF(line.p2().x(), line.p2().y(), name, mx, my)); + if(parse == Document::FullParse){ + VToolEndLine *point = new VToolEndLine(this, data, id, typeLine, formula, angle, + basePointId, Tool::FromFile); + scene->addItem(point); + connect(point, &VToolPoint::ChoosedPoint, scene, &VMainGraphicsScene::ChoosedItem); + } } } }