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


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

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


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

示例1: genCreateMenu

QMenu* MuseScore::genCreateMenu(QWidget* parent)
      {
      QMenu* popup = new QMenu(tr("&Create"), parent);
      popup->setObjectName("Create");

      popup->addAction(getAction("instruments"));

      QMenu* measures = popup->addMenu(tr("&Measures"));
      measures->addAction(getAction("insert-measure"));
      measures->addAction(getAction("insert-measures"));
      measures->addSeparator();
      measures->addAction(getAction("append-measure"));
      measures->addAction(getAction("append-measures"));

      QMenu* frames = popup->addMenu(tr("&Frames"));
      frames->addAction(getAction("insert-hbox"));
      frames->addAction(getAction("insert-vbox"));
      frames->addAction(getAction("insert-textframe"));
      if(enableExperimental)
            frames->addAction(getAction("insert-fretframe"));
      frames->addSeparator();
      frames->addAction(getAction("append-hbox"));
      frames->addAction(getAction("append-vbox"));
      frames->addAction(getAction("append-textframe"));

      QMenu* text = popup->addMenu(tr("&Text"));
      text->addAction(getAction("title-text"));
      text->addAction(getAction("subtitle-text"));
      text->addAction(getAction("composer-text"));
      text->addAction(getAction("poet-text"));
      text->addSeparator();
      text->addAction(getAction("system-text"));
      text->addAction(getAction("staff-text"));
      text->addAction(getAction("chord-text"));
      text->addAction(getAction("rehearsalmark-text"));
      text->addSeparator();
      text->addAction(getAction("lyrics"));
      text->addAction(getAction("tempo"));

      popup->addSeparator();
      popup->addAction(getAction("add-slur"));
      popup->addAction(getAction("add-hairpin"));
      popup->addAction(getAction("add-hairpin-reverse"));
      popup->addAction(getAction("add-noteline"));
      return popup;
      }
开发者ID:joambi,项目名称:MuseScoreSSMN,代码行数:46,代码来源:menus.cpp

示例2: QMenu

/*!
    Creates a new menu with the given \a id.

    Returns a new ActionContainer that you can use to get the QMenu instance
    or to add menu items to the menu. The ActionManager owns
    the returned ActionContainer.
    Add your menu to some other menu or a menu bar via the
    ActionManager::actionContainer and ActionContainer::addMenu functions.
*/
ActionContainer *ActionManager::createMenu(Id id)
{
    const ActionManagerPrivate::IdContainerMap::const_iterator it = d->m_idContainerMap.constFind(id);
    if (it !=  d->m_idContainerMap.constEnd())
        return it.value();

    QMenu *m = new QMenu(ICore::mainWindow());
    m->setObjectName(QLatin1String(id.name()));

    MenuActionContainer *mc = new MenuActionContainer(id);
    mc->setMenu(m);

    d->m_idContainerMap.insert(id, mc);
    connect(mc, SIGNAL(destroyed()), d, SLOT(containerDestroyed()));

    return mc;
}
开发者ID:ntrincano,项目名称:qt-creator,代码行数:26,代码来源:actionmanager.cpp

示例3: QMenu

ActionContainer *ActionManagerPrivate::createMenu(const QString &id)
{
    const int uid = UniqueIDManager::instance()->uniqueIdentifier(id);
    const IdContainerMap::const_iterator it = m_idContainerMap.constFind(uid);

    if (it != m_idContainerMap.constEnd()) {
        return it.value();
    }

    QMenu *m = new QMenu(m_mainWnd);
    m->setObjectName(id);

    MenuActionContainer *mc = new MenuActionContainer(uid);
    mc->setMenu(m);

    m_idContainerMap.insert(uid, mc);

    return mc;
}
开发者ID:MorS25,项目名称:OpenPilot,代码行数:19,代码来源:actionmanager.cpp

示例4: initModuleMenu

QMenu* ModuleExtEdit::initModuleMenu()
{
    QList<QAction*> list;
    QStringList appList = _extEdit->listAppNames();

    for (int i = 0; i < appList.count(); ++i)
    {
        QAction* action = new QAction(0);
        action->setText(appList.at(i));
        QObject::connect(action, SIGNAL(triggered(bool)), _extEdit, SLOT(runExternalEditor()));
        list.append(action);
        _extEdit->addAppAction(action);
    }

    QMenu *menu = new QMenu(QObject::tr("Edit in..."), 0);
    menu->addActions(list);
    menu->setObjectName("menuExtedit");
    return menu;
}
开发者ID:JHooverman,项目名称:screengrab,代码行数:19,代码来源:moduleextedit.cpp

示例5: QMenu

QMenu *ActionManager::insertMenu(const QString &id, const QString &title, const QString &idBefore)
{    
    QMenu *menu = m_idMenuMap.value(id);
    if (menu) {
        return menu;
    }
    menu = new QMenu(title,m_liteApp->mainWindow());
    menu->setObjectName(id);
    QMenu *m = 0;
    if (!idBefore.isEmpty()) {
        m = m_idMenuMap.value(idBefore);
    }
    if (m) {
        m_liteApp->mainWindow()->menuBar()->insertMenu(m->menuAction(),menu);
    } else {
        m_liteApp->mainWindow()->menuBar()->addAction(menu->menuAction());
    }
    m_idMenuMap.insert(id,menu);
    return menu;
}
开发者ID:visualfc,项目名称:liteide,代码行数:20,代码来源:actionmanager.cpp

示例6: buildEditMenu

//-----------------------------------------------------------------------------
void swftParaViewMenuBuilders::buildEditMenu(QMenu& menu)
{
  QString objectName = menu.objectName();
  Ui::pqEditMenuBuilder ui;
  ui.setupUi(&menu);
  // since the UI file tends to change the name of the menu.
  menu.setObjectName(objectName);

  new pqUndoRedoReaction(ui.actionEditUndo, true);
  new pqUndoRedoReaction(ui.actionEditRedo, false);
  new pqCameraUndoRedoReaction(ui.actionEditCameraUndo, true);
  new pqCameraUndoRedoReaction(ui.actionEditCameraRedo, false);
  new pqChangePipelineInputReaction(ui.actionChangeInput);
  new pqIgnoreSourceTimeReaction(ui.actionIgnoreTime);
  new pqDeleteReaction(ui.actionDelete);
  new pqDeleteReaction(ui.actionDelete_All, true);
  new pqCopyReaction(ui.actionCopy);
  new pqCopyReaction(ui.actionPaste, true);
  new pqApplicationSettingsReaction(ui.actionEditSettings);
  new pqViewSettingsReaction(ui.actionEditViewSettings);
  new pqDataQueryReaction(ui.actionQuery);
}
开发者ID:ghost-kit,项目名称:archive,代码行数:23,代码来源:swftParaViewMenuBuilders.cpp

示例7: createNaviCubeMenu

QMenu* NaviCubeImplementation::createNaviCubeMenu() {
	QMenu* menu = new QMenu(getMainWindow());
	menu->setObjectName(str("NaviCube_Menu"));

	CommandManager &rcCmdMgr = Application::Instance->commandManager();
	vector<Command*> commands;
	commands.push_back( new ViewOrthographicCmd());
	commands.push_back( new ViewPerspectiveCmd());
	commands.push_back( 0);
	commands.push_back( new ViewZoomToFitCmd());
    //commands.push_back( 0);
    //commands.push_back( new ViewNormalToSketchPlaneCmd());
	for (vector<Command*>::iterator i=commands.begin(); i!=commands.end(); i++) {
		if (*i) {
			rcCmdMgr.addCommand(*i);
			(*i)->addTo(menu);
		}
		else
			menu->addSeparator();
	}

	return menu;
}
开发者ID:lanigb,项目名称:FreeCAD,代码行数:23,代码来源:NaviCube.cpp

示例8: entryPoint

/**
\param bges
\return
**/
int entryPoint ( BfBulmaFact *bges )
{
    BL_FUNC_DEBUG

    g_pluginbf_bulmatpv = bges;
    
    /// Inicializa el sistema de traducciones 'gettext'.
    setlocale ( LC_ALL, "" );
    blBindTextDomain ( "pluginbf_bulmatpv", g_confpr->value( CONF_DIR_TRADUCCION ).toLatin1().constData() );

    /// Miramos si existe un menu Ventas
    QMenu *pPluginMenu = NULL;
    pPluginMenu = bges->menuBar() ->findChild<QMenu *> ( "menuVentas" );
    
    /// Creamos el men&uacute;.
    if ( !pPluginMenu ) {
        QMenu *pPluginVentas = NULL;
        pPluginVentas = bges->menuBar() ->findChild<QMenu *> ( "menuMaestro" );
        pPluginMenu = new QMenu ( _("&Ventas"), bges->menuBar() );
        pPluginMenu->setObjectName ( QString::fromUtf8 ( "menuVentas" ) );
        bges->menuBar()->insertMenu ( pPluginVentas->menuAction(), pPluginMenu );
    } // end if

    /// Creamos el men&uacute;.
    BlAction *accionA = new BlAction ( _("&Cuadres de caja"), 0 );
    accionA->setStatusTip ( _("Listado de cuadres de caja") );
    accionA->setWhatsThis ( _("Listado de cuadres de caja") );
    accionA->setObjectName("mui_actionCuadresCaja");
    
    /// A&ntilde;adimos la nueva opci&oacute;n al men&uacute; principal del programa.
    pPluginMenu->addSeparator();
    pPluginMenu->addAction ( accionA );


    
    return 0;
}
开发者ID:JustDevZero,项目名称:bulmages,代码行数:41,代码来源:pluginbf_bulmatpv.cpp

示例9: leaveEditMode

void QDesignerMenuBar::leaveEditMode(LeaveEditMode mode)
{
    m_editor->releaseKeyboard();

    if (mode == Default)
        return;

    if (m_editor->text().isEmpty())
        return;

    QAction *action = 0;

    QDesignerFormWindowInterface *fw = formWindow();
    Q_ASSERT(fw);

    if (m_currentIndex >= 0 && m_currentIndex < realActionCount()) {
        action = safeActionAt(m_currentIndex);
        fw->beginCommand(QApplication::translate("Command", "Change Title"));
    } else {
        fw->beginCommand(QApplication::translate("Command", "Insert Menu"));
        const QString niceObjectName = ActionEditor::actionTextToName(m_editor->text(), QStringLiteral("menu"));
        QMenu *menu = qobject_cast<QMenu*>(fw->core()->widgetFactory()->createWidget(QStringLiteral("QMenu"), this));
        fw->core()->widgetFactory()->initialize(menu);
        menu->setObjectName(niceObjectName);
        menu->setTitle(tr("Menu"));
        fw->ensureUniqueObjectName(menu);
        action = menu->menuAction();
        AddMenuActionCommand *cmd = new AddMenuActionCommand(fw);
        cmd->init(action, m_addMenu, this, this);
        fw->commandHistory()->push(cmd);
    }

    SetPropertyCommand *cmd = new SetPropertyCommand(fw);
    cmd->init(action, QStringLiteral("text"), m_editor->text());
    fw->commandHistory()->push(cmd);
    fw->endCommand();
}
开发者ID:SchleunigerAG,项目名称:WinEC7_Qt5.3.1_Fixes,代码行数:37,代码来源:qdesigner_menubar.cpp

示例10: Home

void pdp::MainWindow::setupUi() {
	// Add back button
	QPushButton* back = new QPushButton(QIcon(":/common/res/common/back.png"), QApplication::translate("MainWindow", "Zur\303\274ck", 0, QApplication::UnicodeUTF8));
    ui_main.tabWidget->setCornerWidget(back, Qt::TopRightCorner);
    QObject::connect(back, SIGNAL(clicked()), this, SLOT(onBack()));
	
    // Add the "start" tab.
    new pdp::Home(this->ui_main.tabWidget, this);

	// Creates progressDialog
	m_progressDialog = new QProgressDialog("", QString(), 0, 100, this);
	m_progressDialog->setMinimumDuration(0);
	//m_progressDialog->setWindowModality(Qt::WindowModal);

	// Correction of automatic segmentation via 3d interactive segmentation	
	m_NumberOfInstancesOfThreeDEditing = 0;
	QMenu *menuWerkzeug;
	menuWerkzeug = new QMenu(ui_main.menubar);
    menuWerkzeug->setObjectName(QString::fromUtf8("menuWerkzeug"));
	menuWerkzeug->setTitle(QApplication::translate("MainWindow", "Werkzeug", 0, QApplication::UnicodeUTF8));
	ui_main.menubar->addMenu(menuWerkzeug);
    
	QAction *actionThreeDEditing = new QAction(this);
	actionThreeDEditing->setObjectName(QString::fromUtf8("actionThreeDEditing"));
	actionThreeDEditing->setIconText("3DEditing");
	QIcon icn_menu;
	icn_menu.addFile(":/threeDEditing/res/threeDEditing/Rubber-32.png");
	actionThreeDEditing->setIcon(icn_menu);
	menuWerkzeug->addAction(actionThreeDEditing);

	QObject::connect(actionThreeDEditing, SIGNAL(triggered()), this, SLOT(CreateThreeDEditing()));
	
	// AutoRun
	if(AUTO_IMPORT == 1)
		CreateThreeDEditing();
}
开发者ID:hksonngan,项目名称:phan-anh-pdp,代码行数:36,代码来源:mainwindow.cpp

示例11: iname


//.........这里部分代码省略.........
        // C.  This is obviously ridiculous, but the fact that we have programName
        // here at all makes me think it exists as some kind of necessary hack
        // to coax tr() into behaving nicely.  I decided to change it as little
        // as possible to get it to compile, and not refactor this down to the
        // simplest way to call tr() on a C string.
        QString programName(strtoqstr((*it)->getProgramName()));
        programName = QObject::tr(programName.toStdString().c_str());

        Device *device = (*it)->getDevice();
        DeviceId devId = device->getId();
        bool connectedIcon = false;

        // Determine the proper program name and whether it is connected

        if ((*it)->getType() == Instrument::SoftSynth) {
            programName = "";
            AudioPluginInstance *plugin =
                    (*it)->getPlugin(Instrument::SYNTH_PLUGIN_POSITION);
            if (plugin) {
                // we don't translate any plugin program names or other texts
                programName = strtoqstr(plugin->getDisplayName());
                connectedIcon = (plugin->getIdentifier() != "");
            }
        } else if ((*it)->getType() == Instrument::Audio) {
            connectedIcon = true;
        } else {
            QString conn = RosegardenSequencer::getInstance()->
                    getConnection(devId);
            connectedIcon = (conn != "");
        }

        // These two are for selecting the correct icon to display.
        bool instrUsedByMe = false;
        bool instrUsedByAnyone = false;

        if (thisTrackInstr && thisTrackInstr->getId() == (*it)->getId()) {
            instrUsedByMe = true;
            instrUsedByAnyone = true;
        }

        // If we have switched to a new device, we'll create a new submenu
        if (devId != (DeviceId)(currentDevId)) {

            currentDevId = int(devId);

            // For selecting the correct icon to display.
            bool deviceUsedByAnyone = false;

            if (instrUsedByMe)
                deviceUsedByAnyone = true;
            else {
                for (Composition::trackcontainer::iterator tit =
                         comp.getTracks().begin();
                     tit != comp.getTracks().end(); ++tit) {

                    if (tit->second->getInstrument() == (*it)->getId()) {
                        instrUsedByAnyone = true;
                        deviceUsedByAnyone = true;
                        break;
                    }

                    Instrument *instr =
                        studio.getInstrumentById(tit->second->getInstrument());
                    if (instr && (instr->getDevice()->getId() == devId)) {
                        deviceUsedByAnyone = true;
                    }
                }
            }

            QIcon icon
                (connectedIcon ?
                 (deviceUsedByAnyone ?
                  connectedUsedPixmap : connectedPixmap) :
                 (deviceUsedByAnyone ?
                  unconnectedUsedPixmap : unconnectedPixmap));

            // Create a submenu for this device
            QMenu *subMenu = new QMenu(instrumentPopup);
            subMenu->setMouseTracking(true);
            subMenu->setIcon(icon);
            // Not needed so long as AA_DontShowIconsInMenus is false.
            //subMenu->menuAction()->setIconVisibleInMenu(true);

            // Menu title
            QString deviceName = QObject::tr(device->getName().c_str());
            subMenu->setTitle(deviceName);

            // QObject name
            subMenu->setObjectName(deviceName);

            // Add the submenu to the popup menu
            instrumentPopup->addMenu(subMenu);

            // Connect the submenu to slotInstrumentSelected()
            connect(subMenu, SIGNAL(triggered(QAction*)),
                    this, SLOT(slotInstrumentSelected(QAction*)));

            currentSubMenu = subMenu;

        } else if (!instrUsedByMe) {
开发者ID:tedfelix,项目名称:rosegarden,代码行数:101,代码来源:TrackButtons.cpp

示例12: QAction

//-------------------------------------------------------------------------
QMenu *  QGuidoItemContainer::buildContextMenu()
{
	QMenu * menu = QLanguageItem::buildContextMenu();

	QAction * exportAct = new QAction( "Export" , this );
	connect( exportAct , SIGNAL( triggered() ) , this , SIGNAL( exportItem() ) );
	menu->addAction( exportAct );

	QMenu * layoutMenu = menu->addMenu( CONTEXT_MENU_LAYOUT );
	layoutMenu->setObjectName( CONTEXT_MENU_LAYOUT );
	
	//Layout actions :Proportional layout
	QString layoutProportionalMsg = QString("Switch ") + ( mIsProportionalOn ? "OFF" : "ON" ) + " Proportionnal layout";
	QAction * layoutProportionalSwitch = new QAction( layoutProportionalMsg , layoutMenu );
	connect( layoutProportionalSwitch , SIGNAL(triggered()) , this , SLOT(switchProportional()) );
	layoutMenu->addAction(layoutProportionalSwitch);

	//Layout actions : Optimal page fill
	QString layoutOptimalPageFillMsg = QString("Switch ") + ( mIsOptimalPageFillOn ? "OFF" : "ON" ) + " Optimal page fill";		
	QAction * layoutOptimalPageFillSwitch = new QAction( layoutOptimalPageFillMsg , layoutMenu );
	connect( layoutOptimalPageFillSwitch , SIGNAL(triggered()) , this , SLOT(switchOptimalPageFill()) );
	layoutMenu->addAction(layoutOptimalPageFillSwitch);	

	//Layout actions : Auto-resizePageToMusic
	QString layoutResizePageMsg = QString("Switch ") + ( mGuidoItem->isResizePageToMusic() ? "OFF" : "ON" ) + " Auto Resize-Page";		
	QAction * layoutResizePageSwitch = new QAction( layoutResizePageMsg , layoutMenu );
	connect( layoutResizePageSwitch , SIGNAL(triggered()) , this , SLOT(switchResizePage()) );
	layoutMenu->addAction(layoutResizePageSwitch);	

//"Change the current page" actions.
	QAction * firstPage = new QAction( "First page" , this );
	QAction * previousPage = new QAction( "Previous page" , this );
	QAction * nextPage = new QAction( "Next page" , this );
	QAction * lastPage = new QAction( "Last page" , this );
	
	connect(firstPage , SIGNAL(triggered()) , this , SLOT(firstPage()) );
	connect(previousPage , SIGNAL(triggered()) , this , SLOT(previousPage()) );
	connect(nextPage , SIGNAL(triggered()) , this , SLOT(nextPage()) );
	connect(lastPage , SIGNAL(triggered()) , this , SLOT(lastPage()) );

	layoutMenu->addAction( newSeparator(this) );
	layoutMenu->addAction(firstPage);
	layoutMenu->addAction(previousPage);
	layoutMenu->addAction(nextPage);
	layoutMenu->addAction(lastPage);

/*
	bool onceOnly = false;
	for ( int i = 0 ; i < menu->actions().size() ; i++ )
	{
		if ( menu->actions()[i]->data().toString() == CONTEXT_MENU_LAYOUT )
		{
			if ( !onceOnly )
			{
				layoutMenu->addSeparator();
				onceOnly = true;
			}
//			qDebug("QGuidoItemContainer::buildContextMenu() : action removed from menu and added to ");
			layoutMenu->addAction( menu->actions()[i] );
			menu->actions()[i]->setParent( layoutMenu );
			menu->removeAction( menu->actions()[i] );
			i--;
		}
	}
*/

	return menu;
}
开发者ID:EQ4,项目名称:guido-engine,代码行数:69,代码来源:QGuidoItemContainer.cpp

示例13: PostWindowCreate

void QmitkExtWorkbenchWindowAdvisor::PostWindowCreate()
{
 QmitkCommonWorkbenchWindowAdvisor::PostWindowCreate();
 // very bad hack...
 berry::IWorkbenchWindow::Pointer window =
  this->GetWindowConfigurer()->GetWindow();
 QMainWindow* mainWindow =
  static_cast<QMainWindow*> (window->GetShell()->GetControl());

 if (!windowIcon.empty())
 {
  mainWindow->setWindowIcon(QIcon(QString::fromStdString(windowIcon)));
 }
 mainWindow->setContextMenuPolicy(Qt::PreventContextMenu);

 /*mainWindow->setStyleSheet("color: white;"
 "background-color: #808080;"
 "selection-color: #659EC7;"
 "selection-background-color: #808080;"
 " QMenuBar {"
 "background-color: #808080; }");*/

 // ==== Application menu ============================
 QMenuBar* menuBar = mainWindow->menuBar();
 menuBar->setContextMenuPolicy(Qt::PreventContextMenu);

 QMenu* fileMenu = menuBar->addMenu("&File");
 fileMenu->setObjectName("FileMenu");

 QAction* fileOpenAction = new QmitkExtFileOpenAction(QIcon(":/org.mitk.gui.qt.ext/Load_48.png"), window);
 fileMenu->addAction(fileOpenAction);
 fileSaveProjectAction = new QmitkExtFileSaveProjectAction(window);
 fileSaveProjectAction->setIcon(QIcon(":/org.mitk.gui.qt.ext/Save_48.png"));
 fileMenu->addAction(fileSaveProjectAction);
 closeProjectAction = new QmitkCloseProjectAction(window);
 closeProjectAction->setIcon(QIcon(":/org.mitk.gui.qt.ext/Remove_48.png"));
 fileMenu->addAction(closeProjectAction);
 fileMenu->addSeparator();
 QAction* fileExitAction = new QmitkFileExitAction(window);
 fileExitAction->setObjectName("QmitkFileExitAction");
 fileMenu->addAction(fileExitAction);

 berry::IViewRegistry* viewRegistry =
  berry::PlatformUI::GetWorkbench()->GetViewRegistry();
 const std::vector<berry::IViewDescriptor::Pointer>& viewDescriptors =
  viewRegistry->GetViews();

 // another bad hack to get an edit/undo menu...
 QMenu* editMenu = menuBar->addMenu("&Edit");
 undoAction = editMenu->addAction(QIcon(":/org.mitk.gui.qt.ext/Undo_48.png"),
  "&Undo",
  QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onUndo()),
  QKeySequence("CTRL+Z"));
 undoAction->setToolTip("Undo the last action (not supported by all modules)");
 redoAction = editMenu->addAction(QIcon(":/org.mitk.gui.qt.ext/Redo_48.png")
  , "&Redo",
  QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onRedo()),
  QKeySequence("CTRL+Y"));
 redoAction->setToolTip("execute the last action that was undone again (not supported by all modules)");

 imageNavigatorAction = new QAction(QIcon(":/org.mitk.gui.qt.ext/Slider.png"), "&Image Navigator", NULL);
 bool imageNavigatorViewFound = window->GetWorkbench()->GetViewRegistry()->Find("org.mitk.views.imagenavigator");
 if (imageNavigatorViewFound)
 {
   QObject::connect(imageNavigatorAction, SIGNAL(triggered(bool)), QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onImageNavigator()));
   imageNavigatorAction->setCheckable(true);

   // add part listener for image navigator
   imageNavigatorPartListener = new PartListenerForImageNavigator(imageNavigatorAction);
   window->GetPartService()->AddPartListener(imageNavigatorPartListener);
   berry::IViewPart::Pointer imageNavigatorView =
       window->GetActivePage()->FindView("org.mitk.views.imagenavigator");
   imageNavigatorAction->setChecked(false);
   if (imageNavigatorView)
   {
     bool isImageNavigatorVisible = window->GetActivePage()->IsPartVisible(imageNavigatorView);
     if (isImageNavigatorVisible)
       imageNavigatorAction->setChecked(true);
   }
   imageNavigatorAction->setToolTip("Open image navigator for navigating through image");
 }

 // toolbar for showing file open, undo, redo and other main actions
 QToolBar* mainActionsToolBar = new QToolBar;
 mainActionsToolBar->setContextMenuPolicy(Qt::PreventContextMenu);
#ifdef __APPLE__
 mainActionsToolBar->setToolButtonStyle ( Qt::ToolButtonTextUnderIcon );
#else
 mainActionsToolBar->setToolButtonStyle ( Qt::ToolButtonTextBesideIcon );
#endif

 mainActionsToolBar->addAction(fileOpenAction);
 mainActionsToolBar->addAction(fileSaveProjectAction);
 mainActionsToolBar->addAction(closeProjectAction);
 mainActionsToolBar->addAction(undoAction);
 mainActionsToolBar->addAction(redoAction);
 if (imageNavigatorViewFound)
 {
   mainActionsToolBar->addAction(imageNavigatorAction);
 }
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:

示例14: SetupUI

void EditorMainWindow::SetupUI(QMainWindow *MainWindow) {

	setWindowIcon(*QtConfig::GetIcon("colorwheel.png"));

	MainWindow->setWindowTitle("Sound Engine v0.2.3");

	MainWindow->resize(1280, 720);

	MainWindow->setDockOptions(QMainWindow::AnimatedDocks |
								QMainWindow::AllowNestedDocks |
								QMainWindow::AllowTabbedDocks);

	MainWindow->setTabPosition(Qt::AllDockWidgetAreas, QTabWidget::TabPosition::North);

	// ************************************************************************
	// Load styling

	ReloadStyleSheets();

	// ************************************************************************
	// File Picker

	auto *picker = new FilePicker();
	picker->setNameFilter("*.xml");
	GUI::Set(QT_INSTACE::FILE_PICKER, (void*) picker);

	// ************************************************************************
	// Menu Bar

	QMenuBar *menuBar = new QMenuBar(MainWindow);
	menuBar->setObjectName(QStringLiteral("menuBar"));
	menuBar->setGeometry(QRect(0, 0, 1051, 21));
	MainWindow->setMenuBar(menuBar);

	// Menu Entry
	{
		QMenu *menuEngine = new QMenu(menuBar);
		menuEngine->setObjectName(QStringLiteral("menuEngine"));
		menuEngine->setTitle("File");

		menuBar->addAction(menuEngine->menuAction());

		{
			QAction *action = new QAction(MainWindow);
			action->setText("Exit");
			action->setIcon(*QtConfig::GetIcon("power.png"));
			menuEngine->addAction(action);
			QObject::connect(action, &QAction::triggered, this, &EditorMainWindow::close);
		}

		{
			QAction *action = new QAction(MainWindow);
			action->setText("Save As...");
			action->setIcon(*QtConfig::GetIcon("memorycard.png"));
			menuEngine->addAction(action);

			QObject::connect(action, &QAction::triggered, this, [picker]() {
				picker->OpenForSave();
			});

			QObject::connect(picker, &QFileDialog::fileSelected, this, [picker] (const QString & file) {
				if (picker->IsSaving()) {
					CSoundEditor::GetScene()->SaveSceneAs(file.toStdString().c_str());
				}
			});
		}
	}

	// Menu Entry
	{
		QMenu *menu = new QMenu(menuBar);
		menu->setTitle("Scene");
		menuBar->addAction(menu->menuAction());

		// Submenu buttons
		QAction *action = new QAction(MainWindow);
		action->setText("Clear Scene");
		action->setIcon(*QtConfig::GetIcon("denied.png"));
		menu->addAction(action);

		QObject::connect(action, &QAction::triggered, this, []() {
			CSoundEditor::GetScene()->Clear();
			GUI::Get<SceneWindow>(QT_INSTACE::SCENE_EDITOR)->Clear();
		});
	}

	// Menu Entry
	{
		QMenu *menu = new QMenu(menuBar);
		menu->setTitle("Tools");
		menuBar->addAction(menu->menuAction());

		// Submenu buttons
		{
			QAction *action = new QAction(MainWindow);
			action->setText("Reload StyleSheets");
			action->setIcon(*QtConfig::GetIcon("cmyk.png"));
			menu->addAction(action);
			QObject::connect(action, &QAction::triggered, this, &EditorMainWindow::ReloadStyleSheets);
		}
//.........这里部分代码省略.........
开发者ID:ReDEnergy,项目名称:3DSound-Prototypying,代码行数:101,代码来源:EditorMainWindow.cpp

示例15: ui_companion_qt_init

static void* ui_companion_qt_init(void)
{
   ui_companion_qt_t *handle = (ui_companion_qt_t*)calloc(1, sizeof(*handle));
   MainWindow *mainwindow = NULL;
   QHBoxLayout *browserButtonsHBoxLayout = NULL;
   QVBoxLayout *layout = NULL;
   QVBoxLayout *launchWithWidgetLayout = NULL;
   QHBoxLayout *coreComboBoxLayout = NULL;
   QMenuBar *menu = NULL;
   QDesktopWidget *desktop = NULL;
   QMenu *fileMenu = NULL;
   QMenu *editMenu = NULL;
   QMenu *viewMenu = NULL;
   QMenu *viewClosedDocksMenu = NULL;
   QRect desktopRect;
   QDockWidget *thumbnailDock = NULL;
   QDockWidget *thumbnail2Dock = NULL;
   QDockWidget *thumbnail3Dock = NULL;
   QDockWidget *browserAndPlaylistTabDock = NULL;
   QDockWidget *coreSelectionDock = NULL;
   QTabWidget *browserAndPlaylistTabWidget = NULL;
   QWidget *widget = NULL;
   QWidget *browserWidget = NULL;
   QWidget *playlistWidget = NULL;
   QWidget *coreSelectionWidget = NULL;
   QWidget *launchWithWidget = NULL;
   ThumbnailWidget *thumbnailWidget = NULL;
   ThumbnailWidget *thumbnail2Widget = NULL;
   ThumbnailWidget *thumbnail3Widget = NULL;
   QPushButton *browserDownloadsButton = NULL;
   QPushButton *browserUpButton = NULL;
   QPushButton *browserStartButton = NULL;
   ThumbnailLabel *thumbnail = NULL;
   ThumbnailLabel *thumbnail2 = NULL;
   ThumbnailLabel *thumbnail3 = NULL;
   QAction *editSearchAction = NULL;
   QAction *loadCoreAction = NULL;
   QAction *unloadCoreAction = NULL;
   QAction *exitAction = NULL;
   QComboBox *launchWithComboBox = NULL;
   QSettings *qsettings = NULL;

   if (!handle)
      return NULL;

   handle->app = static_cast<ui_application_qt_t*>(ui_application_qt.initialize());
   handle->window = static_cast<ui_window_qt_t*>(ui_window_qt.init());

   desktop = qApp->desktop();
   desktopRect = desktop->availableGeometry();

   mainwindow = handle->window->qtWindow;

   qsettings = mainwindow->settings();

   mainwindow->resize(qMin(desktopRect.width(), INITIAL_WIDTH), qMin(desktopRect.height(), INITIAL_HEIGHT));
   mainwindow->setGeometry(QStyle::alignedRect(Qt::LeftToRight, Qt::AlignCenter, mainwindow->size(), desktopRect));

   mainwindow->setWindowTitle("RetroArch");
   mainwindow->setDockOptions(QMainWindow::AnimatedDocks | QMainWindow::AllowNestedDocks | QMainWindow::AllowTabbedDocks | GROUPED_DRAGGING);

   widget = new QWidget(mainwindow);
   widget->setObjectName("tableWidget");

   layout = new QVBoxLayout();
   layout->addWidget(mainwindow->contentTableWidget());

   widget->setLayout(layout);

   mainwindow->setCentralWidget(widget);

   menu = mainwindow->menuBar();

   fileMenu = menu->addMenu(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_FILE));

   loadCoreAction = fileMenu->addAction(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_FILE_LOAD_CORE), mainwindow, SLOT(onLoadCoreClicked()));
   loadCoreAction->setShortcut(QKeySequence("Ctrl+L"));

   unloadCoreAction = fileMenu->addAction(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_FILE_UNLOAD_CORE), mainwindow, SLOT(onUnloadCoreMenuAction()));
   unloadCoreAction->setObjectName("unloadCoreAction");
   unloadCoreAction->setEnabled(false);
   unloadCoreAction->setShortcut(QKeySequence("Ctrl+U"));

   exitAction = fileMenu->addAction(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_FILE_EXIT), mainwindow, SLOT(close()));
   exitAction->setShortcut(QKeySequence::Quit);

   editMenu = menu->addMenu(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_EDIT));
   editSearchAction = editMenu->addAction(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_EDIT_SEARCH), mainwindow->searchLineEdit(), SLOT(setFocus()));
   editSearchAction->setShortcut(QKeySequence::Find);

   viewMenu = menu->addMenu(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW));
   viewClosedDocksMenu = viewMenu->addMenu(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_CLOSED_DOCKS));
   viewClosedDocksMenu->setObjectName("viewClosedDocksMenu");

   QObject::connect(viewClosedDocksMenu, SIGNAL(aboutToShow()), mainwindow, SLOT(onViewClosedDocksAboutToShow()));

   viewMenu->addAction(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS), mainwindow->viewOptionsDialog(), SLOT(showDialog()));

   playlistWidget = new QWidget();
   playlistWidget->setLayout(new QVBoxLayout());
//.........这里部分代码省略.........
开发者ID:DoctorGoat,项目名称:RetroArch_LibNX,代码行数:101,代码来源:ui_qt.cpp


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