X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FXGUI%2FXGUI_ObjectsBrowser.h;h=ebcaffe08ef30deee9dfd8b56a8cf1e295f5d7a3;hb=ed165fd07e71c11885fdc5f475a8522a5914e00d;hp=fd1adbed8b1cc6b1852fecc7e96706b1fb9fc00a;hpb=80a21be87c81ef61f0842b32e8b2ac7d4359acb4;p=modules%2Fshaper.git diff --git a/src/XGUI/XGUI_ObjectsBrowser.h b/src/XGUI/XGUI_ObjectsBrowser.h index fd1adbed8..ebcaffe08 100644 --- a/src/XGUI/XGUI_ObjectsBrowser.h +++ b/src/XGUI/XGUI_ObjectsBrowser.h @@ -1,55 +1,134 @@ - #ifndef XGUI_ObjectsBrowser_H #define XGUI_ObjectsBrowser_H #include "XGUI.h" -#include "XGUI_Constants.h" +#include +#include +#include +#include +#include #include class XGUI_DocumentDataModel; +class QLineEdit; + +class XGUI_DataTree : public QTreeView +{ +Q_OBJECT + public: + XGUI_DataTree(QWidget* theParent); + virtual ~XGUI_DataTree(); + + //! Returns list of currently selected objects + QList selectedObjects() const + { + return mySelectedData; + } + + XGUI_DocumentDataModel* dataModel() const; + +signals: + //! Emited when selection is changed + void selectionChanged(); + void activePartChanged(ObjectPtr thePart); + + //! Emited on context menu request + void contextMenuRequested(QContextMenuEvent* theEvent); + + protected slots: + virtual void commitData(QWidget* theEditor); + + protected: + virtual void mouseDoubleClickEvent(QMouseEvent* theEvent); + virtual void contextMenuEvent(QContextMenuEvent* theEvent); + + private slots: + //! Called when selection in Data Tree is changed + void onSelectionChanged(const QItemSelection& theSelected, const QItemSelection& theDeselected); + + private: + //! List of currently selected data + QList mySelectedData; +}; /**\class XGUI_ObjectsBrowser * \ingroup GUI * \brief Object browser window object. Represents data tree of current data structure */ - class XGUI_EXPORT XGUI_ObjectsBrowser : public QTreeView +class XGUI_EXPORT XGUI_ObjectsBrowser : public QWidget { - Q_OBJECT -public: +Q_OBJECT + public: XGUI_ObjectsBrowser(QWidget* theParent); virtual ~XGUI_ObjectsBrowser(); //! Returns Model which provides access to data objects - XGUI_DocumentDataModel* dataModel() const { return myDocModel; } + XGUI_DocumentDataModel* dataModel() const + { + return myDocModel; + } + + //! Returns list of currently selected objects + QList selectedObjects() const + { + return myObjectsList; + } + + void setObjectsSelected(const QList& theObjects); - //! Returns list of currently selected features - QFeatureList selectedFeatures() const { return mySelectedData; } + //! Returns currently selected indexes + QModelIndexList selectedIndexes() const + { + return myTreeView->selectionModel()->selectedIndexes(); + } + + //! Returns TreeView widget + XGUI_DataTree* treeView() const + { + return myTreeView; + } + + //! Activates currently selected part. Signal activePartChanged will not be sent + void activatePart(const ResultPartPtr& thePart); + + void rebuildDataTree(); + + void processEvent(const boost::shared_ptr& theMessage); signals: //! Emited when selection is changed void selectionChanged(); - void activePartChanged(FeaturePtr thePart); - + + //! Emited when current active document is changed + void activePartChanged(ObjectPtr thePart); + //! Emited on context menu request void contextMenuRequested(QContextMenuEvent* theEvent); -protected: - virtual void mouseDoubleClickEvent(QMouseEvent* theEvent); - virtual void contextMenuEvent(QContextMenuEvent* theEvent); + protected: + virtual bool eventFilter(QObject* obj, QEvent* theEvent); -private slots: - //! Called when selection in Data Tree is changed - void onSelectionChanged(const QItemSelection& theSelected, const QItemSelection& theDeselected); + private slots: + void onActivePartChanged(ObjectPtr thePart); + void onContextMenuRequested(QContextMenuEvent* theEvent); + void onLabelContextMenuRequested(const QPoint& thePnt); + + //! Called on Edit command request + void onEditItem(); + + void onSelectionChanged(); + + private: + void closeDocNameEditing(bool toSave); -private: //! Internal model XGUI_DocumentDataModel* myDocModel; - //! List of currently selected data - QFeatureList mySelectedData; + QLineEdit* myActiveDocLbl; + XGUI_DataTree* myTreeView; - //QModelIndex myActivePartIndex; + QList myObjectsList; }; -#endif \ No newline at end of file +#endif