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 View_Tools_H |
17 | #define View_Tools_H |
18 | |
19 | #include <Standard.hxx> |
20 | #include <Standard_Macro.hxx> |
21 | |
22 | #include <Standard_WarningsDisable.hxx> |
23 | #include <QMap> |
24 | #include <QString> |
25 | #include <Standard_WarningsRestore.hxx> |
26 | |
27 | class View_Window; |
28 | |
29 | class QAction; |
30 | class QObject; |
31 | |
32 | //! \class View_Tools |
33 | //! \brief The tool that gives auxiliary methods for qt elements manipulation |
34 | class View_Tools |
35 | { |
36 | public: |
37 | |
38 | //! Creates an action with the given text connected to the slot |
39 | //! \param theText an action text value |
40 | //! \param theSlot a listener of triggered signal of the new action |
41 | //! \param theParent a parent object |
42 | //! \param theContext listener of the action toggle |
43 | //! \return a new action |
44 | Standard_EXPORT static QAction* CreateAction (const QString& theText, const char* theSlot, |
45 | QObject* theParent, QObject* theContext); |
46 | |
47 | //! Save state of three view in a container in form: key, value. It saves: |
48 | //! - visibiblity of columns, |
49 | //! - columns width |
50 | //! \param theTreeView a view instance |
51 | //! \param theItems [out] properties |
52 | //! \param thePrefix peference item prefix |
53 | Standard_EXPORT static void SaveState (View_Window* theView, QMap<QString, QString>& theItems, |
54 | const QString& thePrefix = QString()); |
55 | //! Restore state of three view by a container |
56 | //! \param theTreeView a view instance |
57 | //! \param theKey property key |
58 | //! \param theValue property value |
59 | //! \param thePrefix peference item prefix |
60 | //! \return boolean value whether the property is applyed to the tree view |
61 | Standard_EXPORT static bool RestoreState (View_Window* theView, const QString& theKey, const QString& theValue, |
62 | const QString& thePrefix = QString()); |
63 | }; |
64 | |
65 | #endif |