本文整理汇总了C++中QAction::activate方法的典型用法代码示例。如果您正苦于以下问题:C++ QAction::activate方法的具体用法?C++ QAction::activate怎么用?C++ QAction::activate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QAction
的用法示例。
在下文中一共展示了QAction::activate方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: update_override_shading_menu_item
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);
}
}
示例2: guiTests
//! 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);
}
示例3: on_activated
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);
}
示例4: mouseReleaseEvent
void ClickableMenu::mouseReleaseEvent(QMouseEvent *e)
{
QAction *action = actionAt(e->pos());
if (action) {
action->activate(QAction::Trigger);
return;
}
QMenu::mouseReleaseEvent(e);
}
示例5: eventFilter
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;
}
示例6: monthsComboBoxcurrentIndexChanged
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);
}
}
示例7: mouseReleaseEvent
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
}
示例8: enterEvent
void SizeChooserGrid::enterEvent(QEvent *event)
{
m_action->activate(QAction::Hover);
QFrame::enterEvent(event);
}
示例9: activate
void QActionProto::activate(int event)
{
QAction *item = qscriptvalue_cast<QAction*>(thisObject());
if (item)
item->activate((QAction::ActionEvent)event);
}