本文整理汇总了C++中QAction::setActionGroup方法的典型用法代码示例。如果您正苦于以下问题:C++ QAction::setActionGroup方法的具体用法?C++ QAction::setActionGroup怎么用?C++ QAction::setActionGroup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QAction
的用法示例。
在下文中一共展示了QAction::setActionGroup方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QFrame
BreakpointsWindow::BreakpointsWindow(running_machine* machine, QWidget* parent) :
WindowQt(machine, nullptr)
{
setWindowTitle("Debug: All Breakpoints");
if (parent != nullptr)
{
QPoint parentPos = parent->pos();
setGeometry(parentPos.x()+100, parentPos.y()+100, 800, 400);
}
//
// The main frame and its input and breakpoints widgets
//
QFrame* mainWindowFrame = new QFrame(this);
// The main breakpoints view
m_breakpointsView = new DebuggerView(DVT_BREAK_POINTS, m_machine, this);
// Layout
QVBoxLayout* vLayout = new QVBoxLayout(mainWindowFrame);
vLayout->setObjectName("vlayout");
vLayout->setSpacing(3);
vLayout->setContentsMargins(2,2,2,2);
vLayout->addWidget(m_breakpointsView);
setCentralWidget(mainWindowFrame);
//
// Menu bars
//
QActionGroup* typeGroup = new QActionGroup(this);
typeGroup->setObjectName("typegroup");
QAction* typeBreak = new QAction("Breakpoints", this);
typeBreak->setObjectName("typebreak");
QAction* typeWatch = new QAction("Watchpoints", this);
typeWatch->setObjectName("typewatch");
typeBreak->setCheckable(true);
typeWatch->setCheckable(true);
typeBreak->setActionGroup(typeGroup);
typeWatch->setActionGroup(typeGroup);
typeBreak->setShortcut(QKeySequence("Ctrl+1"));
typeWatch->setShortcut(QKeySequence("Ctrl+2"));
typeBreak->setChecked(true);
connect(typeGroup, &QActionGroup::triggered, this, &BreakpointsWindow::typeChanged);
// Assemble the options menu
QMenu* optionsMenu = menuBar()->addMenu("&Options");
optionsMenu->addActions(typeGroup->actions());
}
示例2: updateSearchOptions
void ListView::updateSearchOptions()
{
IssueTypeCache* cache = dataManager->issueTypeCache( m_typeId );
QList<int> allColumns = cache->availableColumns();
QList<int> columns;
foreach ( int column, allColumns ) {
if ( cache->availableOperators( column ).contains( "CON" ) )
columns.append( column );
}
if ( !columns.contains( m_searchColumn ) ) {
m_searchColumn = Column_Name;
m_model->setSearchText( m_searchColumn, m_searchBox->text() );
}
m_searchMenu->clear();
ViewSettingsHelper helper( m_typeId );
foreach ( int column, columns )
{
QString name = helper.columnName( column );
QAction* action = m_searchMenu->addAction( name );
action->setData( column );
action->setCheckable( true );
if ( column == m_searchColumn )
action->setChecked( true );
action->setActionGroup( m_searchActionGroup );
}
示例3: setActionGroup
int Action::setActionGroup(lua_State * L) // ( QActionGroup * group )
{
QAction* obj = QtObject<QAction>::check( L, 1);
QActionGroup* rhs = QtObject<QActionGroup>::check( L, 2);
obj->setActionGroup( rhs );
return 0;
}
示例4: buildMenu
void BtMenuView::buildMenu(QMenu *parentMenu, const QModelIndex &parentIndex) {
Q_ASSERT(m_model != 0);
Q_ASSERT(m_actions != 0);
int children = m_model->rowCount(parentIndex);
for (int i = 0; i < children; i++) {
QModelIndex childIndex(m_model->index(i, 0, parentIndex));
if (m_model->rowCount(childIndex) > 0) {
QMenu *childMenu = newMenu(parentMenu, childIndex);
if (childMenu != 0) {
// Add the child menu and populate it:
parentMenu->addMenu(childMenu);
buildMenu(childMenu, childIndex);
}
} else {
QAction *childAction = newAction(parentMenu, childIndex);
if (childAction != 0) {
// Map index
m_indexMap.insert(childAction, childIndex);
// Add action to action group:
childAction->setActionGroup(m_actions);
// Add action to menu:
parentMenu->addAction(childAction);
}
}
}
}
示例5: QPushButton
Test4Window::Test4Window(const QString &sql)
: Ui::Test4Window()
{
Ui::Test4Window::setupUi(this);
QToolBar *toolBar = QMainWindow::addToolBar("TB");
toolBar->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed));
toolBar->setFocusPolicy(Qt::NoFocus);
pushButton = new QPushButton("Oracle", toolBar);
pushButton->setFlat(true);
toolBar->addWidget(pushButton);
connect(pushButton, SIGNAL(released()), this, SLOT(setLexer()));
QAction *oracle = new QAction("Oracle", this);
QAction *mysql = new QAction("MySQL", this);
oracle->setCheckable(true);
oracle->setChecked(true);
mysql->setCheckable(true);
mysql->setChecked(false);
QActionGroup* group = new QActionGroup(this);
oracle->setActionGroup(group);
mysql->setActionGroup(group);
menuGrammar->addAction(oracle);
menuGrammar->addAction(mysql);
editorLeft = new toSqlText(this);
leftVerticalLayout->addWidget(editorLeft);
editorLeft->setText(sql);
editorLeft->enableToolTips();
editorRight = new toSqlText(this);
editorRight->setHighlighter(toSqlText::Oracle);
rightVerticalLayout->addWidget(editorRight);
editorRight->setText(sql);
editorRight->setMarginType(2, QsciScintilla::TextMarginRightJustified);
editorRight->setMarginWidth(2, QString::fromLatin1("009"));
editorRight->enableToolTips();
connect(oracle, SIGNAL(triggered()), this, SLOT(setOracle()));
connect(mysql, SIGNAL(triggered()), this, SLOT(setMySQL()));
connect(actionLoad, SIGNAL(triggered()), this, SLOT(load()));
connect(actionQuit, SIGNAL(triggered()), this, SLOT(close()));
QMainWindow::show();
}
示例6: QWidget
KisPaintOpPresetsChooserPopup::KisPaintOpPresetsChooserPopup(QWidget * parent)
: QWidget(parent)
, m_d(new Private())
{
m_d->uiWdgPaintOpPresets.setupUi(this);
KMenu* menu = new KMenu(this);
QActionGroup *actionGroup = new QActionGroup(this);
KisPresetChooser::ViewMode mode = (KisPresetChooser::ViewMode)KisConfig().presetChooserViewMode();
bool showAll = KisConfig().presetShowAllMode();
QAction* action = menu->addAction(koIcon("view-preview"), i18n("Thumbnails"), this, SLOT(slotThumbnailMode()));
action->setCheckable(true);
action->setChecked(mode == KisPresetChooser::THUMBNAIL);
action->setActionGroup(actionGroup);
action = menu->addAction(koIcon("view-list-details"), i18n("Details"), this, SLOT(slotDetailMode()));
action->setCheckable(true);
action->setChecked(mode == KisPresetChooser::DETAIL);
action->setActionGroup(actionGroup);
m_d->uiWdgPaintOpPresets.viewModeButton->setIcon(koIcon("view-choose"));
m_d->uiWdgPaintOpPresets.viewModeButton->setMenu(menu);
m_d->uiWdgPaintOpPresets.viewModeButton->setPopupMode(QToolButton::InstantPopup);
m_d->uiWdgPaintOpPresets.wdgPresetChooser->setViewMode(mode);
m_d->uiWdgPaintOpPresets.wdgPresetChooser->showTaggingBar(false,true);
connect(m_d->uiWdgPaintOpPresets.wdgPresetChooser, SIGNAL(resourceSelected(KoResource*)),
this, SIGNAL(resourceSelected(KoResource*)));
connect(m_d->uiWdgPaintOpPresets.searchBar, SIGNAL(textChanged(QString)),
m_d->uiWdgPaintOpPresets.wdgPresetChooser, SLOT(searchTextChanged(QString)));
connect(m_d->uiWdgPaintOpPresets.searchBar, SIGNAL(textChanged(QString)),
this, SLOT(setLineEditCompleter(QString)));
connect(m_d->uiWdgPaintOpPresets.searchBar, SIGNAL(returnPressed(QString)),
this, SLOT(returnKeyPressed(QString)));
connect(m_d->uiWdgPaintOpPresets.showAllCheckBox, SIGNAL(toggled(bool)),
m_d->uiWdgPaintOpPresets.wdgPresetChooser, SLOT(setShowAll(bool)));
m_d->firstShown = true;
m_d->uiWdgPaintOpPresets.showAllCheckBox->setChecked(showAll);
}
示例7: buildContextMenu
void SimplePartWidget::buildContextMenu(const QPoint &point, QMenu &menu) const
{
menu.addAction(m_findAction);
auto a = pageAction(QWebPage::Copy);
a->setIcon(UiUtils::loadIcon(QStringLiteral("edit-copy")));
menu.addAction(a);
a = pageAction(QWebPage::SelectAll);
a->setIcon(UiUtils::loadIcon(QStringLiteral("edit-select-all")));
menu.addAction(a);
if (!page()->mainFrame()->hitTestContent(point).linkUrl().isEmpty()) {
menu.addSeparator();
a = pageAction(QWebPage::CopyLinkToClipboard);
a->setIcon(UiUtils::loadIcon(QStringLiteral("edit-copy")));
menu.addAction(a);
}
menu.addSeparator();
menu.addAction(m_savePart);
menu.addAction(m_saveMessage);
if (!page()->mainFrame()->hitTestContent(point).imageUrl().isEmpty()) {
a = pageAction(QWebPage::DownloadImageToDisk);
a->setIcon(UiUtils::loadIcon(QStringLiteral("download")));
menu.addAction(a);
}
menu.addSeparator();
QMenu *colorSchemeMenu = menu.addMenu(UiUtils::loadIcon(QStringLiteral("colorneg")), tr("Color scheme"));
QActionGroup *ag = new QActionGroup(colorSchemeMenu);
for (auto item: supportedColorSchemes()) {
QAction *a = colorSchemeMenu->addAction(item.second);
connect(a, &QAction::triggered, this, [this, item](){
const_cast<SimplePartWidget*>(this)->setColorScheme(item.first);
});
a->setCheckable(true);
if (item.first == m_colorScheme) {
a->setChecked(true);
}
a->setActionGroup(ag);
}
auto zoomMenu = menu.addMenu(UiUtils::loadIcon(QStringLiteral("zoom")), tr("Zoom"));
if (m_messageView) {
zoomMenu->addAction(m_messageView->m_zoomIn);
zoomMenu->addAction(m_messageView->m_zoomOut);
zoomMenu->addAction(m_messageView->m_zoomOriginal);
} else {
auto zoomIn = zoomMenu->addAction(UiUtils::loadIcon(QStringLiteral("zoom-in")), tr("Zoom In"));
zoomIn->setShortcut(QKeySequence::ZoomIn);
connect(zoomIn, &QAction::triggered, this, &SimplePartWidget::zoomIn);
auto zoomOut = zoomMenu->addAction(UiUtils::loadIcon(QStringLiteral("zoom-out")), tr("Zoom Out"));
zoomOut->setShortcut(QKeySequence::ZoomOut);
connect(zoomOut, &QAction::triggered, this, &SimplePartWidget::zoomOut);
auto zoomOriginal = zoomMenu->addAction(UiUtils::loadIcon(QStringLiteral("zoom-original")), tr("Original Size"));
connect(zoomOriginal, &QAction::triggered, this, &SimplePartWidget::zoomOriginal);
}
}
示例8: slotViewContextMenuRequested
void PlacesPanel::slotViewContextMenuRequested(const QPointF& pos)
{
QMenu menu(this);
QAction* addAction = menu.addAction(QIcon::fromTheme(QStringLiteral("document-new")), i18nc("@item:inmenu", "Add Entry..."));
QAction* showAllAction = nullptr;
if (m_model->hiddenCount() > 0) {
showAllAction = menu.addAction(i18nc("@item:inmenu", "Show All Entries"));
showAllAction->setCheckable(true);
showAllAction->setChecked(m_model->hiddenItemsShown());
}
buildGroupContextMenu(&menu, m_controller->indexCloseToMousePressedPosition());
QMenu* iconSizeSubMenu = new QMenu(i18nc("@item:inmenu", "Icon Size"), &menu);
struct IconSizeInfo
{
int size;
const char* context;
const char* text;
};
const int iconSizeCount = 4;
static const IconSizeInfo iconSizes[iconSizeCount] = {
{KIconLoader::SizeSmall, I18N_NOOP2_NOSTRIP("Small icon size", "Small (%1x%2)")},
{KIconLoader::SizeSmallMedium, I18N_NOOP2_NOSTRIP("Medium icon size", "Medium (%1x%2)")},
{KIconLoader::SizeMedium, I18N_NOOP2_NOSTRIP("Large icon size", "Large (%1x%2)")},
{KIconLoader::SizeLarge, I18N_NOOP2_NOSTRIP("Huge icon size", "Huge (%1x%2)")}
};
QMap<QAction*, int> iconSizeActionMap;
QActionGroup* iconSizeGroup = new QActionGroup(iconSizeSubMenu);
for (int i = 0; i < iconSizeCount; ++i) {
const int size = iconSizes[i].size;
const QString text = i18nc(iconSizes[i].context, iconSizes[i].text,
size, size);
QAction* action = iconSizeSubMenu->addAction(text);
iconSizeActionMap.insert(action, size);
action->setActionGroup(iconSizeGroup);
action->setCheckable(true);
action->setChecked(m_view->iconSize() == size);
}
menu.addMenu(iconSizeSubMenu);
menu.addSeparator();
foreach (QAction* action, customContextMenuActions()) {
menu.addAction(action);
}
示例9: createAction
QAction* DiagramToolBox::createAction(const QString& text,
const QString& iconPath, const QString& shortcut, const QVariant& data)
{
QAction* action = new QAction(text, this);
if (!iconPath.isEmpty()) action->setIcon(QIcon(iconPath));
if (!shortcut.isEmpty()) action->setShortcut(QKeySequence(shortcut));
action->setData(data);
action->setCheckable(true);
action->setActionGroup(mDiagramModeActionGroup);
return action;
}
示例10: setupFanProfilesMenu
void radeon_profile::setupFanProfilesMenu(const bool rebuildMode) {
if (rebuildMode)
delete fanProfilesMenu;
fanProfilesMenu = new QMenu(this);
connect(fanProfilesMenu, SIGNAL(triggered(QAction*)), this, SLOT(fanProfileMenuActionClicked(QAction*)));
QActionGroup *ag = new QActionGroup(fanProfilesMenu);
QAction *fanAuto = new QAction(fanProfilesMenu);
fanAuto->setText(tr("Auto"));
fanAuto->setCheckable(true);
fanAuto->setChecked(true);
fanAuto->setActionGroup(ag);
connect(fanAuto, SIGNAL(triggered()), this, SLOT(on_btn_pwmAuto_clicked()));
QAction *fanFixed = new QAction(fanProfilesMenu);
fanFixed->setText(tr("Fixed ") + ui->labelFixedSpeed->text()+"%");
fanFixed->setCheckable(true);
fanFixed->setActionGroup(ag);
connect(fanFixed, SIGNAL(triggered()), this, SLOT(on_btn_pwmFixed_clicked()));
fanProfilesMenu->addAction(fanAuto);
fanProfilesMenu->addAction(fanFixed);
fanProfilesMenu->addSeparator();
for (QString p : fanProfiles.keys()) {
QAction *a = new QAction(fanProfilesMenu);
a->setText(p);
a->setCheckable(true);
a->setActionGroup(ag);
fanProfilesMenu->addAction(a);
}
ui->l_fanSpeed->setMenu(fanProfilesMenu);
}
示例11: AddStateSlotMenu
void MenuBar::AddStateSlotMenu(QMenu* emu_menu)
{
m_state_slot_menu = emu_menu->addMenu(tr("Select State Slot"));
m_state_slots = new QActionGroup(this);
for (int i = 1; i <= 10; i++)
{
QAction* action = m_state_slot_menu->addAction(QStringLiteral(""));
action->setCheckable(true);
action->setActionGroup(m_state_slots);
if (Settings::Instance().GetStateSlot() == i)
action->setChecked(true);
connect(action, &QAction::triggered, this, [=]() { emit SetStateSlot(i); });
}
}
示例12: newMenuAction
QAction* AppWindow::newMenuAction(
const std::string& title,
QActionGroup* actionGroup,
const std::string& tip,
std::list<QAction*>& menuList,
int shortcut) {
QAction* action = new QAction(tr(title.c_str()), this);
action->setStatusTip(tr(tip.c_str()));
if (actionGroup) {
action->setCheckable(true);
action->setActionGroup(actionGroup);
}
shortcutActions.insert({shortcut, action});
menuList.push_back(action);
return action;
}
示例13: SetPlayModeButton
void PlaylistWidget::SetPlayModeButton ()
{
auto playButton = new QToolButton;
playButton->setIcon (Core::Instance ().GetProxy ()->
GetIconThemeManager ()->GetIcon ("view-media-playlist"));
playButton->setPopupMode (QToolButton::InstantPopup);
QMenu *playMode = new QMenu (tr ("Play mode"));
playButton->setMenu (playMode);
const std::vector<std::pair<Player::PlayMode, QString>> modes =
{
{ Player::PlayMode::Sequential, tr ("Sequential") },
{ Player::PlayMode::Shuffle, tr ("Shuffle") },
{ Player::PlayMode::ShuffleAlbums, tr ("Shuffle albums") },
{ Player::PlayMode::ShuffleArtists, tr ("Shuffle artists") },
{ Player::PlayMode::RepeatTrack, tr ("Repeat track") },
{ Player::PlayMode::RepeatAlbum, tr ("Repeat album") },
{ Player::PlayMode::RepeatWhole, tr ("Repeat whole") }
};
PlayModesGroup_ = new QActionGroup (this);
bool hadChecked = false;
for (const auto& pair : modes)
{
QAction *action = new QAction (pair.second, this);
action->setProperty ("PlayMode", static_cast<int> (pair.first));
action->setCheckable (true);
action->setChecked (hadChecked ? false : hadChecked = true);
action->setActionGroup (PlayModesGroup_);
playMode->addAction (action);
connect (action,
SIGNAL (triggered ()),
this,
SLOT (handleChangePlayMode ()));
}
connect (Player_,
SIGNAL (playModeChanged (Player::PlayMode)),
this,
SLOT (handlePlayModeChanged (Player::PlayMode)));
const int resumeMode = XmlSettingsManager::Instance ()
.Property ("PlayMode", static_cast<int> (Player::PlayMode::Sequential)).toInt ();
Player_->SetPlayMode (static_cast<Player::PlayMode> (resumeMode));
PlaylistToolbar_->addWidget (playButton);
}
示例14: scanPlayers
void MainWindow::scanPlayers() {
ui->menuSelect_Player->clear();
bool enabled = false;
for (const QString &playerDir : settings->getPlayers()) {
QDir dir(playerDir);
QActionGroup *group = new QActionGroup(this);
bool checked = false;
QDirIterator it(dir);
QList<QAction *> actions;
while (it.hasNext()) {
it.next();
if (it.fileName().endsWith(".plr")) {
QString name = playerName(it.filePath());
if (!name.isNull()) {
QAction *p = new QAction(this);
p->setCheckable(true);
p->setActionGroup(group);
p->setText(name);
p->setData(it.filePath());
connect(p, SIGNAL(triggered()),
this, SLOT(selectPlayer()));
if (!checked) {
p->setChecked(true);
p->trigger();
}
checked = true;
actions.append(p);
}
}
}
if (!actions.isEmpty()) {
ui->menuOpen_World->addSection(playerDir);
ui->menuSelect_Player->addActions(actions);
enabled = true;
}
}
ui->menuSelect_Player->setDisabled(!enabled);
}
示例15: loadMediaPlayerPlugin
void PluginManager::loadMediaPlayerPlugin(MediaPlayerPlugin *mediaPlayerPlugin)
{
QWidget *view = mediaPlayerPlugin->providesView();
if (view != nullptr) {
// Add a separator before any plugin (3 views by default: Playlist, Unique Library and Tag Editor
if (_mainWindow->menuView->actions().count() == 3) {
_mainWindow->menuView->addSeparator();
}
QAction *actionAddViewToMenu = new QAction(mediaPlayerPlugin->name(), _mainWindow->menuView);
actionAddViewToMenu->setObjectName(mediaPlayerPlugin->name());
_mainWindow->menuView->addAction(actionAddViewToMenu);
_mainWindow->updateFonts(SettingsPrivate::instance()->font(SettingsPrivate::FF_Menu));
connect(actionAddViewToMenu, &QAction::triggered, this, [=]() {
_mainWindow->close();
view->show();
});
// Link the view to the existing ActionGroup
actionAddViewToMenu->setCheckable(true);
actionAddViewToMenu->setActionGroup(_mainWindow->actionViewPlaylists->actionGroup());
_dependencies.insert(mediaPlayerPlugin->name(), actionAddViewToMenu);
}
mediaPlayerPlugin->setMediaPlayer(_mainWindow->mediaPlayer());
}