当前位置: 首页>>代码示例>>C++>>正文


C++ QMenu::menuAction方法代码示例

本文整理汇总了C++中QMenu::menuAction方法的典型用法代码示例。如果您正苦于以下问题:C++ QMenu::menuAction方法的具体用法?C++ QMenu::menuAction怎么用?C++ QMenu::menuAction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QMenu的用法示例。


在下文中一共展示了QMenu::menuAction方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: setupMenus

void ClintWindow::setupMenus() {
  m_menuBar = new QMenuBar(this);
  QMenu *fileMenu = new QMenu("File");
  fileMenu->addAction(m_actionFileOpen);
  fileMenu->addAction(m_actionFileSaveSvg);
  fileMenu->addAction(m_actionFileClose);
  fileMenu->addSeparator();
  fileMenu->addAction(m_actionFileQuit);

  QMenu *editMenu = new QMenu("Edit");
  editMenu->addAction(m_actionEditUndo);
  editMenu->addAction(m_actionEditRedo);
  editMenu->addSeparator();
  editMenu->addAction(m_actionEditVizProperties);

  QMenu *viewMenu = new QMenu("View");
  viewMenu->addAction(m_actionViewFreeze);
  viewMenu->addAction(m_actionViewProjectionMatrix);

  m_menuBar->addAction(fileMenu->menuAction());
  m_menuBar->addAction(editMenu->menuAction());
  m_menuBar->addAction(viewMenu->menuAction());
  m_menuBar->setNativeMenuBar(false);  // Override MacOS behavior since it does not display the menu

  setMenuBar(m_menuBar);
}
开发者ID:ftynse,项目名称:clint,代码行数:26,代码来源:clintwindow.cpp

示例2: createMenuBar

void MainWindow::createMenuBar()
{
    QMenuBar* menubar = new QMenuBar(this);
    QMenu* pMenuFile = new QMenu(tr("&File"), menubar);
    QMenu* pMenuEdit = new QMenu(tr("&Edit"), menubar);
    QMenu* pMenuView = new QMenu(tr("&View"), menubar);
    QMenu* pMenuWindow = new QMenu(tr("&Window"), menubar);
    QMenu* pMenuHelp = new QMenu(tr("&Help"), menubar);

    menubar->addAction(pMenuFile->menuAction());
    menubar->addAction(pMenuEdit->menuAction());
    menubar->addAction(pMenuView->menuAction());
#if !defined(Q_OS_MAC)
    menubar->addAction(pMenuWindow->menuAction());
#endif
    menubar->addAction(pMenuHelp->menuAction());

    pMenuFile->addAction(m_pActionStartSynergy);
    pMenuFile->addAction(m_pActionStopSynergy);
    pMenuFile->addSeparator();
    pMenuFile->addAction(m_pActionSave);
    pMenuFile->addSeparator();
    pMenuFile->addAction(m_pActionQuit);
    pMenuEdit->addAction(m_pActionSettings);
    pMenuView->addAction(m_pActionLogOutput);
    pMenuWindow->addAction(m_pActionMinimize);
    pMenuWindow->addAction(m_pActionRestore);
    pMenuHelp->addAction(m_pActionAbout);

    setMenuBar(menubar);
}
开发者ID:,项目名称:,代码行数:31,代码来源:

示例3: addFileMenu

void MenuBar::addFileMenu()
{
    QMenu *m = new QMenu(Qrc::text("menubar.file"), this);
    QMenu *o = new QMenu(Qrc::text("menubar.file.open"), m);
    o->addAction(Qrc::text("menubar.file.open.apk"), parent(), SLOT(onMenuBarFileOpenApk()), QKeySequence::New);
    o->addAction(Qrc::text("menubar.file.open.dir"), parent(), SLOT(onMenuBarFileOpenDir()), QKeySequence::Open);
    o->addSeparator();
    o->addAction(Qrc::text("menubar.file.open.file"), parent(), SLOT(onMenuBarFileOpenFile()));
    m->addAction(o->menuAction());
    m->addSeparator();
    m->addAction(Qrc::text("menubar.file.close"), parent(), SLOT(onMenuBarFileClose()), QKeySequence::Close);
    m->addAction(Qrc::text("menubar.file.close_all"), parent(), SLOT(onMenuBarFileCloseAll()));
    m->addSeparator();
    m->addAction(Qrc::text("menubar.file.save"), parent(), SLOT(onMenuBarFileSave()), QKeySequence::Save);
    m->addAction(Qrc::text("menubar.file.save_all"), parent(), SLOT(onMenuBarFileSaveAll()));
    m->addSeparator();
    QDir dir(Preferences::get()->previousProject());
    if (dir.exists() && dir.exists("apktool.yml"))
    {
        _connections << connect(m->addAction(dir.dirName()), &QAction::triggered, [=]
        {
            emit projectOpen(dir.absolutePath());
        });
    }
    else
    {
        m->addAction(Qrc::text("menubar.file.recent_none"))->setEnabled(false);
    }
    m->addSeparator();
    m->addAction(Qrc::text("menubar.file.terminal"), parent(), SLOT(onMenuBarFileTerminal()));
    m->addSeparator();
    m->addAction(Qrc::text("menubar.file.quit"), parent(), SLOT(onMenuBarFileQuit()), QKeySequence::Quit);
    addAction(m->menuAction());
}
开发者ID:kkodali,项目名称:apkstudio,代码行数:34,代码来源:menubar.cpp

示例4: addHelpMenu

void MenuBar::addHelpMenu()
{
    QMenu *m = new QMenu(__("help", "menubar"), this);
    m->addAction(__("about", "menubar"), parent(), SLOT(onMenuBarHelpAbout()));
    m->addAction(__("documentation", "menubar"), parent(), SLOT(onMenuBarHelpDocumentation()));
    m->addSeparator();
    QMenu *f = new QMenu(__("feedback", "menubar"), m);
    f->addAction(__("say_thanks", "menubar"), parent(), SLOT(onMenuBarHelpFeedbackThanks()));
    f->addAction(__("report_issues", "menubar"), parent(), SLOT(onMenuBarHelpFeedbackIssues()));
    m->addAction(f->menuAction());
    m->addAction(__("contribute", "menubar"), parent(), SLOT(onMenuBarHelpContribute()));
    addAction(m->menuAction());
}
开发者ID:AndroidTamer,项目名称:apkstudio,代码行数:13,代码来源:menubar.cpp

示例5: addHelpMenu

void MenuBar::addHelpMenu()
{
    QMenu *m = new QMenu(Qrc::text("menubar.help"), this);
    m->addAction(Qrc::text("menubar.help.about"), parent(), SLOT(onMenuBarHelpAbout()));
    m->addAction(Qrc::text("menubar.help.documentation"), parent(), SLOT(onMenuBarHelpDocumentation()));
    m->addSeparator();
    QMenu *f = new QMenu(Qrc::text("menubar.help.feedback"), m);
    f->addAction(Qrc::text("menubar.help.feedback.thanks"), parent(), SLOT(onMenuBarHelpFeedbackThanks()));
    f->addAction(Qrc::text("menubar.help.feedback.issues"), parent(), SLOT(onMenuBarHelpFeedbackIssues()));
    m->addAction(f->menuAction());
    m->addAction(Qrc::text("menubar.help.contribute"), parent(), SLOT(onMenuBarHelpContribute()));
    m->addSeparator();
    addAction(m->menuAction());
}
开发者ID:kkodali,项目名称:apkstudio,代码行数:14,代码来源:menubar.cpp

示例6: addMenu

void VrMenu::addMenu(QMenu* menu) {
    Q_ASSERT(!MenuUserData::hasData(menu->menuAction()));
    QObject* parent = menu->parent();
    QObject* qmlParent = nullptr;
    QMenu* parentMenu = dynamic_cast<QMenu*>(parent);
    if (parentMenu) {
        MenuUserData* userData = MenuUserData::forObject(parentMenu->menuAction());
        if (!userData) {
            return;
        }
        qmlParent = findMenuObject(userData->uuid.toString());
    } else if (dynamic_cast<QMenuBar*>(parent)) {
        qmlParent = _rootMenu;
    } else {
        Q_ASSERT(false);
    }
    QVariant returnedValue;
    bool invokeResult = QMetaObject::invokeMethod(qmlParent, "addMenu", Qt::DirectConnection,
                                                  Q_RETURN_ARG(QVariant, returnedValue),
                                                  Q_ARG(QVariant, QVariant::fromValue(menu->title())));
    Q_ASSERT(invokeResult);
    Q_UNUSED(invokeResult); // FIXME - apparently we haven't upgraded the Qt on our unix Jenkins environments to 5.5.x
    QObject* result = returnedValue.value<QObject*>();
    Q_ASSERT(result);
    if (!result) {
        qWarning() << "Unable to create QML menu for widget menu: " << menu->title();
        return;
    }

    // Bind the QML and Widget together
    new MenuUserData(menu->menuAction(), result);
}
开发者ID:kencooke,项目名称:hifi,代码行数:32,代码来源:VrMenu.cpp

示例7: QToolBar

QToolBar *String_Toolbar::create(QMainWindow *w) const
{
    QToolBar *toolbar = new QToolBar(title,w);
    toolbar->setObjectName(name);

    w->addToolBar(Qt::TopToolBarArea,toolbar);

    foreach(const QString&item, actions)
    {
        if ( item.isEmpty() )
            toolbar->addSeparator();
        else
        {
            QAction* act = w->findChild<QAction*>(item);

            if ( !act )
            {
                QMenu *menu = w->findChild<QMenu*>(item);
                if ( menu )
                    act = menu->menuAction();
            }

            if ( act )
                toolbar->addAction ( act );
            else
                qWarning() << QObject::tr("Warning:")
                          << QObject::tr("Unknown action %1").arg(item);
        }
    }

    return toolbar;
}
开发者ID:mbasaglia,项目名称:Knotter,代码行数:32,代码来源:string_toolbar.cpp

示例8:

QAction *QMenuProto::menuAction() const
{
  QMenu *item = qscriptvalue_cast<QMenu*>(thisObject());
  if (item)
    return item->menuAction();
  return 0;
}
开发者ID:,项目名称:,代码行数:7,代码来源:

示例9: insertMenuActions

bool ActionManager::insertMenuActions(const QString &idMenu, const QString &idBeforeSep, bool newGroup,  QList<QAction*> &actions)
{
    if (idMenu.isEmpty()) {
        return false;
    }
    QMenu *menu = loadMenu(idMenu);
    if (!menu) {
        return false;
    }
    if (newGroup) {
        QMenu *realMenu = menu->menuAction()->menu();
        if (realMenu) {
            if (!realMenu->actions().isEmpty() && !realMenu->actions().last()->isSeparator()) {
                menu->addSeparator();
            }
        } else {
            menu->addSeparator();
        }
    }
    QAction *sep = 0;
    if (!idBeforeSep.isEmpty()) {
        sep = m_idMenuSepMap[idMenu][idBeforeSep];
        if (!sep) {
            sep = menu->addSeparator();
            m_idMenuSepMap[idMenu].insert(idBeforeSep,sep);
        }
    }
    foreach (QAction *act, actions) {
        menu->insertAction(sep,act);
    }
开发者ID:visualfc,项目名称:liteide,代码行数:30,代码来源:actionmanager.cpp

示例10: UnInstall_MainMenu

void MenuManager::UnInstall_MainMenu()
{
	QMenu* pMenu = m_pMainWnd->menuGameObject;
	if(pMenu)
	{
		pMenu->clear();
		pMenu->menuAction()->setVisible(false);
	}

	pMenu = m_pMainWnd->menuComponent;
	if(pMenu)
	{
		pMenu->clear();
		pMenu->menuAction()->setVisible(false);
	}
}
开发者ID:,项目名称:,代码行数:16,代码来源:

示例11: Install_MainMenu

void MenuManager::Install_MainMenu()
{
	UnInstall_MainMenu();

	QMenu* pMenu = m_pMainWnd->menuGameObject;
	pMenu->clear();
	Install_Menu_GameObject(pMenu);
	pMenu->menuAction()->setVisible(true);


	pMenu = m_pMainWnd->menuComponent;
	pMenu->clear();
	Install_Menu_Component(pMenu);
	pMenu->menuAction()->setVisible(true);

}
开发者ID:,项目名称:,代码行数:16,代码来源:

示例12: waitForPopup

/*
    Checks if an expanded toolbar has to wait for this popup to close before
    the toolbar collapses. This is true if
    1) the popup has the toolbar in its parent chain,
    2) the popup is a menu whose menuAction is somewhere in the toolbar.
*/
static bool waitForPopup(QToolBar *tb, QWidget *popup)
{
    if (popup == 0 || popup->isHidden())
        return false;

    QWidget *w = popup;
    while (w != 0) {
        if (w == tb)
            return true;
        w = w->parentWidget();
    }

    QMenu *menu = qobject_cast<QMenu*>(popup);
    if (menu == 0)
        return false;

    QAction *action = menu->menuAction();
    QList<QWidget*> widgets = action->associatedWidgets();
    for (int i = 0; i < widgets.count(); ++i) {
        if (waitForPopup(tb, widgets.at(i)))
            return true;
    }

    return false;
}
开发者ID:dirlinch,项目名称:chromecast-mirrored-source.vendor,代码行数:31,代码来源:qtoolbar.cpp

示例13: aboutToShow

void QMenuViewPrivate::aboutToShow()
{
    QMenu* menu = qobject_cast<QMenu*> (sender());

    if(menu)
    {
        QVariant v = menu->menuAction()->data();

        if(v.canConvert<QModelIndex>())
        {
            QModelIndex idx = qvariant_cast<QModelIndex> (v);
            _menu->createMenu(idx, *menu, menu);
            disconnect(menu, SIGNAL(aboutToShow()), this, SLOT(aboutToShow()));
            return;
        }
    }

    _menu->clear();

    if(_menu->prePopulated())
    {
        _menu->addSeparator();
    }

    _menu->createMenu(m_root, *_menu, _menu);

    _menu->postPopulated();
}
开发者ID:gitter-badger,项目名称:i-score,代码行数:28,代码来源:qmenuview.cpp

示例14: QLabel

void BitcoinGUI::createToolBars2()
{
    QLabel *mylabel = new QLabel (this);
   mylabel->setPixmap(QPixmap(":images/head"));
   mylabel->show();

    QToolBar *toolbar = addToolBar(tr("Tabs toolbar"));
    toolbar->setObjectName("toolbar");
    addToolBar(Qt::LeftToolBarArea,toolbar);
    toolbar->setOrientation(Qt::Vertical);
    toolbar->setMovable( false );
    toolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
    toolbar->setIconSize(QSize(50,25));
    toolbar->addWidget(mylabel);
    toolbar->addAction(overviewAction);
    toolbar->addAction(sendCoinsAction);
    toolbar->addAction(receiveCoinsAction);
    toolbar->addAction(historyAction);
    toolbar->addAction(addressBookAction);
    toolbar->addAction(blockAction);
    toolbar->addAction(statisticsAction);
    toolbar->addAction(optionsAction);

    QWidget* spacer = new QWidget();
    spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    toolbar->addWidget(spacer);
    spacer->setObjectName("spacer");
    toolbar->setStyleSheet(
    "#toolbar { font-weight:600;border:none;height:100%;padding-top:20px; background: rgb(37,40,46); text-align: left; color: white;min-width:180px;max-width:180px;}"
    "QToolBar QToolButton:hover {background:rgb(28,29,33);}"
    "QToolBar QToolButton:checked {background:rgba(28,29,33,100);}"
    "QToolBar QToolButton { font-weight:600;font-size:10px;font-family:'Century Gothic';padding-left:20px;padding-right:181px;padding-top:5px;padding-bottom:5px; width:100%; color: white; text-align: left; background:transparent;text-transform:uppercase; }");

    wId = new QWidget(this);
    wId3 = new QWidget(this);
    QToolBar *toolbars = addToolBar(tr("Settings2"));
    addToolBar(Qt::RightToolBarArea,toolbars);
    toolbars->setOrientation(Qt::Horizontal);
    toolbars->setMovable( false );
    toolbars->setStyleSheet("QToolBar QToolButton {border:0px;margin-right:3px} QToolBar{ border:0px; }");
    toolbars->setIconSize(QSize(102,25));
    QHBoxLayout *vbox5 = new QHBoxLayout();
    vbox5->addWidget(toolbars);
    vbox5->setContentsMargins(0,0,0,0);
    wId3->setFixedSize(250,30);
    wId3->move(260,10);
    wId3->setLayout(vbox5);
    wId3->setFocus();
    wId3->raise();
    QMenu *menu = new QMenu(tr("Mini"));
    menu->setStyleSheet("border:none;background:none;");
    menu->addAction(toggleHideAction);
    menu->menuAction()->setIcon(QIcon(":/icons/mini"));
    QHBoxLayout *vbox3 = new QHBoxLayout();
    vbox3->setContentsMargins(0,0,0,0);
    wId->setFixedSize(120,40);
    wId->move(915,1);
    wId->setLayout(vbox3);
    wId->setFocus();
}
开发者ID:roscoin1,项目名称:roscoin,代码行数:60,代码来源:bitcoingui.cpp

示例15: setMainWidget

// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
void Application::setMainWidget(QWidget* w) {
	_mainWidget = w;

	QMainWindow *mw = dynamic_cast<QMainWindow*>(w);
	if ( mw ) {
		QMenu *helpMenu = mw->menuBar()->findChild<QMenu*>("menuHelp");
		if ( helpMenu == NULL ) {
			helpMenu = new QMenu(mw->menuBar());
			helpMenu->setObjectName("menuHelp");
			helpMenu->setTitle("&Help");
			mw->menuBar()->addAction(helpMenu->menuAction());
		}

		QAction *a = helpMenu->addAction("&About SeisComP3");
		connect(a, SIGNAL(triggered()), this, SLOT(showAbout()));

		a = helpMenu->addAction("&Documenation index");
		a->setShortcut(QKeySequence("F1"));
		connect(a, SIGNAL(triggered()), this, SLOT(showHelpIndex()));

		a = helpMenu->addAction(QString("Documentation for %1").arg(name().c_str()));
		a->setShortcut(QKeySequence("Shift+F1"));
		connect(a, SIGNAL(triggered()), this, SLOT(showAppHelp()));

		a = helpMenu->addAction("&Loaded Plugins");
		connect(a, SIGNAL(triggered()), this, SLOT(showPlugins()));
	}

	if ( _splash )
		_splash->finish(w);
}
开发者ID:Fran89,项目名称:seiscomp3,代码行数:32,代码来源:application.cpp


注:本文中的QMenu::menuAction方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。