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 DFBrowserPane_AttributePaneSelector_H |
17 | #define DFBrowserPane_AttributePaneSelector_H |
18 | |
19 | #include <Standard.hxx> |
20 | |
21 | #ifdef _MSC_VER |
22 | #pragma warning(disable : 4127) // conditional expression is constant |
23 | #endif |
24 | |
25 | #include <QObject> |
26 | #include <QItemSelection> |
27 | #include <list> |
28 | |
29 | class QItemSelectionModel; |
30 | |
31 | //! \class DFBrowserPane_AttributePaneSelector |
32 | //! \brief Container of active selection models. It connects to selection changed signal of the models and |
33 | //! emits one signal for any selection. |
34 | class DFBrowserPane_AttributePaneSelector : public QObject |
35 | { |
36 | Q_OBJECT |
37 | public: |
38 | |
39 | //! Constructor |
40 | Standard_EXPORT DFBrowserPane_AttributePaneSelector(QObject* theParent); |
41 | |
42 | //! Destructor |
43 | Standard_EXPORT virtual ~DFBrowserPane_AttributePaneSelector(); |
44 | |
45 | //! Fills the pane selection by the given models. Disconnect it from the previous model and connect to new models |
46 | //! \param theModels a list of selection models |
47 | Standard_EXPORT void SetCurrentSelectionModels(const std::list<QItemSelectionModel*>& theModels); |
48 | |
49 | //! Clears selection in all selection models using block for selection changed flag |
50 | Standard_EXPORT void ClearSelected(); |
51 | |
52 | signals: |
53 | |
54 | //! Signal about selection changed in the model |
55 | //! \param theSelected selected items |
56 | //! \param theDeselected deselected items |
57 | //! \param theModel a selection model where the selection happens |
58 | void tableSelectionChanged (const QItemSelection& theSelected, const QItemSelection& theDeselected, |
59 | QItemSelectionModel* theModel); |
60 | protected slots: |
61 | |
62 | //! Listens selectionChanged() of the model and emits signal tableSelectionChanged filled with the selection model |
63 | //! \param theSelected selected items |
64 | //! \param theDeselected deselected items |
65 | void onTableSelectionChanged (const QItemSelection& theSelected, const QItemSelection& theDeselected); |
66 | |
67 | private: |
68 | |
69 | std::list<QItemSelectionModel*> mySelectionModels; //!< container of selection models |
70 | bool mySendSelectionChangeBlocked; //!< flag is selection processing should not performed, avoid cyclic dependency |
71 | }; |
72 | |
73 | #endif |