0029310: Coding - multiple compiler warnings in Inspectors
[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
130eb114 23#include <Standard_WarningsDisable.hxx>
14bbbdcb 24#include <QObject>
25#include <QItemSelection>
130eb114 26#include <Standard_WarningsRestore.hxx>
14bbbdcb 27
28class QWidget;
29class QTableView;
30
31//! \class DFBrowser_TreeLevelView
32//! This is a control to visualize the current selected item of OCAF tree view in table view.
33//! The table contains two colums: name and value. The information is similar the one OCAF tree view label
34//! content: children and attributes for the current label. Selection or double click of item emits
35//! signals about this event.
36class DFBrowser_TreeLevelView : public QObject
37{
38 Q_OBJECT
39public:
40
41 //! Constructor
42 Standard_EXPORT DFBrowser_TreeLevelView (QWidget* theParent);
43
44 //! Destructor
45 virtual ~DFBrowser_TreeLevelView() Standard_OVERRIDE {}
46
47 //! Returns parent control
48 QWidget* GetControl() const { return myMainWindow; }
49
50 //! Clear selection of the table view selection model
51 Standard_EXPORT void ClearSelection();
52
53 //! Returns true if this control may be filled by the index
54 //! It is possible if an item of the index is application, document or label
55 //! \param theIndex OCAF tree view model index
56 //! \return boolean result
57 Standard_EXPORT static bool ProcessItem (const QModelIndex& theIndex);
58
59 //! Init view by the first selected item in OCAF tree view
60 //! \param theSelected selected items
61 //! \param theDeselected deselected items
62 Standard_EXPORT void UpdateByTreeSelectionChanged (const QItemSelection& theSelected,
63 const QItemSelection& theDeselected);
64
65signals:
66
67 //! Signal about selection of an item in tree view
68 //! \param theIndex a tree view model index of selected item
69 void indexSelected (const QModelIndex& theIndex);
70
71 //! Signal about double click on an item in tree view
72 //! \param theIndex a tree view model index of selected item
73 void indexDoubleClicked (const QModelIndex& theIndex);
74
75private slots:
76
77 //! Listens table view selection model. Gets the first selected tree view model index and emit indexSelected signal.
78 //! \param theSelected a list of selected items
79 //! \param theDeselected a list of deselected items
80 void onTableSelectionChanged (const QItemSelection& theSelected, const QItemSelection& theDeselected);
81
82 //! Listens table view double click. Gets clicked index and emit indexDoubleClicked signal.
83 //! \param theIndex a tree view model index of selected item
84 void onTableDoubleClicked (const QModelIndex& theIndex);
85
86private:
87
88 QWidget* myMainWindow; //!< parent control
89 QTableView* myTableView; //!< current view
90};
91#endif