本文整理汇总了C++中QAction::isChecked方法的典型用法代码示例。如果您正苦于以下问题:C++ QAction::isChecked方法的具体用法?C++ QAction::isChecked怎么用?C++ QAction::isChecked使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QAction
的用法示例。
在下文中一共展示了QAction::isChecked方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: showMasterPalette
void MuseScore::showMasterPalette(const QString& s)
{
QAction* a = getAction("masterpalette");
if (masterPalette == 0) {
masterPalette = new MasterPalette(this);
connect(masterPalette, SIGNAL(closed(bool)), a, SLOT(setChecked(bool)));
mscore->stackUnder(masterPalette);
}
// when invoked via other actions, the main "masterpalette" action is not toggled automatically
if (!s.isEmpty()) {
// display if not already
if (!a->isChecked())
a->setChecked(true);
else {
// master palette is open; close only if command match current item
if (s == masterPalette->selectedItem())
a->setChecked(false);
// otherwise switch tabs
}
}
masterPalette->setVisible(a->isChecked());
if (!s.isEmpty())
masterPalette->selectItem(s);
}
示例2: slotContextMenu
void ToolBar::slotContextMenu(const QPoint &p){
int tab = tabbar->tabAt(p);
ArenaWidget *awgt = findWidgetForIndex(tab);
if (!awgt){
QMenu *m = new QMenu(this);
QAction *act = new QAction(tr("Show close buttons"), m);
act->setCheckable(true);
act->setChecked(WBGET(WB_APP_TBAR_SHOW_CL_BTNS));
m->addAction(act);
if (m->exec(QCursor::pos())){
WBSET(WB_APP_TBAR_SHOW_CL_BTNS, act->isChecked());
tabbar->setTabsClosable(act->isChecked());
}
m->deleteLater();
return;
}
QMenu *m = awgt->getMenu();
if (m)
m->exec(QCursor::pos());
}
示例3: loadAction
void Menu::loadAction(Settings& settings, QAction& action) {
QString prefix;
for (QString group : groups) {
prefix += group;
prefix += "/";
}
if (action.isChecked() != settings.value(prefix + action.text(), action.isChecked()).toBool()) {
action.trigger();
}
}
示例4: exclusive
void tst_QActionGroup::exclusive()
{
QActionGroup group(0);
group.setExclusive(false);
QVERIFY( !group.isExclusive() );
QAction* actOne = new QAction( &group );
actOne->setCheckable( true );
QAction* actTwo = new QAction( &group );
actTwo->setCheckable( true );
QAction* actThree = new QAction( &group );
actThree->setCheckable( true );
group.setExclusive( true );
QVERIFY( !actOne->isChecked() );
QVERIFY( !actTwo->isChecked() );
QVERIFY( !actThree->isChecked() );
actOne->setChecked( true );
QVERIFY( actOne->isChecked() );
QVERIFY( !actTwo->isChecked() );
QVERIFY( !actThree->isChecked() );
actTwo->setChecked( true );
QVERIFY( !actOne->isChecked() );
QVERIFY( actTwo->isChecked() );
QVERIFY( !actThree->isChecked() );
}
示例5: displayMenu
void AbstractTableTab::displayMenu(QPoint pos) {
QMenu menu(getTable());
QList<QDockWidget*> dockWindows = this->getDockWindows();
QModelIndexList selection = getTable()->selectionModel()->selectedRows();
if (selection.count() > 0) {
QModelIndex index = selection.at(0);
AlterSettingsEntry entry = settingEntries.at(index.row());
QStringList selected = entry.targetList;
bool all = false;
if(selected.contains(WINDOW_SELECT_ALL) || selected.empty()) all = true;
QAction* allAction = menu.addAction(WINDOW_SELECT_ALL);
allAction->setCheckable(true);
allAction->setChecked(all);
QAction* mainAction = menu.addAction(WINDOW_TITLE_MAIN);
mainAction->setCheckable(true);
mainAction->setChecked(!all && selected.contains(WINDOW_TITLE_MAIN));
for(QDockWidget* dock : dockWindows) {
QAction *action = menu.addAction(dock->objectName());
action->setCheckable(true);
action->setChecked(!all && selected.contains(dock->objectName()));
}
menu.addSeparator();
QAction* enabled = menu.addAction("Enabled");
enabled->setCheckable(true);
enabled->setChecked(entry.enabled);
pos.rx()--; pos.ry()--;
QAction *a = menu.exec(getTable()->viewport()->mapToGlobal(pos));
if(a != NULL) {
if(a->text() == "Enabled") {
entry.enabled = a->isChecked();
} else if(a->isChecked()) {
entry.targetList.append(a->text());
} else {
entry.targetList.removeAll(a->text());
}
settingEntries.replace(index.row(), entry);
this->registerChange(index.row(), TableChangeEvent::Update);
}
}
}
示例6: showColumnsContextMenu
void showColumnsContextMenu(const QPoint& p, QTreeWidget& tree)
{
QMenu headerMenu(xi18nc("@title:menu", "Columns"));
QHeaderView* header = tree.header();
for (qint32 i = 0; i < tree.model()->columnCount(); i++) {
const int idx = header->logicalIndex(i);
const QString text = tree.model()->headerData(idx, Qt::Horizontal).toString();
QAction* action = headerMenu.addAction(text);
action->setCheckable(true);
action->setChecked(!header->isSectionHidden(idx));
action->setData(idx);
action->setEnabled(idx > 0);
}
QAction* action = headerMenu.exec(tree.header()->mapToGlobal(p));
if (action != nullptr) {
const bool hidden = !action->isChecked();
tree.setColumnHidden(action->data().toInt(), hidden);
if (!hidden)
tree.resizeColumnToContents(action->data().toInt());
}
}
示例7: switch
void
VBoxDbgConsoleOutput::setColorScheme(VBoxDbgConsoleColor enmScheme, bool fSaveIt)
{
const char *pszSetting;
QAction *pAction;
switch (enmScheme)
{
case kGreenOnBlack:
setStyleSheet("QTextEdit { background-color: black; color: rgb(0, 224, 0) }");
pszSetting = "GreenOnBlack";
pAction = m_pGreenOnBlackAction;
break;
case kBlackOnWhite:
setStyleSheet("QTextEdit { background-color: white; color: black }");
pszSetting = "BlackOnWhite";
pAction = m_pBlackOnWhiteAction;
break;
default:
AssertFailedReturnVoid();
}
m_enmColorScheme = kGreenOnBlack;
/* When going through a slot, the action is typically checked already by Qt. */
if (!pAction->isChecked())
pAction->setChecked(true);
/* Make this setting persistent. */
if (m_pVirtualBox && fSaveIt)
m_pVirtualBox->SetExtraData(com::Bstr("DbgConsole/ColorScheme").raw(), com::Bstr(pszSetting).raw());
}
示例8: contextMenuEvent
void LinkDialogGraphicsScene::contextMenuEvent(QGraphicsSceneContextMenuEvent* e) {
if (auto linkGraphicsItem =
getSceneGraphicsItemAt<DialogConnectionGraphicsItem>(e->scenePos())) {
QMenu menu;
QAction* deleteAction = menu.addAction("Delete");
QAction* biDirectionAction = menu.addAction("BiDirectional");
biDirectionAction->setCheckable(true);
QAction* switchDirection = menu.addAction("Switch Direction");
if (isPropertyLinkBidirectional(linkGraphicsItem)) {
biDirectionAction->setChecked(true);
} else {
biDirectionAction->setChecked(false);
}
QAction* result = menu.exec(QCursor::pos());
if (result == deleteAction) {
removePropertyLink(linkGraphicsItem);
removePropertyLinkRepresentation(linkGraphicsItem->getPropertyLink());
} else if (result == biDirectionAction) {
if (biDirectionAction->isChecked()) {
makePropertyLinkBidirectional(linkGraphicsItem, true);
} else {
makePropertyLinkBidirectional(linkGraphicsItem, false);
}
} else if (result == switchDirection) {
switchPropertyLinkDirection(linkGraphicsItem);
}
}
}
示例9: populateCharacterEncodingMenu
void Menu::populateCharacterEncodingMenu()
{
if (!m_actionGroup)
{
QList<int> textCodecs;
textCodecs << 106 << 1015 << 1017 << 4 << 5 << 6 << 7 << 8 << 82 << 10 << 85 << 12 << 13 << 109 << 110 << 112 << 2250 << 2251 << 2252 << 2253 << 2254 << 2255 << 2256 << 2257 << 2258 << 18 << 39 << 17 << 38 << 2026;
m_actionGroup = new QActionGroup(this);
m_actionGroup->setExclusive(true);
QAction *defaultAction = QMenu::addAction(tr("Auto Detect"));
defaultAction->setData(-1);
defaultAction->setCheckable(true);
m_actionGroup->addAction(defaultAction);
addSeparator();
for (int i = 0; i < textCodecs.count(); ++i)
{
QTextCodec *codec = QTextCodec::codecForMib(textCodecs.at(i));
if (!codec)
{
continue;
}
QAction *textCodecAction = QMenu::addAction(Utils::elideText(codec->name(), this));
textCodecAction->setData(textCodecs.at(i));
textCodecAction->setCheckable(true);
m_actionGroup->addAction(textCodecAction);
}
}
MainWindow *mainWindow = MainWindow::findMainWindow(parent());
const QString encoding = (mainWindow ? mainWindow->getWindowsManager()->getOption(QLatin1String("Content/DefaultCharacterEncoding")).toString().toLower() : QString());
for (int i = 2; i < actions().count(); ++i)
{
QAction *action = actions().at(i);
if (!action)
{
continue;
}
action->setChecked(encoding == action->text().toLower());
if (action->isChecked())
{
break;
}
}
if (!m_actionGroup->checkedAction() && !actions().isEmpty())
{
actions().first()->setChecked(true);
}
}
示例10: slotSmileContextMenu
void PMWindow::slotSmileContextMenu(){
#ifndef WIN32
QString emot = CLIENT_DATA_DIR "/emoticons/";
#else
QString emot = qApp->applicationDirPath()+QDir::separator()+CLIENT_DATA_DIR "/emoticons/";
#endif//WIN32
QMenu *m = new QMenu(this);
QAction * a = NULL;
foreach (const QString &f, QDir(emot).entryList(QDir::Dirs | QDir::NoSymLinks | QDir::NoDotAndDotDot)){
if (!f.isEmpty()){
QAction * act = m->addAction(f);
act->setCheckable(true);
if (f == WSGET(WS_APP_EMOTICON_THEME))
act->setChecked(true);
}
}
a = m->exec(QCursor::pos());
if (a && a->isChecked())
WSSET(WS_APP_EMOTICON_THEME, a->text());
}
示例11: isChecked
bool QActionProto::isChecked() const
{
QAction *item = qscriptvalue_cast<QAction*>(thisObject());
if (item)
return item->isChecked();
return false;
}
示例12: buildFromQWidget
//=========================================================================
// MemoryWindowQtConfig
//=========================================================================
void MemoryWindowQtConfig::buildFromQWidget(QWidget* widget)
{
WindowQtConfig::buildFromQWidget(widget);
MemoryWindow* window = dynamic_cast<MemoryWindow*>(widget);
QComboBox* memoryRegion = window->findChild<QComboBox*>("memoryregion");
m_memoryRegion = memoryRegion->currentIndex();
QAction* reverse = window->findChild<QAction*>("reverse");
m_reverse = reverse->isChecked();
QActionGroup* addressGroup = window->findChild<QActionGroup*>("addressgroup");
if (addressGroup->checkedAction()->text() == "Logical Addresses")
m_addressMode = 0;
else if (addressGroup->checkedAction()->text() == "Physical Addresses")
m_addressMode = 1;
QActionGroup* dataFormat = window->findChild<QActionGroup*>("dataformat");
if (dataFormat->checkedAction()->text() == "1-byte chunks")
m_dataFormat = 0;
else if (dataFormat->checkedAction()->text() == "2-byte chunks")
m_dataFormat = 1;
else if (dataFormat->checkedAction()->text() == "4-byte chunks")
m_dataFormat = 2;
else if (dataFormat->checkedAction()->text() == "8-byte chunks")
m_dataFormat = 3;
else if (dataFormat->checkedAction()->text() == "32 bit floating point")
m_dataFormat = 4;
else if (dataFormat->checkedAction()->text() == "64 bit floating point")
m_dataFormat = 5;
else if (dataFormat->checkedAction()->text() == "80 bit floating point")
m_dataFormat = 6;
}
示例13: setSelectTool
void EMainWindow::setSelectTool()
{
if (!_currentPainting) return;
QAction *selectAction = _mainUi.actionSelectTool;
if (!selectAction->isChecked()) selectAction->setChecked(true);
_currentPainting->setCreateFlag(EPainting::None);
}
示例14: sltHandleMenuBarConfigurationChange
void UIMachineWindowNormal::sltHandleMenuBarConfigurationChange(const QUuid &uMachineID)
{
/* Skip unrelated machine IDs: */
if (vboxGlobal().managedVMUuid() != uMachineID)
return;
/* Check whether menu-bar is enabled: */
const bool fEnabled = gEDataManager->menuBarEnabled(vboxGlobal().managedVMUuid());
/* Update settings action 'enable' state: */
QAction *pActionMenuBarSettings = actionPool()->action(UIActionIndexRT_M_View_M_MenuBar_S_Settings);
pActionMenuBarSettings->setEnabled(fEnabled);
/* Update switch action 'checked' state: */
QAction *pActionMenuBarSwitch = actionPool()->action(UIActionIndexRT_M_View_M_MenuBar_T_Visibility);
pActionMenuBarSwitch->blockSignals(true);
pActionMenuBarSwitch->setChecked(fEnabled);
pActionMenuBarSwitch->blockSignals(false);
/* Update menu-bar visibility: */
menuBar()->setVisible(pActionMenuBarSwitch->isChecked());
/* Update menu-bar: */
updateMenu();
/* Normalize geometry without moving: */
normalizeGeometry(false /* adjust position */);
}
示例15: setupLocalAction
void ActionsManager::setupLocalAction(QAction *localAction, const QLatin1String &globalAction, bool connectTrigger)
{
if (!localAction)
{
return;
}
QAction *action = getAction(globalAction);
if (action)
{
localAction->setCheckable(action->isCheckable());
localAction->setChecked(action->isChecked());
localAction->setEnabled(action->isEnabled());
localAction->setIcon(action->icon());
localAction->setText(action->text());
localAction->setShortcut(action->shortcut());
localAction->setObjectName(action->objectName());
if (connectTrigger)
{
connect(localAction, SIGNAL(triggered()), action, SLOT(trigger()));
}
}
}