2 #ifndef XGUI_ObjectsBrowser_H
3 #define XGUI_ObjectsBrowser_H
6 #include <ModuleBase_Definitions.h>
11 class XGUI_DocumentDataModel;
15 class XGUI_DataTree: public QTreeView
19 XGUI_DataTree(QWidget* theParent);
20 virtual ~XGUI_DataTree();
22 //! Returns list of currently selected features
23 QFeatureList selectedFeatures() const { return mySelectedData; }
25 XGUI_DocumentDataModel* dataModel() const;
28 //! Emited when selection is changed
29 void selectionChanged();
30 void activePartChanged(FeaturePtr thePart);
32 //! Emited on context menu request
33 void contextMenuRequested(QContextMenuEvent* theEvent);
36 virtual void commitData(QWidget* theEditor);
39 virtual void mouseDoubleClickEvent(QMouseEvent* theEvent);
40 virtual void contextMenuEvent(QContextMenuEvent* theEvent);
43 //! Called when selection in Data Tree is changed
44 void onSelectionChanged(const QItemSelection& theSelected, const QItemSelection& theDeselected);
47 //! List of currently selected data
48 QFeatureList mySelectedData;
52 /**\class XGUI_ObjectsBrowser
54 * \brief Object browser window object. Represents data tree of current data structure
56 class XGUI_EXPORT XGUI_ObjectsBrowser : public QWidget
60 XGUI_ObjectsBrowser(QWidget* theParent);
61 virtual ~XGUI_ObjectsBrowser();
63 //! Returns Model which provides access to data objects
64 XGUI_DocumentDataModel* dataModel() const { return myDocModel; }
66 //! Returns list of currently selected features
67 QFeatureList selectedFeatures() const { return myFeaturesList; }
69 void setFeaturesSelected(const QFeatureList& theFeatures);
71 //! Returns currently selected indexes
72 QModelIndexList selectedIndexes() const { return myTreeView->selectionModel()->selectedIndexes(); }
74 //! Returns TreeView widget
75 XGUI_DataTree* treeView() const { return myTreeView; }
77 //! Activates currently selected part. Signal activePartChanged will not be sent
78 void activatePart(const FeaturePtr& thePart);
80 void rebuildDataTree();
83 //! Emited when selection is changed
84 void selectionChanged();
86 //! Emited when current active document is changed
87 void activePartChanged(FeaturePtr thePart);
89 //! Emited on context menu request
90 void contextMenuRequested(QContextMenuEvent* theEvent);
93 virtual bool eventFilter(QObject* obj, QEvent* theEvent);
96 void onActivePartChanged(FeaturePtr thePart);
97 void onContextMenuRequested(QContextMenuEvent* theEvent);
98 void onLabelContextMenuRequested(const QPoint& thePnt);
100 //! Called on Edit command request
103 void onSelectionChanged();
106 void closeDocNameEditing(bool toSave);
109 XGUI_DocumentDataModel* myDocModel;
111 QLineEdit* myActiveDocLbl;
112 XGUI_DataTree* myTreeView;
114 QFeatureList myFeaturesList;