diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index ac479a756..4a6a513d1 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -648,8 +648,7 @@ void MainWindow::ToolBarOption() comboBoxGrow->addItems(list); comboBoxGrow->setCurrentIndex(14); ui->toolBarOption->addWidget(comboBoxGrow); - connect(comboBoxGrow, - static_cast(&QComboBox::currentIndexChanged), + connect(comboBoxGrow, static_cast(&QComboBox::currentIndexChanged), this, &MainWindow::ChangedGrowth); QLabel * labelSize = new QLabel; @@ -663,8 +662,7 @@ void MainWindow::ToolBarOption() comboBoxSize->addItems(list); comboBoxSize->setCurrentIndex(14); ui->toolBarOption->addWidget(comboBoxSize); - connect(comboBoxSize, - static_cast(&QComboBox::currentIndexChanged), + connect(comboBoxSize, static_cast(&QComboBox::currentIndexChanged), this, &MainWindow::ChangedSize); ui->toolBarOption->addSeparator(); @@ -707,6 +705,9 @@ void MainWindow::currentDrawChanged( int index ) { doc->setCurrentData(); doc->ChangeActivDraw(comboBoxDraws->itemText(index)); + qint64 id = doc->SPointActiveDraw(); + const VPointF *p = pattern->GeometricObject(id); + view->centerOn(p->toQPointF()); } } @@ -896,6 +897,7 @@ void MainWindow::ActionDraw(bool checked) verScrollBar->setValue(currentScene->getVerScrollBar()); mode = Draw::Calculation; + comboBoxDraws->setEnabled(true); comboBoxDraws->setCurrentIndex(currentDrawIndex);//restore current pattern peace SetEnableTool(true); @@ -929,6 +931,7 @@ void MainWindow::ActionDetails(bool checked) currentDrawIndex = comboBoxDraws->currentIndex();//save current pattern peace comboBoxDraws->setCurrentIndex(comboBoxDraws->count()-1); + comboBoxDraws->setEnabled(false); mode = Draw::Modeling; SetEnableTool(true); diff --git a/src/xml/vdomdocument.cpp b/src/xml/vdomdocument.cpp index 2a1dd5f8e..631402833 100644 --- a/src/xml/vdomdocument.cpp +++ b/src/xml/vdomdocument.cpp @@ -486,6 +486,32 @@ qreal VDomDocument::GetParametrDouble(const QDomElement &domElement, const QStri return param; } +qint64 VDomDocument::SPointActiveDraw() +{ + QDomElement calcElement; + bool ok = GetActivCalculationElement(calcElement); + if (ok) + { + QDomNode domNode = calcElement.firstChild(); + if (domNode.isNull() == false) + { + if (domNode.isElement()) + { + QDomElement domElement = domNode.toElement(); + if (domElement.isNull() == false) + { + if (domElement.tagName() == VToolPoint::TagName && + domElement.attribute("type", "") == VToolSinglePoint::ToolType) + { + return GetParametrId(domElement); + } + } + } + } + } + return 0; +} + void VDomDocument::TestUniqueId() const { QVector vector; diff --git a/src/xml/vdomdocument.h b/src/xml/vdomdocument.h index 493223779..fefcbccec 100644 --- a/src/xml/vdomdocument.h +++ b/src/xml/vdomdocument.h @@ -225,6 +225,7 @@ public: * @return */ qreal GetParametrDouble(const QDomElement& domElement, const QString &name, const QString &defValue) const; + qint64 SPointActiveDraw(); signals: /** * @brief ChangedActivDraw