51 #include <QHBoxLayout> 52 #include <QPushButton> 54 #include <QMouseEvent> 57 #include <OpenFlipper/widgets/glWidget/simpleViewer.hh> 58 #include <OpenFlipper/widgets/glWidget/QtBaseViewer.hh> 60 #include "objectPickDialog.hh" 61 #include "TreeModel.hh" 77 QHBoxLayout *hL =
new QHBoxLayout;
78 QHBoxLayout *bL =
new QHBoxLayout;
79 QVBoxLayout *vL =
new QVBoxLayout;
83 treeView_ =
new QTreeView;
84 treeView_->setModel (model_);
85 treeView_->resizeColumnToContents (0);
86 treeView_->setSelectionMode (QAbstractItemView::SingleSelection);
87 treeView_->setSelectionBehavior (QAbstractItemView::SelectRows);
92 okButton_ =
new QPushButton (tr(
"OK"));
93 cancelButton_ =
new QPushButton (tr(
"Cancel"));
95 connect (okButton_, SIGNAL (pressed()),
this, SLOT (accept()));
96 connect (cancelButton_, SIGNAL (pressed()),
this, SLOT (reject()));
98 hL->addWidget (viewer_);
99 hL->setStretchFactor (viewer_, 1);
100 hL->addWidget (treeView_);
103 bL->addWidget (okButton_);
104 bL->addWidget (cancelButton_);
113 setWindowTitle(tr(
"Click on object or select from list..."));
115 connect (treeView_, SIGNAL (activated(
const QModelIndex& )),
116 this, SLOT (activated(
const QModelIndex&)));
117 connect (viewer_->
viewer(), SIGNAL (signalMouseEventClick(QMouseEvent*,
bool)),
118 this, SLOT (slotMouseEventClick(QMouseEvent*,
bool)));
124 if (!_flags.empty ())
127 foreach (QString flag, _flags)
128 if (o_it->flag (flag))
138 if (!_types.empty ())
140 if (!_types.contains (
typeName (o_it->dataType())))
144 if (o_it->isGroup() && !_withGroups)
163 o_it->setFlag(
"vsi_objectId_selected",
false);
171 void ObjectPickDialog::activated(
const QModelIndex & _index)
173 if (_index.isValid()) {
185 void ObjectPickDialog::slotMouseEventClick(QMouseEvent * _event,
bool )
187 unsigned int nodeIdx, targetIdx;
196 if (!obj->
flag (
"vsi_objectId_disabled"))
223 obj2->
setFlag (
"vsi_objectId_selected",
false);
225 setForGroup (obj2,
"vsi_objectId_selected",
false);
227 obj->
setFlag (
"vsi_objectId_selected",
true);
229 setForGroup (obj,
"vsi_objectId_selected",
true);
239 void VSI::ObjectPickDialog::setForGroup(
BaseObject *_obj, QString _flag,
bool _enabled)
242 if (o_it->id () == _obj->
id ())
244 if (o_it->isInGroup (_obj->
id ()))
246 o_it->setFlag(_flag, _enabled);
248 setForGroup (o_it, _flag, _enabled);
BaseObject *& objectRoot()
Get the root of the object structure.
QModelIndex getModelIndex(TreeItem *_object, int _column)
Return the ModelIndex corresponding to a given TreeItem and Column.
~ObjectPickDialog()
Destructor.
bool pick(ACG::SceneGraph::PickTarget _pickTarget, const QPoint &_mousePos, unsigned int &_nodeIdx, unsigned int &_targetIdx, ACG::Vec3d *_hitPointPtr=0)
Viewer::ViewerProperties & properties()
Viewer properties.
bool getObject(int _identifier, BSplineCurveObject *&_object)
DLLEXPORT BaseObjectIterator baseObjectsEnd()
Return Iterator to Object End.
void objectMarker(ViewObjectMarker *_marker)
set object marker for viewer
bool getPickedObject(const unsigned int _node_idx, BaseObjectData *&_object)
Get the picked mesh.
ObjectPickDialog(QStringList _flags, QStringList _types, bool _withGroups)
Constructor.
unsigned int selectedId()
Current selected object.
void objectAdded(BaseObject *_object)
The object with the given id has been added. add it to the internal tree.
bool isGroup() const
Check if object is a group.
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)
pick any of the prior targets (should be implemented for all nodes)
virtual void updateGL()
Redraw scene. Triggers paint event for updating the view (cf. drawNow()).
void setFlag(QString _flag, bool _set)
glViewer * viewer()
Viewer.