2 #ifndef XGUI_ObjectsBrowser_H
3 #define XGUI_ObjectsBrowser_H
6 #include <ModuleBase_Definitions.h>
7 #include <ModelAPI_Object.h>
12 class XGUI_DocumentDataModel;
16 class XGUI_DataTree: public QTreeView
20 XGUI_DataTree(QWidget* theParent);
21 virtual ~XGUI_DataTree();
23 //! Returns list of currently selected features
24 QList<ObjectPtr> selectedFeatures() const { return mySelectedData; }
26 XGUI_DocumentDataModel* dataModel() const;
29 //! Emited when selection is changed
30 void selectionChanged();
31 void activePartChanged(FeaturePtr thePart);
33 //! Emited on context menu request
34 void contextMenuRequested(QContextMenuEvent* theEvent);
37 virtual void commitData(QWidget* theEditor);
40 virtual void mouseDoubleClickEvent(QMouseEvent* theEvent);
41 virtual void contextMenuEvent(QContextMenuEvent* theEvent);
44 //! Called when selection in Data Tree is changed
45 void onSelectionChanged(const QItemSelection& theSelected, const QItemSelection& theDeselected);
48 //! List of currently selected data
49 QList<ObjectPtr> mySelectedData;
53 /**\class XGUI_ObjectsBrowser
55 * \brief Object browser window object. Represents data tree of current data structure
57 class XGUI_EXPORT XGUI_ObjectsBrowser : public QWidget
61 XGUI_ObjectsBrowser(QWidget* theParent);
62 virtual ~XGUI_ObjectsBrowser();
64 //! Returns Model which provides access to data objects
65 XGUI_DocumentDataModel* dataModel() const { return myDocModel; }
67 //! Returns list of currently selected features
68 QList<ObjectPtr> selectedObjects() const { return myObjectsList; }
70 void setFeaturesSelected(const QFeatureList& theFeatures);
72 //! Returns currently selected indexes
73 QModelIndexList selectedIndexes() const { return myTreeView->selectionModel()->selectedIndexes(); }
75 //! Returns TreeView widget
76 XGUI_DataTree* treeView() const { return myTreeView; }
78 //! Activates currently selected part. Signal activePartChanged will not be sent
79 void activatePart(const FeaturePtr& thePart);
81 void rebuildDataTree();
84 //! Emited when selection is changed
85 void selectionChanged();
87 //! Emited when current active document is changed
88 void activePartChanged(FeaturePtr thePart);
90 //! Emited on context menu request
91 void contextMenuRequested(QContextMenuEvent* theEvent);
94 virtual bool eventFilter(QObject* obj, QEvent* theEvent);
97 void onActivePartChanged(FeaturePtr thePart);
98 void onContextMenuRequested(QContextMenuEvent* theEvent);
99 void onLabelContextMenuRequested(const QPoint& thePnt);
101 //! Called on Edit command request
104 void onSelectionChanged();
107 void closeDocNameEditing(bool toSave);
110 XGUI_DocumentDataModel* myDocModel;
112 QLineEdit* myActiveDocLbl;
113 XGUI_DataTree* myTreeView;
115 QList<ObjectPtr> myObjectsList;