Fixed issue #39.

--HG--
branch : develop
This commit is contained in:
dismine 2014-01-05 22:56:18 +02:00
parent a623bd5311
commit c655600694
2 changed files with 26 additions and 8 deletions

View file

@ -66,9 +66,9 @@ void DialogTool::showEvent(QShowEvent *event)
void DialogTool::FillComboBoxPoints(QComboBox *box, const qint64 &id) const
{
Q_ASSERT(box != 0);
box->clear();
const QHash<qint64, VGObject*> *objs = data->DataGObjects();
QHashIterator<qint64, VGObject*> i(*objs);
QMap<QString, qint64> list;
while (i.hasNext())
{
i.next();
@ -78,18 +78,19 @@ void DialogTool::FillComboBoxPoints(QComboBox *box, const qint64 &id) const
if (obj->getType() == GObject::Point && obj->getMode() == Draw::Calculation)
{
const VPointF *point = data->GeometricObject<const VPointF *>(i.key());
box->addItem(point->name(), i.key());
list[point->name()] = i.key();
}
}
}
FillList(box, list);
}
void DialogTool::FillComboBoxSplines(QComboBox *box, const qint64 &id, ComboMode::ComboBoxCutSpline cut) const
{
Q_ASSERT(box != 0);
box->clear();
const QHash<qint64, VGObject *> *objs = data->DataGObjects();
QHashIterator<qint64, VGObject*> i(*objs);
QMap<QString, qint64> list;
while (i.hasNext())
{
i.next();
@ -101,7 +102,7 @@ void DialogTool::FillComboBoxSplines(QComboBox *box, const qint64 &id, ComboMode
if (obj->getType() == GObject::Spline && obj->getMode() == Draw::Calculation)
{
const VSpline *spl = data->GeometricObject<const VSpline *>(i.key());
box->addItem(spl->name(), i.key());
list[spl->name()] = i.key();
}
}
}
@ -113,19 +114,20 @@ void DialogTool::FillComboBoxSplines(QComboBox *box, const qint64 &id, ComboMode
if (obj->getType() == GObject::Spline && obj->getMode() == Draw::Calculation)
{
const VSpline *spl = data->GeometricObject<const VSpline *>(i.key());
box->addItem(spl->name(), i.key());
list[spl->name()] = i.key();
}
}
}
}
FillList(box, list);
}
void DialogTool::FillComboBoxSplinesPath(QComboBox *box, const qint64 &id, ComboMode::ComboBoxCutSpline cut) const
{
Q_ASSERT(box != 0);
box->clear();
const QHash<qint64, VGObject *> *objs = data->DataGObjects();
QHashIterator<qint64, VGObject *> i(*objs);
QMap<QString, qint64> list;
while (i.hasNext())
{
i.next();
@ -137,7 +139,7 @@ void DialogTool::FillComboBoxSplinesPath(QComboBox *box, const qint64 &id, Combo
if (obj->getType() == GObject::SplinePath && obj->getMode() == Draw::Calculation)
{
const VSplinePath *splPath = data->GeometricObject<const VSplinePath *>(i.key());
box->addItem(splPath->name(), i.key());
list[splPath->name()] = i.key();
}
}
}
@ -149,11 +151,12 @@ void DialogTool::FillComboBoxSplinesPath(QComboBox *box, const qint64 &id, Combo
if (obj->getType() == GObject::SplinePath && obj->getMode() == Draw::Calculation)
{
const VSplinePath *splPath = data->GeometricObject<const VSplinePath *>(i.key());
box->addItem(splPath->name(), i.key());
list[splPath->name()] = i.key();
}
}
}
}
FillList(box, list);
}
void DialogTool::FillComboBoxTypeLine(QComboBox *box) const
@ -322,6 +325,19 @@ qint64 DialogTool::getCurrentObjectId(QComboBox *box) const
}
}
void DialogTool::FillList(QComboBox *box, const QMap<QString, qint64> &list) const
{
Q_ASSERT(box != 0);
box->clear();
QMapIterator<QString, qint64> iter(list);
while (iter.hasNext())
{
iter.next();
box->addItem(iter.key(), iter.value());
}
}
void DialogTool::CheckState()
{
Q_ASSERT(bOk != 0);

View file

@ -368,6 +368,8 @@ protected:
* @return id or -1 if combobox is empty
*/
qint64 getCurrentObjectId(QComboBox *box) const;
private:
void FillList(QComboBox *box, const QMap<QString, qint64> &list)const;
};
#endif // DIALOGTOOL_H