2 #ifndef XGUI_ObjectsBrowser_H
3 #define XGUI_ObjectsBrowser_H
6 #include "XGUI_Constants.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 //! Returns currently selected indexes
70 QModelIndexList selectedIndexes() const { return myTreeView->selectionModel()->selectedIndexes(); }
72 //! Returns TreeView widget
73 XGUI_DataTree* treeView() const { return myTreeView; }
75 //! Activates currently selected part. Signal activePartChanged will not be sent
76 void activatePart(const FeaturePtr& thePart);
78 void rebuildDataTree();
81 //! Emited when selection is changed
82 void selectionChanged();
84 //! Emited when current active document is changed
85 void activePartChanged(FeaturePtr thePart);
87 //! Emited on context menu request
88 void contextMenuRequested(QContextMenuEvent* theEvent);
91 virtual bool eventFilter(QObject* obj, QEvent* theEvent);
94 void onActivePartChanged(FeaturePtr thePart);
95 void onContextMenuRequested(QContextMenuEvent* theEvent);
96 void onLabelContextMenuRequested(const QPoint& thePnt);
98 //! Called on Edit command request
101 void onSelectionChanged();
104 void closeDocNameEditing(bool toSave);
107 XGUI_DocumentDataModel* myDocModel;
109 QLineEdit* myActiveDocLbl;
110 XGUI_DataTree* myTreeView;
112 QFeatureList myFeaturesList;