本文整理汇总了C++中QMenu::insertMenu方法的典型用法代码示例。如果您正苦于以下问题:C++ QMenu::insertMenu方法的具体用法?C++ QMenu::insertMenu怎么用?C++ QMenu::insertMenu使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QMenu
的用法示例。
在下文中一共展示了QMenu::insertMenu方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
QAction *QMenuProto::insertMenu(QAction *before, QMenu *menu)
{
QMenu *item = qscriptvalue_cast<QMenu*>(thisObject());
if (item)
return item->insertMenu(before, menu);
return 0;
}
示例2:
ModuleComponents::ModuleComponents(BCodeEditor *cedtr, QMainWindow *mw)
{
if (!cedtr || !mw) {
module = 0;
editor = 0;
window = 0;
menu = 0;
dock = 0;
return;
}
module = new PretexEditorModule;
editor = cedtr;
window = mw;
cedtr->addModule(module);
mw->installEventFilter(module->closeHandler());
module->restoreState(PretexEditorModulePlugin::moduleState(module));
dock = new QDockWidget;
dock->setObjectName("DockWidgetMacrosEditor");
dock->setAllowedAreas(Qt::TopDockWidgetArea | Qt::BottomDockWidgetArea);
dock->setWidget(module->widget(PretexEditorModule::PretexEditorWidget));
dock->installEventFilter(module->dropHandler());
mw->addDockWidget(Qt::BottomDockWidgetArea, dock);
QMenu *mnu = mw->findChild<QMenu *>("MenuTools");
QList<QAction *> acts = mnu->actions();
if (!acts.isEmpty()) {
menu = new QMenu;
mnu->insertSeparator(acts.first());
mnu->insertMenu(mnu->actions().first(), menu);
} else {
menu = mnu->addMenu("");
}
menu->setObjectName("MenuPretex");
menu->addActions(module->actions(true));
}
示例3: contextMenuEvent
/*!
* \internal
*/
void QwwRichTextEdit::contextMenuEvent(QContextMenuEvent * event)
{
QMenu *menu = createStandardContextMenu ( event->pos() );
QMenu *formatMenu = new QMenu(tr("Style"), menu);
formatMenu->addAction(m_actions[BoldAction]);
formatMenu->addAction(m_actions[ItalicAction]);
formatMenu->addAction(m_actions[UnderlineAction]);
menu->insertMenu(menu->actions()[9], formatMenu);
QMenu *alignMenu = new QMenu(tr("Align"), menu);
alignMenu->addAction(al);
alignMenu->addAction(ac);
alignMenu->addAction(ar);
alignMenu->addAction(aj);
menu->insertMenu(menu->actions()[10], alignMenu);
menu->exec(event->globalPos());
delete menu;
}
示例4: QMenu
QObject * ScriptToolbox::menuInsertMenu(QObject * menu, QObject * before, const QString & name)
{
QMenu * m = qobject_cast<QMenu*>(menu);
QAction * ba = qobject_cast<QAction*>(before);
QMenu * nm = new QMenu(name);
if (!ba && nm)
{
QMenu * bm = qobject_cast<QMenu*>(before);
if (bm)
ba = bm->menuAction();
}
if (ba && nm)
m->insertMenu(ba, nm);
return nm;
}