45 #include <QHBoxLayout> 46 #include <QPushButton> 51 #include "objectSelectionWidget.hh" 52 #include "objectPickDialog.hh" 70 QHBoxLayout *hL =
new QHBoxLayout;
72 combo_ =
new QComboBox ();
73 pickButton_ =
new QPushButton (tr(
"Pick Object"));
75 hL->addWidget (combo_);
76 hL->setStretchFactor (combo_, 1);
77 hL->addWidget (pickButton_);
79 if (_hints.contains (
"flags"))
80 flags_ = _hints[
"flags"].split(
',');
82 if (_hints.contains (
"types"))
83 types_ = _hints[
"types"].split(
',');
85 if (flags_.contains(
"all", Qt::CaseInsensitive))
88 withGroups_ = types_.contains(
"Group");
90 if (types_.contains(
"All"))
95 connect (pickButton_, SIGNAL (pressed()),
this, SLOT (showPickDialog ()));
101 if (!flags_.empty ())
104 foreach (QString flag, flags_)
105 if (o_it->flag (flag))
115 if (!types_.empty ())
117 if (!types_.contains (
typeName (o_it->dataType())))
121 if (o_it->isGroup() && !withGroups_)
126 combo_->addItem (o_it->name() +
" (" + QString::number (o_it->id ()) +
")", QVariant (o_it->id()));
133 pickButton_->setEnabled (
false);
134 combo_->setEnabled (
false);
139 ObjectSelectionWidget::~ ObjectSelectionWidget()
142 o_it->setFlag(
"vsi_objectId_selected",
false);
148 void ObjectSelectionWidget::showPickDialog()
151 d.
selectedId (combo_->itemData (combo_->currentIndex()).toInt ());
153 if (d.exec () == QDialog::Accepted)
154 combo_->setCurrentIndex (combo_->findData (QVariant (d.
selectedId())));
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.
DLLEXPORT BaseObjectIterator baseObjectsEnd()
Return Iterator to Object End.
unsigned int selectedId()
Current selected object.
Core Data Iterator used to iterate over all objects (Including groups)