void MainWindow::update_override_shading_menu_item() { const ParamArray project_params = get_project_params("interactive"); const ParamArray shading_engine_params = project_params.child("shading_engine"); if (shading_engine_params.dictionaries().exist("override_shading")) { const string shading_mode = shading_engine_params.child("override_shading").get_optional<string>("mode", "coverage"); for (const_each<QList<QAction*> > i = m_ui->menu_diagnostics_override_shading->actions(); i; ++i) { QAction* action = *i; if (action->data().toString().toStdString() == shading_mode) { action->activate(QAction::Trigger); break; } } } else { m_ui->action_diagnostics_override_shading_no_override->activate(QAction::Trigger); } }
//! Entry point for BitcoinGUI tests. void AppTests::guiTests(BitcoinGUI* window) { HandleCallback callback{"guiTests", *this}; connect(window, &BitcoinGUI::consoleShown, this, &AppTests::consoleTests); expectCallback("consoleTests"); QAction* action = window->findChild<QAction*>("openRPCConsoleAction"); action->activate(QAction::Trigger); }
void CacicSysTray::on_activated(QSystemTrayIcon::ActivationReason reason) { qDebug() << "sysTrayClicked" << endl; QMenu* menu = sysTray->contextMenu(); QAction* actionPressed = menu->exec(sysTray->geometry().topLeft()); if(actionPressed != 0) actionPressed->activate(QAction::Trigger); }
void ClickableMenu::mouseReleaseEvent(QMouseEvent *e) { QAction *action = actionAt(e->pos()); if (action) { action->activate(QAction::Trigger); return; } QMenu::mouseReleaseEvent(e); }
bool KoPageNavigator::eventFilter(QObject *watched, QEvent *event) { if (event->type() == QEvent::FocusOut && watched == d->pageNumberEdit) { if (! underMouse()) { setCurrentIndex(Display); } // reset editor in any case KoPADocument *const kopaDocument = d->view->kopaDocument(); KoPAPageBase *const activePage = d->view->activePage(); const int pageNumber = kopaDocument->pageIndex(activePage) + 1; const QString text = (pageNumber > 0) ? QString::number(pageNumber) : QString(); d->pageNumberEdit->setText(text); } else if (event->type() == QEvent::Wheel) { // Scroll the pages by the wheel // Because the numbers are representatives of the actual pages // and the list of pages is ordered by smaller number first, // here an increasing delta means going up in the list, so go to // smaller page numbers, and vice versa. QWheelEvent *wheelEvent = static_cast<QWheelEvent*>(event); const int delta = wheelEvent->delta(); // trigger the respective actions if (delta > 0) { QAction *gotoPreviousPageAction = d->gotoPreviousPageButton->action(); if (gotoPreviousPageAction->isEnabled()) { gotoPreviousPageAction->activate(QAction::Trigger); } } else if (delta < 0) { QAction *gotoNextPageAction = d->gotoNextPageButton->action(); if (gotoNextPageAction->isEnabled()) { gotoNextPageAction->activate(QAction::Trigger); } } // scroll wheel events also cancel the editing, // so move focus out of the pageNumberEdit if (d->pageNumberEdit->hasFocus()) { d->view->setFocus(); } } return false; }
void LedgerViewer::monthsComboBoxcurrentIndexChanged(const QString& month){ Q_UNUSED(month); if (WarnDebugMessage) qDebug() << __FILE__ << QString::number(__LINE__) << " in monthsComboBoxcurrentIndexChanged , month = "+month ; if (WarnDebugMessage) qDebug() << __FILE__ << QString::number(__LINE__) << " m_actionText =" << m_actionText ; if (m_actionText.isEmpty()) { //Utils::warningMessageBox(tkTr(Trans::Constants::ERROR), tr("Choose an action.")); return; } else { QAction * chosenAction = m_hashTextAndAction.value(m_actionText); chosenAction->activate(QAction::Trigger); } }
void PopupMenu::mouseReleaseEvent(QMouseEvent *e) { DEBUG_PRST_ROUTES(stderr, "PopupMenu::mouseReleaseEvent this:%p\n", this); if(_contextMenu && _contextMenu->isVisible()) return; // Removed by Tim. Why not stay-open scrollable menus? // if(MusEGlobal::config.scrollableSubMenus) // { // QMenu::mouseReleaseEvent(e); // return; // } QAction* action = actionAt(e->pos()); if (!(action && action == activeAction() && !action->isSeparator() && action->isEnabled())) action=NULL; #ifdef POPUP_MENU_DISABLE_STAY_OPEN if (action && action->menu() != NULL && action->isCheckable()) action->activate(QAction::Trigger); QMenu::mouseReleaseEvent(e); if (action && action->menu() != NULL && action->isCheckable()) close(); return; #else // Check for Ctrl to stay open. const bool stay_open = _stayOpen && (MusEGlobal::config.popupsDefaultStayOpen || (e->modifiers() & Qt::ControlModifier)); // Stay open? Or does the action have a submenu, but also a checkbox of its own? if(action && (stay_open || (action->isEnabled() && action->menu() && action->isCheckable()))) { DEBUG_PRST_ROUTES(stderr, "PopupMenu::mouseReleaseEvent: stay open\n"); action->trigger(); // Trigger the action. e->accept(); if(!stay_open) closeUp(); return; // We handled it. } // Otherwise let ancestor QMenu handle it... e->ignore(); QMenu::mouseReleaseEvent(e); #endif // POPUP_MENU_DISABLE_STAY_OPEN }
void SizeChooserGrid::enterEvent(QEvent *event) { m_action->activate(QAction::Hover); QFrame::enterEvent(event); }
void QActionProto::activate(int event) { QAction *item = qscriptvalue_cast<QAction*>(thisObject()); if (item) item->activate((QAction::ActionEvent)event); }