0029018: Documentation - Provide user guide for Qt browser
[occt.git] / tools / DFBrowser / DFBrowser_TreeLevelView.hxx
CommitLineData
14bbbdcb 1// Created on: 2017-06-16
2// Created by: Natalia ERMOLAEVA
3// Copyright (c) 2017 OPEN CASCADE SAS
4//
5// This file is part of Open CASCADE Technology software library.
6//
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.
12//
13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
15
16#ifndef DFBrowser_TreeLevelView_H
17#define DFBrowser_TreeLevelView_H
18
0cb512c0 19#include <inspector/TreeModel_ItemBase.hxx>
20
14bbbdcb 21#include <Standard.hxx>
14bbbdcb 22
23#include <QObject>
24#include <QItemSelection>
25
26class QWidget;
27class QTableView;
28
29//! \class DFBrowser_TreeLevelView
30//! This is a control to visualize the current selected item of OCAF tree view in table view.
31//! The table contains two colums: name and value. The information is similar the one OCAF tree view label
32//! content: children and attributes for the current label. Selection or double click of item emits
33//! signals about this event.
34class DFBrowser_TreeLevelView : public QObject
35{
36 Q_OBJECT
37public:
38
39 //! Constructor
40 Standard_EXPORT DFBrowser_TreeLevelView (QWidget* theParent);
41
42 //! Destructor
43 virtual ~DFBrowser_TreeLevelView() Standard_OVERRIDE {}
44
45 //! Returns parent control
46 QWidget* GetControl() const { return myMainWindow; }
47
48 //! Clear selection of the table view selection model
49 Standard_EXPORT void ClearSelection();
50
51 //! Returns true if this control may be filled by the index
52 //! It is possible if an item of the index is application, document or label
53 //! \param theIndex OCAF tree view model index
54 //! \return boolean result
55 Standard_EXPORT static bool ProcessItem (const QModelIndex& theIndex);
56
57 //! Init view by the first selected item in OCAF tree view
58 //! \param theSelected selected items
59 //! \param theDeselected deselected items
60 Standard_EXPORT void UpdateByTreeSelectionChanged (const QItemSelection& theSelected,
61 const QItemSelection& theDeselected);
62
63signals:
64
65 //! Signal about selection of an item in tree view
66 //! \param theIndex a tree view model index of selected item
67 void indexSelected (const QModelIndex& theIndex);
68
69 //! Signal about double click on an item in tree view
70 //! \param theIndex a tree view model index of selected item
71 void indexDoubleClicked (const QModelIndex& theIndex);
72
73private slots:
74
75 //! Listens table view selection model. Gets the first selected tree view model index and emit indexSelected signal.
76 //! \param theSelected a list of selected items
77 //! \param theDeselected a list of deselected items
78 void onTableSelectionChanged (const QItemSelection& theSelected, const QItemSelection& theDeselected);
79
80 //! Listens table view double click. Gets clicked index and emit indexDoubleClicked signal.
81 //! \param theIndex a tree view model index of selected item
82 void onTableDoubleClicked (const QModelIndex& theIndex);
83
84private:
85
86 QWidget* myMainWindow; //!< parent control
87 QTableView* myTableView; //!< current view
88};
89#endif