Go to the documentation of this file.
6#ifndef iqtgui_CCommandTools_included
7#define iqtgui_CCommandTools_included
11#include <QtCore/QtGlobal>
12#include <QtWidgets/QMenu>
13#include <QtWidgets/QMenuBar>
14#include <QtWidgets/QToolBar>
15#include <QtGui/QAction>
16#include <QtGui/QActionGroup>
37 template <
class MenuType>
47 int* counterPtr =
nullptr);
56 int* counterPtr =
nullptr);
62template <
class MenuType>
69 QMap<int, QActionGroup*> groups;
71 for (
int i = 0; i < childsCount; ++i){
72 QString text = command.text();
76 if (hierarchicalPtr !=
nullptr){
77 QString text2 = hierarchicalPtr->text();
82 result.addSeparator();
86 prevGroupId = groupId;
90 QMenu* newMenuPtr =
new QMenu(&result);
91 newMenuPtr->setTitle(hierarchicalPtr->
GetName());
95 result.addMenu(newMenuPtr);
99 QActionGroup*& groupPtr = groups[hierarchicalPtr->
GetGroupId()];
100 if (groupPtr ==
nullptr){
101 groupPtr =
new QActionGroup(&result);
102 groupPtr->setExclusive(
true);
105 groupPtr->addAction(hierarchicalPtr);
106 hierarchicalPtr->setCheckable(
true);
109 result.addAction(hierarchicalPtr);
@ CF_EXCLUSIVE
Enable exclusive selection of this command with other commands in the same node with the same group I...
@ CF_GLOBAL_MENU
Enable to use this command in global application menu.
const QString & GetName() const override
Get the object name.
Implementation of hierarchical command based on QAction from Qt.
int GetGroupId() const override
int GetStaticFlags() const override
ibase::ICommand * GetChild(int index) const override
Get child value.
int GetChildsCount() const override
Get number of childs.
Standard GUI specific interfaces and components based on Qt.
© Witold Gantzke and Kirill Lepskiy