Scrolls the contents of the viewport to ensure that the active pattern peace is

centered in the view.

--HG--
branch : develop
This commit is contained in:
dismine 2014-01-09 16:56:53 +02:00
parent 5ee1969f24
commit 12424ddad0
3 changed files with 34 additions and 4 deletions

View File

@ -648,8 +648,7 @@ void MainWindow::ToolBarOption()
comboBoxGrow->addItems(list);
comboBoxGrow->setCurrentIndex(14);
ui->toolBarOption->addWidget(comboBoxGrow);
connect(comboBoxGrow,
static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
connect(comboBoxGrow, static_cast<void (QComboBox::*)(const QString &)>(&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<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
connect(comboBoxSize, static_cast<void (QComboBox::*)(const QString &)>(&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<const VPointF *>(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);

View File

@ -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<qint64> vector;

View File

@ -225,6 +225,7 @@ public:
* @return
*/
qreal GetParametrDouble(const QDomElement& domElement, const QString &name, const QString &defValue) const;
qint64 SPointActiveDraw();
signals:
/**
* @brief ChangedActivDraw