Example #1
0
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);
      }
Example #2
0
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());
}
Example #3
0
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();
    }
}
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() );
}
Example #5
0
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);
        }
    }
}
Example #6
0
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());
    }
}
Example #7
0
void AxisInteractor::showContextMenu(const QPoint &pos)
{
    QPoint globalPos = this->mapToGlobal(pos);
    QList<QGraphicsItem *> list = this->scene->items();
    for (int i = 0; i < list.count(); ++i)
    {
        QGraphicsItem *item = list.at(i);
        if (item->type() == IndicatorItemType)
        {
            if (item->isUnderMouse())
            {
                item->setSelected(false);
                this->createContextMenu();
                QAction *selectedItem = this->indicatorContextMenu->exec(globalPos);
                if (selectedItem)
                {
                    if (QString("Delete") == selectedItem->text())
                    {
                        this->scene->removeItem(item);
                        emit this->deleteIndicator(item->toolTip());
                    }
                    if (QString("Hide") == selectedItem->text())
                    {
                        bool isVisible = !selectedItem->isChecked();
                        emit this->showOrHideIndicator(isVisible, item->toolTip());
                        static_cast<Indicator *>(item)->changeIndicatorColor(isVisible);
                    }
                }
            }
        }
    }
}
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());
}
Example #9
0
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);
        }
    }
}
Example #10
0
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);
	}
}
Example #11
0
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());
}
Example #12
0
bool QActionProto::isChecked() const
{
  QAction *item = qscriptvalue_cast<QAction*>(thisObject());
  if (item)
    return item->isChecked();
  return false;
}
Example #13
0
//=========================================================================
//  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;
}
Example #14
0
void EMainWindow::setSelectTool()
{
	if (!_currentPainting) return;
	QAction *selectAction = _mainUi.actionSelectTool;
	if (!selectAction->isChecked()) selectAction->setChecked(true);
	_currentPainting->setCreateFlag(EPainting::None);
}
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 */);
}
Example #16
0
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()));
		}
	}
}
void UIMachineWindowNormal::sltHandleStatusBarConfigurationChange(const QUuid &uMachineID)
{
    /* Skip unrelated machine IDs: */
    if (vboxGlobal().managedVMUuid() != uMachineID)
        return;

    /* Check whether status-bar is enabled: */
    const bool fEnabled = gEDataManager->statusBarEnabled(vboxGlobal().managedVMUuid());
    /* Update settings action 'enable' state: */
    QAction *pActionStatusBarSettings = actionPool()->action(UIActionIndexRT_M_View_M_StatusBar_S_Settings);
    pActionStatusBarSettings->setEnabled(fEnabled);
    /* Update switch action 'checked' state: */
    QAction *pActionStatusBarSwitch = actionPool()->action(UIActionIndexRT_M_View_M_StatusBar_T_Visibility);
    pActionStatusBarSwitch->blockSignals(true);
    pActionStatusBarSwitch->setChecked(fEnabled);
    pActionStatusBarSwitch->blockSignals(false);

    /* Update status-bar visibility: */
    statusBar()->setVisible(pActionStatusBarSwitch->isChecked());
    /* Update status-bar indicators-pool: */
    m_pIndicatorsPool->setAutoUpdateIndicatorStates(statusBar()->isVisible() && uisession()->isRunning());

    /* Normalize geometry without moving: */
    normalizeGeometry(false /* adjust position */);
}
 void MainWindow::setDisableConnectionShortcuts()
 {
     QAction *send = qobject_cast<QAction*>(sender());
     AppRegistry::instance().settingsManager()->setDisableConnectionShortcuts(send->isChecked());
     AppRegistry::instance().settingsManager()->save();
     updateConnectionsMenu();
 }
Example #19
0
void CaptureWgt::slotFilter()
{
    QObject * o = sender();
    QAction * a = qobject_cast<QAction *>( o );
    QString name;
    if ( a == pd->ui.equalizeHist )
        name = "equalizeHist";
    else if ( a == pd->ui.fullContrast )
        name = "fullContrast";
    else if ( a == pd->ui.sobel )
        name = "sobel";
    else if ( a == pd->ui.median )
        name = "median";
    else if ( a == pd->ui.timeSmooth )
        name = "timeSmooth";
    else if ( a == pd->ui.highPass )
        name = "highPass";
    else if ( a == pd->ui.surface )
        name = "surfaceSubtract";
    else if ( a == pd->ui.brightnessRange )
        name = "brightnessRange";
    bool checked = a->isChecked();
    if ( checked )
        pd->cap->addFilter( name );
    else
        pd->cap->removeFilter( name );
}
Example #20
0
void MainWindow::menuCharacterEncodingAboutToShow()
{
	if (!m_characterEncodingGroup)
	{
		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_characterEncodingGroup = new QActionGroup(this);
		m_characterEncodingGroup->setExclusive(true);

		QAction *defaultAction = m_ui->menuCharacterEncoding->addAction(tr("Auto Detect"));
		defaultAction->setData(-1);
		defaultAction->setCheckable(true);

		m_characterEncodingGroup->addAction(defaultAction);

		m_ui->menuCharacterEncoding->addSeparator();

		for (int i = 0; i < textCodecs.count(); ++i)
		{
			QTextCodec *codec = QTextCodec::codecForMib(textCodecs.at(i));

			if (!codec)
			{
				continue;
			}

			QAction *textCodecAction = m_ui->menuCharacterEncoding->addAction(Utils::elideText(codec->name(), m_ui->menuCharacterEncoding));
			textCodecAction->setData(textCodecs.at(i));
			textCodecAction->setCheckable(true);

			m_characterEncodingGroup->addAction(textCodecAction);
		}
	}

	const QString encoding = m_windowsManager->getDefaultCharacterEncoding().toLower();

	for (int i = 2; i < m_ui->menuCharacterEncoding->actions().count(); ++i)
	{
		QAction *action = m_ui->menuCharacterEncoding->actions().at(i);

		if (!action)
		{
			continue;
		}

		action->setChecked(encoding == action->text().toLower());

		if (action->isChecked())
		{
			break;
		}
	}

	if (!m_characterEncodingGroup->checkedAction())
	{
		m_ui->menuCharacterEncoding->actions().first()->setChecked(true);
	}
}
void ListingTable::headerSectionVisibilityActionTriggered()
{
	QAction* action = (QAction*) sender();
	int sect = action->data().toInt();

	QHeaderView* header = horizontalHeader();
	header->setSectionHidden(sect, !action->isChecked());
}
Example #22
0
void Menu::saveAction(Settings& settings, QAction& action) {
    QString prefix;
    for (QString group : groups) {
        prefix += group;
        prefix += "/";
    }
    settings.setValue(prefix + action.text(), action.isChecked());
}
Example #23
0
bool QRToolBar::isChecked(int id) const {
   eAssert(id < (int) numButtons(), ("index (%d) out of bounds (0..%d) for QRToolBar::isEnabled!",
           id, numButtons()-1));
   QAction *action = getAction(id);
   eAssert(action->isCheckable(), ("cannot verify checked state to button %s[%d], as it is not-checkable type!", QROSE::getName(this).c_str(), id));

   return action->isChecked();
}
Example #24
0
void IdealController::setShowDockStatus(Qt::DockWidgetArea area, bool checked)
{
    QAction* action = actionForArea(area);
    if (action->isChecked() != checked) {
        bool blocked = action->blockSignals(true);
        action->setChecked(checked);
        action->blockSignals(blocked);
    }
}
Example #25
0
void FilesWidget::onActionMediaStatusColumn()
{
    m_contextMenu->close();
    QAction *action = static_cast<QAction*>(QObject::sender());
    if (!action)
        return;
    action->setChecked(action->isChecked());

    MediaStatusColumns col = static_cast<MediaStatusColumns>(action->property("mediaStatusColumn").toInt());
    QList<MediaStatusColumns> columns = Settings::instance()->mediaStatusColumns();
    if (action->isChecked() && !columns.contains(col))
        columns.append(col);
    else
        columns.removeAll(col);
    Settings::instance()->setMediaStatusColumns(columns);
    Settings::instance()->saveSettings();
    renewModel();
}
Example #26
0
void DolphinStatusBar::contextMenuEvent(QContextMenuEvent* event)
{
    Q_UNUSED(event);

    KMenu menu(this);

    QAction* copyAction = 0;
    switch (type()) {
    case Default:
    case OperationCompleted:
    case Information:
        copyAction = menu.addAction(i18nc("@action:inmenu", "Copy Information Message"));
        break;
    case Error:
        copyAction = menu.addAction(i18nc("@action:inmenu", "Copy Error Message"));
        break;
    default: break;
    }

    GeneralSettings* settings = DolphinSettings::instance().generalSettings();

    QAction* showZoomSliderAction = menu.addAction(i18nc("@action:inmenu", "Show Zoom Slider"));
    showZoomSliderAction->setCheckable(true);
    showZoomSliderAction->setChecked(settings->showZoomSlider());

    QAction* showSpaceInfoAction = menu.addAction(i18nc("@action:inmenu", "Show Space Information"));
    showSpaceInfoAction->setCheckable(true);
    showSpaceInfoAction->setChecked(settings->showSpaceInfo());

    const QAction* action = menu.exec(QCursor::pos());
    if (action == copyAction) {
        QMimeData* mimeData = new QMimeData();
        mimeData->setText(message());
        QApplication::clipboard()->setMimeData(mimeData);
    } else if (action == showZoomSliderAction) {
        const bool visible = showZoomSliderAction->isChecked();
        settings->setShowZoomSlider(visible);
        m_zoomWidget->setVisible(visible);
    } else if (action == showSpaceInfoAction) {
        const bool visible = showSpaceInfoAction->isChecked();
        settings->setShowSpaceInfo(visible);
        m_spaceInfo->setVisible(visible);
    }
}
Example #27
0
Mining::Mining(ZeroFace* _m):
	Plugin(_m, "Mining")
{
	QAction* mine = addMenuItem("Mine", "menuMining", false, "&Mining");
	mine->setCheckable(true);
	connect(mine, &QAction::triggered, [=](){
		if (ethereum()->wouldSeal() != mine->isChecked())
		{
			cdebug << "Author" << ethereum()->author() << "(" << aleth()->author() << ")";
			if (mine->isChecked())
				ethereum()->startSealing();
			else
				ethereum()->stopSealing();
		}
	});
	connect(addMenuItem("Prepare Next DAG", "menuMining"), &QAction::triggered, [&](){
		EthashAux::computeFull(
			EthashAux::seedHash(
				ethereum()->blockChain().number() + ETHASH_EPOCH_LENGTH
			)
		);
	});

	auto g = new QActionGroup(this);
	g->setExclusive(true);
	auto translate = [](string s) { return s == "cpu" ? "CPU Miner" : s == "opencl" ? "OpenCL (GPU) Miner" : s + " Miner"; };
	for (auto i: ethereum()->sealers())
	{
		QAction* a = addMenuItem(QString::fromStdString(translate(i)), "menuMining", i == ethereum()->sealers().front());
		connect(a, &QAction::triggered, [=](){ ethereum()->setSealer(i); });
		g->addAction(a);
		a->setCheckable(true);
		if (i == ethereum()->sealer())
			a->setChecked(true);
	}

	{
		QTimer* t = new QTimer(this);
		connect(t, &QTimer::timeout, [=](){
			mine->setChecked(ethereum()->wouldSeal());
		});
		t->start(1000);
	}
}
Example #28
0
void CPlainWriteWindow::storeProfileSettings(const QString & windowGroup) {
    CDisplayWindow::storeProfileSettings(windowGroup);

    QAction * action = actionCollection()->action(CResMgr::displaywindows::commentaryWindow::syncWindow::actionName);
    Q_ASSERT(action);
    Q_ASSERT(windowGroup.endsWith('/'));
    btConfig().setSessionValue(windowGroup + "writeWindowType",
                               static_cast<int>(writeWindowType()));
    btConfig().setSessionValue(windowGroup + "syncWindowEnabled", action->isChecked());
}
	void execute()
	{
		QAction *action = CommandManager::instance()->getAction(MI_OnionSkin);
		if (!action)
			return;
		bool checked = action->isChecked();
#ifndef STUDENT
		enableOnionSkin(checked);
#endif
	}
int WTrackTableViewHeader::hiddenCount() {
    int count = 0;
    for (QMap<int, QAction*>::iterator it = m_columnActions.begin();
         it != m_columnActions.end(); it++) {
        QAction* pAction = *it;
        if (!pAction->isChecked())
            count += 1;
    }
    return count;
}