SHAPER 9.16.0
XGUI_ContextMenuMgr.h
1// Copyright (C) 2014-2026 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 XGUI_ContextMenuMgr_H
21#define XGUI_ContextMenuMgr_H
22
23#include "XGUI.h"
24
25#include <QObject>
26#include <QMap>
27
28class XGUI_Workshop;
29class QAction;
30class QContextMenuEvent;
31class QMenu;
32class QActionGroup;
33
38class XGUI_EXPORT XGUI_ContextMenuMgr : public QObject
39{
40Q_OBJECT
41 public:
45 virtual ~XGUI_ContextMenuMgr();
46
48 void createActions();
49
52 QAction* action(const QString& theId) const;
53
56 QAction* actionByName(const QString& theName) const;
57
59 QStringList actionIds() const;
60
62 void updateCommandsStatus();
63
65 void connectObjectBrowser();
66
68 void connectViewer();
69
71 void connectConstraintsBrowser();
72
74 void addObjBrowserMenu(QMenu*) const;
75
77 void addConstrBrowserMenu(QMenu*) const;
78
80 void addViewerMenu(QMenu*) const;
81
85 QStringList actionObjectGroups(const QString& theName);
86
88 void updateObjectBrowserMenu();
89
91 void updateViewerMenu();
92
93signals:
97 void actionTriggered(const QString& theId, bool isChecked);
98
101
104
105 private slots:
108 void onAction(bool isChecked);
109
112 void onContextMenuRequest(QContextMenuEvent* theEvent);
113
114 void onRename();
115
117 void onResultSelection(bool theChecked);
118
120 void onShapeSelection(bool theChecked);
121
122 private:
128 void addAction(const QString& theId, QAction* theAction);
129
130 void addFeatures(QMenu* theMenu) const;
131
133 void buildObjBrowserMenu();
134
136 void buildConstrBrowserMenu();
137
139 void buildViewerMenu();
140
142 QMap<QString, QAction*> myActions;
143
145 XGUI_Workshop* myWorkshop;
146
147 typedef QList<QAction*> QActionsList;
148 QMap<std::string, QActionsList> myObjBrowserMenus;
149 QMap<std::string, QActionsList> myViewerMenu;
150
151 //QActionGroup* mySelectActions;
152
153 QAction* mySeparator1;
154 QAction* mySeparator2;
155 QAction* mySeparator3;
156 QAction* mySeparator4;
157};
158
159#endif
A class which manages the context menu.
Definition: XGUI_ContextMenuMgr.h:39
void actionTriggered(const QString &theId, bool isChecked)
Signal aabout triggered action.
void afterContextMenu()
A signal which is sent after context menu show.
void beforeContextMenu()
A signal which is sent before context menu show.
Class which defines a configuration of the application (Workshop) and launches it.
Definition: XGUI_Workshop.h:83