1 // Created on: 2017-06-16
2 // Created by: Natalia ERMOLAEVA
3 // Copyright (c) 2017 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #ifndef DFBrowser_TreeLevelView_H
17 #define DFBrowser_TreeLevelView_H
19 #include <Standard.hxx>
20 #include <TreeModel_ItemBase.hxx>
23 #include <QItemSelection>
28 //! \class DFBrowser_TreeLevelView
29 //! This is a control to visualize the current selected item of OCAF tree view in table view.
30 //! The table contains two colums: name and value. The information is similar the one OCAF tree view label
31 //! content: children and attributes for the current label. Selection or double click of item emits
32 //! signals about this event.
33 class DFBrowser_TreeLevelView : public QObject
39 Standard_EXPORT DFBrowser_TreeLevelView (QWidget* theParent);
42 virtual ~DFBrowser_TreeLevelView() Standard_OVERRIDE {}
44 //! Returns parent control
45 QWidget* GetControl() const { return myMainWindow; }
47 //! Clear selection of the table view selection model
48 Standard_EXPORT void ClearSelection();
50 //! Returns true if this control may be filled by the index
51 //! It is possible if an item of the index is application, document or label
52 //! \param theIndex OCAF tree view model index
53 //! \return boolean result
54 Standard_EXPORT static bool ProcessItem (const QModelIndex& theIndex);
56 //! Init view by the first selected item in OCAF tree view
57 //! \param theSelected selected items
58 //! \param theDeselected deselected items
59 Standard_EXPORT void UpdateByTreeSelectionChanged (const QItemSelection& theSelected,
60 const QItemSelection& theDeselected);
64 //! Signal about selection of an item in tree view
65 //! \param theIndex a tree view model index of selected item
66 void indexSelected (const QModelIndex& theIndex);
68 //! Signal about double click on an item in tree view
69 //! \param theIndex a tree view model index of selected item
70 void indexDoubleClicked (const QModelIndex& theIndex);
74 //! Listens table view selection model. Gets the first selected tree view model index and emit indexSelected signal.
75 //! \param theSelected a list of selected items
76 //! \param theDeselected a list of deselected items
77 void onTableSelectionChanged (const QItemSelection& theSelected, const QItemSelection& theDeselected);
79 //! Listens table view double click. Gets clicked index and emit indexDoubleClicked signal.
80 //! \param theIndex a tree view model index of selected item
81 void onTableDoubleClicked (const QModelIndex& theIndex);
85 QWidget* myMainWindow; //!< parent control
86 QTableView* myTableView; //!< current view