6822a3be |
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 ViewControl_Tools_H |
17 | #define ViewControl_Tools_H |
18 | |
19 | #include <Standard.hxx> |
20 | #include <Standard_Macro.hxx> |
7e1c1e48 |
21 | #include <TCollection_AsciiString.hxx> |
6822a3be |
22 | |
23 | #include <Standard_WarningsDisable.hxx> |
24 | #include <QString> |
25 | #include <Standard_WarningsRestore.hxx> |
26 | |
7e1c1e48 |
27 | class ViewControl_TableModelValues; |
28 | |
6822a3be |
29 | class QAction; |
7e1c1e48 |
30 | class QItemSelectionModel; |
6822a3be |
31 | class QObject; |
7e1c1e48 |
32 | class QTableView; |
6822a3be |
33 | class QWidget; |
34 | |
35 | //! \class ViewControl_Tools |
36 | //! \brief The tool that gives auxiliary methods for qt elements manipulation |
37 | class ViewControl_Tools |
38 | { |
39 | public: |
7e1c1e48 |
40 | //! Returns text of separation row in table |
41 | //! \return string value |
42 | static QString TableSeparator() { return "---------------------------"; } |
6822a3be |
43 | |
44 | //! Creates an action with the given text connected to the slot |
45 | //! \param theText an action text value |
46 | //! \param theSlot a listener of triggered signal of the new action |
47 | //! \param theParent a parent object |
48 | //! \param theContext listener of the action toggle |
49 | //! \return a new action |
50 | Standard_EXPORT static QAction* CreateAction (const QString& theText, const char* theSlot, |
51 | QObject* theParent, QObject* theContext); |
52 | |
53 | //! Change palette of the widget to have white foreground |
54 | //! \param theControl a widget to be modified |
55 | Standard_EXPORT static void SetWhiteBackground (QWidget* theControl); |
56 | |
7e1c1e48 |
57 | //! Fills tree view by default sections parameters obtained in view's table model |
58 | //! \param theTableView table view instance |
59 | //! \param theOrientation header orientation |
60 | Standard_EXPORT static void SetDefaultHeaderSections (QTableView* theTableView, const Qt::Orientation theOrientation); |
61 | |
62 | //! Create table of values on the current selection |
63 | //! It is created if the selection contains only one item and it has a property item |
64 | Standard_EXPORT static ViewControl_TableModelValues* CreateTableModelValues (QItemSelectionModel* theSelectionModel); |
65 | |
6822a3be |
66 | }; |
67 | |
68 | #endif |