51 #include <QHBoxLayout> 52 #include <QPushButton> 57 #include "objectSelectionWidget.hh" 58 #include "objectPickDialog.hh" 76 QHBoxLayout *hL =
new QHBoxLayout;
78 combo_ =
new QComboBox ();
79 pickButton_ =
new QPushButton (tr(
"Pick Object"));
81 hL->addWidget (combo_);
82 hL->setStretchFactor (combo_, 1);
83 hL->addWidget (pickButton_);
85 if (_hints.contains (
"flags"))
86 flags_ = _hints[
"flags"].split(
',');
88 if (_hints.contains (
"types"))
89 types_ = _hints[
"types"].split(
',');
91 if (flags_.contains(
"all", Qt::CaseInsensitive))
94 withGroups_ = types_.contains(
"Group");
96 if (types_.contains(
"All"))
101 connect (pickButton_, SIGNAL (pressed()),
this, SLOT (showPickDialog ()));
107 if (!flags_.empty ())
110 foreach (QString flag, flags_)
111 if (o_it->flag (flag))
121 if (!types_.empty ())
123 if (!types_.contains (
typeName (o_it->dataType())))
127 if (o_it->isGroup() && !withGroups_)
132 combo_->addItem (o_it->name() +
" (" + QString::number (o_it->id ()) +
")", QVariant (o_it->id()));
139 pickButton_->setEnabled (
false);
140 combo_->setEnabled (
false);
148 o_it->setFlag(
"vsi_objectId_selected",
false);
154 void ObjectSelectionWidget::showPickDialog()
157 d.
selectedId (combo_->itemData (combo_->currentIndex()).toInt ());
159 if (d.exec () == QDialog::Accepted)
160 combo_->setCurrentIndex (combo_->findData (QVariant (d.
selectedId())));
DLLEXPORT BaseObjectIterator baseObjectsEnd()
Return Iterator to Object End.
unsigned int selectedId()
Current selected object.
ObjectSelectionWidget(QMap< QString, QString > &_hints, QString _typeName, QWidget *_parent=NULL)
Constructor.
DLLEXPORT QString typeName(DataType _id)
Get the name of a type with given id.
Core Data Iterator used to iterate over all objects (Including groups)
~ObjectSelectionWidget()
Destructor.