SHAPER  9.15.0
ModuleBase_ActionInfo.h
1 // Copyright (C) 2014-2025 CEA, EDF
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 
20 #ifndef MODULEBASE_ACTIONINFO_H_
21 #define MODULEBASE_ACTIONINFO_H_
22 
23 #include <ModuleBase.h>
24 #include <Config_FeatureMessage.h>
25 
26 #include <QAction>
27 #include <QIcon>
28 #include <QKeySequence>
29 #include <QFont>
30 
31 #include <memory>
32 
36 struct MODULEBASE_EXPORT ModuleBase_ActionInfo
37 {
38  QString id;
39  QString workbenchID;
40 
41  bool checkable;
42  bool checked;
43  bool enabled;
44  bool visible;
45 
47  bool modal;
48  QIcon icon;
49  QString text;
50  QString iconText;
51  QString iconFile;
52  QString toolTip;
53  QString toolBar;
54  // QString statusTip;
55  // QString whatsThis;
56  QKeySequence shortcut;
57  QFont font;
58 
59  public:
63  ModuleBase_ActionInfo(const QString &text);
65  ModuleBase_ActionInfo(const QIcon &icon, const QString &text);
66  virtual ~ModuleBase_ActionInfo() = default;
67 
69  void initFrom(QAction* theAction);
71  void initFrom(std::shared_ptr<Config_FeatureMessage> theFeatureMessage);
72 
73  protected:
75  void initDefault();
76 
77 public:
79  QString toString() const;
80 };
81 
83 
84 #endif /* XGUI_ACTIONINFO_H_ */
Definition: ModuleBase_ActionInfo.h:37
QString toolTip
action's tooltip
Definition: ModuleBase_ActionInfo.h:52
QString workbenchID
Workbench's language-independent ID.
Definition: ModuleBase_ActionInfo.h:39
bool enabled
action's enabled state
Definition: ModuleBase_ActionInfo.h:43
bool visible
action's visibility state
Definition: ModuleBase_ActionInfo.h:44
QString text
action's text
Definition: ModuleBase_ActionInfo.h:49
bool checked
action's checked state
Definition: ModuleBase_ActionInfo.h:42
QString iconFile
path to icon's file. Can not be initialized from QAction
Definition: ModuleBase_ActionInfo.h:51
QString iconText
action's descriptive icon text
Definition: ModuleBase_ActionInfo.h:50
QString toolBar
A name of toolbar. By default = group of features name.
Definition: ModuleBase_ActionInfo.h:53
QKeySequence shortcut
action's primary shortcut key
Definition: ModuleBase_ActionInfo.h:56
bool checkable
action's checkable state
Definition: ModuleBase_ActionInfo.h:41
QIcon icon
action's icon
Definition: ModuleBase_ActionInfo.h:48
bool modal
= true if the acton is a modal dialog box else property panel (==false by default)
Definition: ModuleBase_ActionInfo.h:47
QString id
action's (command) id
Definition: ModuleBase_ActionInfo.h:38
QFont font
action's text font
Definition: ModuleBase_ActionInfo.h:57