Refactoring.
--HG-- branch : feature
This commit is contained in:
parent
e30d1fe9dd
commit
2610487fe5
|
@ -85,27 +85,19 @@ void DialogAlongLine::ChoosedObject(quint32 id, const Scene::Scenes &type)
|
||||||
{
|
{
|
||||||
if (type == Scene::Point)
|
if (type == Scene::Point)
|
||||||
{
|
{
|
||||||
const VPointF *point = data->GeometricObject<const VPointF *>(id);
|
|
||||||
if (number == 0)
|
if (number == 0)
|
||||||
{
|
{
|
||||||
qint32 index = ui->comboBoxFirstPoint->findText(point->name());
|
if (ChoosedPoint(id, ui->comboBoxFirstPoint, tr("Select second point of line")))
|
||||||
if ( index != -1 )
|
{
|
||||||
{ // -1 for not found
|
|
||||||
ui->comboBoxFirstPoint->setCurrentIndex(index);
|
|
||||||
number++;
|
number++;
|
||||||
emit ToolTip(tr("Select second point of line"));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (number == 1)
|
if (number == 1)
|
||||||
{
|
{
|
||||||
qint32 index = ui->comboBoxSecondPoint->findText(point->name());
|
if (ChoosedPoint(id, ui->comboBoxSecondPoint, ""))
|
||||||
if ( index != -1 )
|
{
|
||||||
{ // -1 for not found
|
|
||||||
ui->comboBoxSecondPoint->setCurrentIndex(index);
|
|
||||||
number = 0;
|
number = 0;
|
||||||
emit ToolTip("");
|
|
||||||
}
|
|
||||||
if (isInitialized == false)
|
if (isInitialized == false)
|
||||||
{
|
{
|
||||||
this->show();
|
this->show();
|
||||||
|
@ -113,6 +105,7 @@ void DialogAlongLine::ChoosedObject(quint32 id, const Scene::Scenes &type)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void DialogAlongLine::DialogAccepted()
|
void DialogAlongLine::DialogAccepted()
|
||||||
{
|
{
|
||||||
|
|
|
@ -102,27 +102,19 @@ void DialogNormal::ChoosedObject(quint32 id, const Scene::Scenes &type)
|
||||||
{
|
{
|
||||||
if (type == Scene::Point)
|
if (type == Scene::Point)
|
||||||
{
|
{
|
||||||
const VPointF *point = data->GeometricObject<const VPointF *>(id);
|
|
||||||
if (number == 0)
|
if (number == 0)
|
||||||
{
|
{
|
||||||
qint32 index = ui->comboBoxFirstPoint->findText(point->name());
|
if (ChoosedPoint(id, ui->comboBoxFirstPoint, tr("Select second point of line")))
|
||||||
if ( index != -1 )
|
{
|
||||||
{ // -1 for not found
|
|
||||||
ui->comboBoxFirstPoint->setCurrentIndex(index);
|
|
||||||
number++;
|
number++;
|
||||||
emit ToolTip(tr("Select second point of line"));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (number == 1)
|
if (number == 1)
|
||||||
{
|
{
|
||||||
qint32 index = ui->comboBoxSecondPoint->findText(point->name());
|
if (ChoosedPoint(id, ui->comboBoxSecondPoint, ""))
|
||||||
if ( index != -1 )
|
{
|
||||||
{ // -1 for not found
|
|
||||||
ui->comboBoxSecondPoint->setCurrentIndex(index);
|
|
||||||
number = 0;
|
number = 0;
|
||||||
emit ToolTip("");
|
|
||||||
}
|
|
||||||
if (isInitialized == false)
|
if (isInitialized == false)
|
||||||
{
|
{
|
||||||
this->show();
|
this->show();
|
||||||
|
@ -130,6 +122,7 @@ void DialogNormal::ChoosedObject(quint32 id, const Scene::Scenes &type)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void DialogNormal::DialogAccepted()
|
void DialogNormal::DialogAccepted()
|
||||||
{
|
{
|
||||||
|
|
|
@ -384,6 +384,21 @@ quint32 DialogTool::getCurrentObjectId(QComboBox *box) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool DialogTool::ChoosedPoint(const quint32 &id, QComboBox *box, const QString &toolTip)
|
||||||
|
{
|
||||||
|
Q_CHECK_PTR(box);
|
||||||
|
const VPointF *point = data->GeometricObject<const VPointF *>(id);
|
||||||
|
Q_CHECK_PTR(point);
|
||||||
|
const qint32 index = box->findText(point->name());
|
||||||
|
if ( index != -1 )
|
||||||
|
{ // -1 for not found
|
||||||
|
box->setCurrentIndex(index);
|
||||||
|
emit ToolTip(toolTip);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void DialogTool::FillList(QComboBox *box, const QMap<QString, quint32> &list) const
|
void DialogTool::FillList(QComboBox *box, const QMap<QString, quint32> &list) const
|
||||||
{
|
{
|
||||||
Q_CHECK_PTR(box);
|
Q_CHECK_PTR(box);
|
||||||
|
|
|
@ -398,6 +398,7 @@ protected:
|
||||||
* @return id or -1 if combobox is empty
|
* @return id or -1 if combobox is empty
|
||||||
*/
|
*/
|
||||||
quint32 getCurrentObjectId(QComboBox *box) const;
|
quint32 getCurrentObjectId(QComboBox *box) const;
|
||||||
|
bool ChoosedPoint(const quint32 &id, QComboBox *box, const QString &toolTip);
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
* @brief FillList fill combobox list
|
* @brief FillList fill combobox list
|
||||||
|
|
Loading…
Reference in New Issue
Block a user