本文整理汇总了C++中ActionContainer::appendGroup方法的典型用法代码示例。如果您正苦于以下问题:C++ ActionContainer::appendGroup方法的具体用法?C++ ActionContainer::appendGroup怎么用?C++ ActionContainer::appendGroup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ActionContainer
的用法示例。
在下文中一共展示了ActionContainer::appendGroup方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: registerDefaultActions
//.........这里部分代码省略.........
// Copy Action
icon = QIcon::fromTheme(QLatin1String("edit-copy"), Icons::COPY.icon());
tmpaction = new QAction(icon, tr("&Copy"), this);
cmd = ActionManager::registerAction(tmpaction, Constants::COPY);
cmd->setDefaultKeySequence(QKeySequence::Copy);
medit->addAction(cmd, Constants::G_EDIT_COPYPASTE);
tmpaction->setEnabled(false);
// Paste Action
icon = QIcon::fromTheme(QLatin1String("edit-paste"), Icons::PASTE.icon());
tmpaction = new QAction(icon, tr("&Paste"), this);
cmd = ActionManager::registerAction(tmpaction, Constants::PASTE);
cmd->setDefaultKeySequence(QKeySequence::Paste);
medit->addAction(cmd, Constants::G_EDIT_COPYPASTE);
tmpaction->setEnabled(false);
// Select All
icon = QIcon::fromTheme(QLatin1String("edit-select-all"));
tmpaction = new QAction(icon, tr("Select &All"), this);
cmd = ActionManager::registerAction(tmpaction, Constants::SELECTALL);
cmd->setDefaultKeySequence(QKeySequence::SelectAll);
medit->addAction(cmd, Constants::G_EDIT_SELECTALL);
tmpaction->setEnabled(false);
// Goto Action
icon = QIcon::fromTheme(QLatin1String("go-jump"));
tmpaction = new QAction(icon, tr("&Go to Line..."), this);
cmd = ActionManager::registerAction(tmpaction, Constants::GOTO);
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+L")));
medit->addAction(cmd, Constants::G_EDIT_OTHER);
tmpaction->setEnabled(false);
// Options Action
mtools->appendGroup(Constants::G_TOOLS_OPTIONS);
mtools->addSeparator(Constants::G_TOOLS_OPTIONS);
m_optionsAction = new QAction(tr("&Options..."), this);
m_optionsAction->setMenuRole(QAction::PreferencesRole);
cmd = ActionManager::registerAction(m_optionsAction, Constants::OPTIONS);
cmd->setDefaultKeySequence(QKeySequence::Preferences);
mtools->addAction(cmd, Constants::G_TOOLS_OPTIONS);
connect(m_optionsAction, SIGNAL(triggered()), this, SLOT(showOptionsDialog()));
mwindow->addSeparator(Constants::G_WINDOW_LIST);
if (UseMacShortcuts) {
// Minimize Action
QAction *minimizeAction = new QAction(tr("Minimize"), this);
minimizeAction->setEnabled(false); // actual implementation in WindowSupport
cmd = ActionManager::registerAction(minimizeAction, Constants::MINIMIZE_WINDOW);
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+M")));
mwindow->addAction(cmd, Constants::G_WINDOW_SIZE);
// Zoom Action
QAction *zoomAction = new QAction(tr("Zoom"), this);
zoomAction->setEnabled(false); // actual implementation in WindowSupport
cmd = ActionManager::registerAction(zoomAction, Constants::ZOOM_WINDOW);
mwindow->addAction(cmd, Constants::G_WINDOW_SIZE);
}
// Full Screen Action
QAction *toggleFullScreenAction = new QAction(tr("Full Screen"), this);
toggleFullScreenAction->setCheckable(!HostOsInfo::isMacHost());
toggleFullScreenAction->setEnabled(false); // actual implementation in WindowSupport
cmd = ActionManager::registerAction(toggleFullScreenAction, Constants::TOGGLE_FULLSCREEN);
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Ctrl+Meta+F") : tr("Ctrl+Shift+F11")));
示例2: registerDefaultContainers
void MainWindow::registerDefaultContainers()
{
ActionContainer *menubar = ActionManager::createMenuBar(Constants::MENU_BAR);
if (!HostOsInfo::isMacHost()) // System menu bar on Mac
setMenuBar(menubar->menuBar());
menubar->appendGroup(Constants::G_FILE);
menubar->appendGroup(Constants::G_EDIT);
menubar->appendGroup(Constants::G_VIEW);
menubar->appendGroup(Constants::G_TOOLS);
menubar->appendGroup(Constants::G_WINDOW);
menubar->appendGroup(Constants::G_HELP);
// File Menu
ActionContainer *filemenu = ActionManager::createMenu(Constants::M_FILE);
menubar->addMenu(filemenu, Constants::G_FILE);
filemenu->menu()->setTitle(tr("&File"));
filemenu->appendGroup(Constants::G_FILE_NEW);
filemenu->appendGroup(Constants::G_FILE_OPEN);
filemenu->appendGroup(Constants::G_FILE_PROJECT);
filemenu->appendGroup(Constants::G_FILE_SAVE);
filemenu->appendGroup(Constants::G_FILE_CLOSE);
filemenu->appendGroup(Constants::G_FILE_PRINT);
filemenu->appendGroup(Constants::G_FILE_OTHER);
connect(filemenu->menu(), &QMenu::aboutToShow, this, &MainWindow::aboutToShowRecentFiles);
// Edit Menu
ActionContainer *medit = ActionManager::createMenu(Constants::M_EDIT);
menubar->addMenu(medit, Constants::G_EDIT);
medit->menu()->setTitle(tr("&Edit"));
medit->appendGroup(Constants::G_EDIT_UNDOREDO);
medit->appendGroup(Constants::G_EDIT_COPYPASTE);
medit->appendGroup(Constants::G_EDIT_SELECTALL);
medit->appendGroup(Constants::G_EDIT_ADVANCED);
medit->appendGroup(Constants::G_EDIT_FIND);
medit->appendGroup(Constants::G_EDIT_OTHER);
// Tools Menu
ActionContainer *ac = ActionManager::createMenu(Constants::M_TOOLS);
menubar->addMenu(ac, Constants::G_TOOLS);
ac->menu()->setTitle(tr("&Tools"));
// Window Menu
ActionContainer *mwindow = ActionManager::createMenu(Constants::M_WINDOW);
menubar->addMenu(mwindow, Constants::G_WINDOW);
mwindow->menu()->setTitle(tr("&Window"));
mwindow->appendGroup(Constants::G_WINDOW_SIZE);
mwindow->appendGroup(Constants::G_WINDOW_VIEWS);
mwindow->appendGroup(Constants::G_WINDOW_PANES);
mwindow->appendGroup(Constants::G_WINDOW_SPLIT);
mwindow->appendGroup(Constants::G_WINDOW_NAVIGATE);
mwindow->appendGroup(Constants::G_WINDOW_LIST);
mwindow->appendGroup(Constants::G_WINDOW_OTHER);
// Help Menu
ac = ActionManager::createMenu(Constants::M_HELP);
menubar->addMenu(ac, Constants::G_HELP);
ac->menu()->setTitle(tr("&Help"));
ac->appendGroup(Constants::G_HELP_HELP);
ac->appendGroup(Constants::G_HELP_SUPPORT);
ac->appendGroup(Constants::G_HELP_ABOUT);
ac->appendGroup(Constants::G_HELP_UPDATES);
}
示例3: init
void OutputPaneManager::init()
{
ActionContainer *mwindow = ActionManager::actionContainer(Constants::M_WINDOW);
// Window->Output Panes
ActionContainer *mpanes = ActionManager::createMenu(Constants::M_WINDOW_PANES);
mwindow->addMenu(mpanes, Constants::G_WINDOW_PANES);
mpanes->menu()->setTitle(tr("Output &Panes"));
mpanes->appendGroup("Coreplugin.OutputPane.ActionsGroup");
mpanes->appendGroup("Coreplugin.OutputPane.PanesGroup");
Command *cmd;
cmd = ActionManager::registerAction(m_clearAction, "Coreplugin.OutputPane.clear");
m_clearButton->setDefaultAction(cmd->action());
m_clearButton->setIcon(Icons::CLEAN_TOOLBAR.icon());
mpanes->addAction(cmd, "Coreplugin.OutputPane.ActionsGroup");
cmd = ActionManager::registerAction(m_prevAction, "Coreplugin.OutputPane.previtem");
cmd->setDefaultKeySequence(QKeySequence(tr("Shift+F6")));
m_prevToolButton->setDefaultAction(
ProxyAction::proxyActionWithIcon(cmd->action(), Utils::Icons::PREV_TOOLBAR.icon()));
mpanes->addAction(cmd, "Coreplugin.OutputPane.ActionsGroup");
cmd = ActionManager::registerAction(m_nextAction, "Coreplugin.OutputPane.nextitem");
m_nextToolButton->setDefaultAction(
ProxyAction::proxyActionWithIcon(cmd->action(), Utils::Icons::NEXT_TOOLBAR.icon()));
cmd->setDefaultKeySequence(QKeySequence(tr("F6")));
mpanes->addAction(cmd, "Coreplugin.OutputPane.ActionsGroup");
cmd = ActionManager::registerAction(m_minMaxAction, "Coreplugin.OutputPane.minmax");
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Ctrl+Shift+9") : tr("Alt+Shift+9")));
cmd->setAttribute(Command::CA_UpdateText);
cmd->setAttribute(Command::CA_UpdateIcon);
mpanes->addAction(cmd, "Coreplugin.OutputPane.ActionsGroup");
connect(m_minMaxAction, &QAction::triggered, this, &OutputPaneManager::toggleMaximized);
m_minMaxButton->setDefaultAction(cmd->action());
mpanes->addSeparator("Coreplugin.OutputPane.ActionsGroup");
QFontMetrics titleFm = m_titleLabel->fontMetrics();
int minTitleWidth = 0;
m_panes = ExtensionSystem::PluginManager::getObjects<IOutputPane>();
Utils::sort(m_panes, [](IOutputPane *p1, IOutputPane *p2) {
return p1->priorityInStatusBar() > p2->priorityInStatusBar();
});
const int n = m_panes.size();
int shortcutNumber = 1;
const Id baseId = "QtCreator.Pane.";
for (int i = 0; i != n; ++i) {
IOutputPane *outPane = m_panes.at(i);
const int idx = m_outputWidgetPane->addWidget(outPane->outputWidget(this));
QTC_CHECK(idx == i);
connect(outPane, &IOutputPane::showPage, this, [this, outPane](int flags) {
showPage(findIndexForPage(outPane), flags);
});
connect(outPane, &IOutputPane::hidePage, this, &OutputPaneManager::slotHide);
connect(outPane, &IOutputPane::togglePage, this, &OutputPaneManager::togglePage);
connect(outPane, &IOutputPane::navigateStateUpdate,
this, &OutputPaneManager::updateNavigateState);
connect(outPane, &IOutputPane::flashButton, this, &OutputPaneManager::flashButton);
connect(outPane, &IOutputPane::setBadgeNumber, this, &OutputPaneManager::setBadgeNumber);
QWidget *toolButtonsContainer = new QWidget(m_opToolBarWidgets);
QHBoxLayout *toolButtonsLayout = new QHBoxLayout;
toolButtonsLayout->setMargin(0);
toolButtonsLayout->setSpacing(0);
foreach (QWidget *toolButton, outPane->toolBarWidgets())
toolButtonsLayout->addWidget(toolButton);
toolButtonsLayout->addStretch(5);
toolButtonsContainer->setLayout(toolButtonsLayout);
m_opToolBarWidgets->addWidget(toolButtonsContainer);
minTitleWidth = qMax(minTitleWidth, titleFm.width(outPane->displayName()));
QString suffix = outPane->displayName().simplified();
suffix.remove(QLatin1Char(' '));
const Id id = baseId.withSuffix(suffix);
QAction *action = new QAction(outPane->displayName(), this);
Command *cmd = ActionManager::registerAction(action, id);
mpanes->addAction(cmd, "Coreplugin.OutputPane.PanesGroup");
m_actions.append(action);
m_ids.append(id);
cmd->setDefaultKeySequence(paneShortCut(shortcutNumber));
OutputPaneToggleButton *button = new OutputPaneToggleButton(shortcutNumber, outPane->displayName(),
cmd->action());
++shortcutNumber;
m_buttonsWidget->layout()->addWidget(button);
m_buttons.append(button);
connect(button, &QAbstractButton::clicked, this, [this, button]() {
buttonTriggered(m_buttons.indexOf(button));
});
bool visible = outPane->priorityInStatusBar() != -1;
//.........这里部分代码省略.........
示例4: init
void OutputPaneManager::init()
{
ActionContainer *mwindow = ActionManager::actionContainer(Constants::M_WINDOW);
const Context globalContext(Constants::C_GLOBAL);
// Window->Output Panes
ActionContainer *mpanes = ActionManager::createMenu(Constants::M_WINDOW_PANES);
mwindow->addMenu(mpanes, Constants::G_WINDOW_PANES);
mpanes->menu()->setTitle(tr("Output &Panes"));
mpanes->appendGroup("Coreplugin.OutputPane.ActionsGroup");
mpanes->appendGroup("Coreplugin.OutputPane.PanesGroup");
Command *cmd;
cmd = ActionManager::registerAction(m_clearAction, "Coreplugin.OutputPane.clear", globalContext);
m_clearButton->setDefaultAction(cmd->action());
mpanes->addAction(cmd, "Coreplugin.OutputPane.ActionsGroup");
cmd = ActionManager::registerAction(m_prevAction, "Coreplugin.OutputPane.previtem", globalContext);
cmd->setDefaultKeySequence(QKeySequence(tr("Shift+F6")));
m_prevToolButton->setDefaultAction(cmd->action());
mpanes->addAction(cmd, "Coreplugin.OutputPane.ActionsGroup");
cmd = ActionManager::registerAction(m_nextAction, "Coreplugin.OutputPane.nextitem", globalContext);
m_nextToolButton->setDefaultAction(cmd->action());
cmd->setDefaultKeySequence(QKeySequence(tr("F6")));
mpanes->addAction(cmd, "Coreplugin.OutputPane.ActionsGroup");
cmd = ActionManager::registerAction(m_minMaxAction, "Coreplugin.OutputPane.minmax", globalContext);
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Ctrl+9") : tr("Alt+9")));
cmd->setAttribute(Command::CA_UpdateText);
cmd->setAttribute(Command::CA_UpdateIcon);
mpanes->addAction(cmd, "Coreplugin.OutputPane.ActionsGroup");
connect(m_minMaxAction, SIGNAL(triggered()), this, SLOT(slotMinMax()));
m_minMaxButton->setDefaultAction(cmd->action());
mpanes->addSeparator(globalContext, "Coreplugin.OutputPane.ActionsGroup");
QFontMetrics titleFm = m_titleLabel->fontMetrics();
int minTitleWidth = 0;
m_panes = ExtensionSystem::PluginManager::getObjects<IOutputPane>();
qSort(m_panes.begin(), m_panes.end(), &comparePanes);
const int n = m_panes.size();
int shortcutNumber = 1;
const Id baseId = "QtCreator.Pane.";
for (int i = 0; i != n; ++i) {
IOutputPane *outPane = m_panes.at(i);
const int idx = m_outputWidgetPane->addWidget(outPane->outputWidget(this));
QTC_CHECK(idx == i);
connect(outPane, SIGNAL(showPage(int)), this, SLOT(showPage(int)));
connect(outPane, SIGNAL(hidePage()), this, SLOT(slotHide()));
connect(outPane, SIGNAL(togglePage(int)), this, SLOT(togglePage(int)));
connect(outPane, SIGNAL(navigateStateUpdate()), this, SLOT(updateNavigateState()));
connect(outPane, SIGNAL(flashButton()), this, SLOT(flashButton()));
connect(outPane, SIGNAL(setBadgeNumber(int)), this, SLOT(setBadgeNumber(int)));
QWidget *toolButtonsContainer = new QWidget(m_opToolBarWidgets);
QHBoxLayout *toolButtonsLayout = new QHBoxLayout;
toolButtonsLayout->setMargin(0);
toolButtonsLayout->setSpacing(0);
foreach (QWidget *toolButton, outPane->toolBarWidgets())
toolButtonsLayout->addWidget(toolButton);
toolButtonsLayout->addStretch(5);
toolButtonsContainer->setLayout(toolButtonsLayout);
m_opToolBarWidgets->addWidget(toolButtonsContainer);
minTitleWidth = qMax(minTitleWidth, titleFm.width(outPane->displayName()));
QString suffix = outPane->displayName().simplified();
suffix.remove(QLatin1Char(' '));
const Id id = baseId.withSuffix(suffix);
QAction *action = new QAction(outPane->displayName(), this);
Command *cmd = ActionManager::registerAction(action, id, globalContext);
mpanes->addAction(cmd, "Coreplugin.OutputPane.PanesGroup");
m_actions.append(action);
m_ids.append(id);
cmd->setDefaultKeySequence(QKeySequence(paneShortCut(shortcutNumber)));
OutputPaneToggleButton *button = new OutputPaneToggleButton(shortcutNumber, outPane->displayName(),
cmd->action());
++shortcutNumber;
m_buttonsWidget->layout()->addWidget(button);
m_buttons.append(button);
connect(button, SIGNAL(clicked()), this, SLOT(buttonTriggered()));
bool visible = outPane->priorityInStatusBar() != -1;
button->setVisible(visible);
connect(action, SIGNAL(triggered()), this, SLOT(shortcutTriggered()));
}
m_titleLabel->setMinimumWidth(minTitleWidth + m_titleLabel->contentsMargins().left()
+ m_titleLabel->contentsMargins().right());
m_buttonsWidget->layout()->addWidget(m_manageButton);
connect(m_manageButton, SIGNAL(clicked()), this, SLOT(popupMenu()));
//.........这里部分代码省略.........
示例5: QWidget
OutputPaneManager::OutputPaneManager(QWidget *parent) :
QWidget(parent),
m_titleLabel(new QLabel),
m_manageButton(new OutputPaneManageButton),
m_closeButton(new QToolButton),
m_minMaxAction(0),
m_minMaxButton(new QToolButton),
m_nextAction(0),
m_prevAction(0),
m_outputWidgetPane(new QStackedWidget),
m_opToolBarWidgets(new QStackedWidget),
m_minimizeIcon(Utils::Icons::ARROW_DOWN.icon()),
m_maximizeIcon(Utils::Icons::ARROW_UP.icon()),
m_outputPaneHeightSetting(0)
{
setWindowTitle(tr("Output"));
m_titleLabel->setContentsMargins(5, 0, 5, 0);
m_clearAction = new QAction(this);
m_clearAction->setIcon(Utils::Icons::CLEAN.icon());
m_clearAction->setText(tr("Clear"));
connect(m_clearAction, &QAction::triggered, this, &OutputPaneManager::clearPage);
m_nextAction = new QAction(this);
m_nextAction->setIcon(Utils::Icons::NEXT.icon());
m_nextAction->setText(tr("Next Item"));
connect(m_nextAction, &QAction::triggered, this, &OutputPaneManager::slotNext);
m_prevAction = new QAction(this);
m_prevAction->setIcon(Utils::Icons::PREV.icon());
m_prevAction->setText(tr("Previous Item"));
connect(m_prevAction, &QAction::triggered, this, &OutputPaneManager::slotPrev);
m_minMaxAction = new QAction(this);
m_minMaxAction->setIcon(m_maximizeIcon);
m_minMaxAction->setText(tr("Maximize Output Pane"));
m_closeButton->setIcon(Icons::CLOSE_SPLIT_BOTTOM.icon());
connect(m_closeButton, &QAbstractButton::clicked, this, &OutputPaneManager::slotHide);
connect(ICore::instance(), &ICore::saveSettingsRequested, this, &OutputPaneManager::saveSettings);
QVBoxLayout *mainlayout = new QVBoxLayout;
mainlayout->setSpacing(0);
mainlayout->setMargin(0);
m_toolBar = new StyledBar;
QHBoxLayout *toolLayout = new QHBoxLayout(m_toolBar);
toolLayout->setMargin(0);
toolLayout->setSpacing(0);
toolLayout->addWidget(m_titleLabel);
toolLayout->addWidget(new StyledSeparator);
m_clearButton = new QToolButton;
toolLayout->addWidget(m_clearButton);
m_prevToolButton = new QToolButton;
toolLayout->addWidget(m_prevToolButton);
m_nextToolButton = new QToolButton;
toolLayout->addWidget(m_nextToolButton);
toolLayout->addWidget(m_opToolBarWidgets);
toolLayout->addWidget(m_minMaxButton);
toolLayout->addWidget(m_closeButton);
mainlayout->addWidget(m_toolBar);
mainlayout->addWidget(m_outputWidgetPane, 10);
mainlayout->addWidget(new FindToolBarPlaceHolder(this));
setLayout(mainlayout);
m_buttonsWidget = new QWidget;
m_buttonsWidget->setLayout(new QHBoxLayout);
m_buttonsWidget->layout()->setContentsMargins(5,0,0,0);
m_buttonsWidget->layout()->setSpacing(
creatorTheme()->flag(Theme::FlatToolBars) ? 9 : 4);
StatusBarManager::addStatusBarWidget(m_buttonsWidget, StatusBarManager::Second);
ActionContainer *mwindow = ActionManager::actionContainer(Constants::M_WINDOW);
// Window->Output Panes
ActionContainer *mpanes = ActionManager::createMenu(Constants::M_WINDOW_PANES);
mwindow->addMenu(mpanes, Constants::G_WINDOW_PANES);
mpanes->menu()->setTitle(tr("Output &Panes"));
mpanes->appendGroup("Coreplugin.OutputPane.ActionsGroup");
mpanes->appendGroup("Coreplugin.OutputPane.PanesGroup");
Command *cmd;
cmd = ActionManager::registerAction(m_clearAction, "Coreplugin.OutputPane.clear");
m_clearButton->setDefaultAction(cmd->action());
m_clearButton->setIcon(Utils::Icons::CLEAN_TOOLBAR.icon());
mpanes->addAction(cmd, "Coreplugin.OutputPane.ActionsGroup");
cmd = ActionManager::registerAction(m_prevAction, "Coreplugin.OutputPane.previtem");
cmd->setDefaultKeySequence(QKeySequence(tr("Shift+F6")));
m_prevToolButton->setDefaultAction(
ProxyAction::proxyActionWithIcon(cmd->action(), Utils::Icons::PREV_TOOLBAR.icon()));
mpanes->addAction(cmd, "Coreplugin.OutputPane.ActionsGroup");
cmd = ActionManager::registerAction(m_nextAction, "Coreplugin.OutputPane.nextitem");
m_nextToolButton->setDefaultAction(
ProxyAction::proxyActionWithIcon(cmd->action(), Utils::Icons::NEXT_TOOLBAR.icon()));
cmd->setDefaultKeySequence(QKeySequence(tr("F6")));
//.........这里部分代码省略.........