本文整理汇总了C++中ActionManager::command方法的典型用法代码示例。如果您正苦于以下问题:C++ ActionManager::command方法的具体用法?C++ ActionManager::command怎么用?C++ ActionManager::command使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ActionManager
的用法示例。
在下文中一共展示了ActionManager::command方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
QList <QAction *> QmlProfilerTool::profilerContextMenuActions()
{
QList <QAction *> commonActions;
ActionManager *manager = ActionManager::instance();
if (manager) {
Command *command = manager->command(Constants::QmlProfilerLoadActionId);
if (command)
commonActions << command->action();
command = manager->command(Constants::QmlProfilerSaveActionId);
if (command)
commonActions << command->action();
}
return commonActions;
}
示例2: QComboBox
/*!
Mimic the look of the text editor toolbar as defined in e.g. EditorView::EditorView
*/
EditorToolBar::EditorToolBar(QWidget *parent) :
Utils::StyledBar(parent),
m_editorList(new QComboBox(this)),
m_closeButton(new QToolButton),
m_lockButton(new QToolButton),
m_goBackAction(new QAction(QIcon(QLatin1String(":/help/images/previous.png")), EditorManager::tr("Go Back"), parent)),
m_goForwardAction(new QAction(QIcon(QLatin1String(":/help/images/next.png")), EditorManager::tr("Go Forward"), parent)),
m_activeToolBar(0),
m_toolBarPlaceholder(new QWidget),
m_defaultToolBar(new QWidget(this)),
m_isStandalone(false)
{
QHBoxLayout *toolBarLayout = new QHBoxLayout(this);
toolBarLayout->setMargin(0);
toolBarLayout->setSpacing(0);
toolBarLayout->addWidget(m_defaultToolBar);
m_toolBarPlaceholder->setLayout(toolBarLayout);
m_toolBarPlaceholder->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
m_defaultToolBar->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
m_activeToolBar = m_defaultToolBar;
m_editorsListModel = EditorManager::instance()->openedEditorsModel();
connect(m_goBackAction, SIGNAL(triggered()), this, SIGNAL(goBackClicked()));
connect(m_goForwardAction, SIGNAL(triggered()), this, SIGNAL(goForwardClicked()));
m_editorList->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
m_editorList->setMinimumContentsLength(20);
m_editorList->setModel(m_editorsListModel);
m_editorList->setMaxVisibleItems(40);
m_editorList->setContextMenuPolicy(Qt::CustomContextMenu);
m_lockButton->setAutoRaise(true);
m_lockButton->setProperty("type", QLatin1String("dockbutton"));
m_lockButton->setVisible(false);
m_closeButton->setAutoRaise(true);
m_closeButton->setIcon(QIcon(":/core/images/closebutton.png"));
m_closeButton->setProperty("type", QLatin1String("dockbutton"));
m_closeButton->setEnabled(false);
m_toolBarPlaceholder->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
m_backButton = new QToolButton(this);
m_backButton->setDefaultAction(m_goBackAction);
m_forwardButton= new QToolButton(this);
m_forwardButton->setDefaultAction(m_goForwardAction);
QHBoxLayout *toplayout = new QHBoxLayout(this);
toplayout->setSpacing(0);
toplayout->setMargin(0);
toplayout->addWidget(m_backButton);
toplayout->addWidget(m_forwardButton);
toplayout->addWidget(m_editorList);
toplayout->addWidget(m_toolBarPlaceholder, 1); // Custom toolbar stretches
toplayout->addWidget(m_lockButton);
toplayout->addWidget(m_closeButton);
setLayout(toplayout);
// this signal is disconnected for standalone toolbars and replaced with
// a private slot connection
connect(m_editorList, SIGNAL(activated(int)), this, SIGNAL(listSelectionActivated(int)));
connect(m_editorList, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(listContextMenu(QPoint)));
connect(m_lockButton, SIGNAL(clicked()), this, SLOT(makeEditorWritable()));
connect(m_closeButton, SIGNAL(clicked()), this, SLOT(closeView()), Qt::QueuedConnection);
ActionManager *am = ICore::instance()->actionManager();
connect(am->command(Constants::CLOSE), SIGNAL(keySequenceChanged()),
this, SLOT(updateActionShortcuts()));
connect(am->command(Constants::GO_BACK), SIGNAL(keySequenceChanged()),
this, SLOT(updateActionShortcuts()));
connect(am->command(Constants::GO_FORWARD), SIGNAL(keySequenceChanged()),
this, SLOT(updateActionShortcuts()));
}