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