Ejemplo n.º 1
0
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);
}
Ejemplo n.º 2
0
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);
}
Ejemplo n.º 3
0
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());
}
Ejemplo n.º 4
0
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());
}
Ejemplo n.º 5
0
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());
}
Ejemplo n.º 6
0
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);
}
Ejemplo n.º 7
0
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;
}
Ejemplo n.º 8
0
QAction *QMenuProto::menuAction() const
{
  QMenu *item = qscriptvalue_cast<QMenu*>(thisObject());
  if (item)
    return item->menuAction();
  return 0;
}
Ejemplo n.º 9
0
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);
    }
Ejemplo n.º 10
0
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);
	}
}
Ejemplo n.º 11
0
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);

}
/*
    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;
}
Ejemplo n.º 13
0
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();
}
Ejemplo n.º 14
0
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();
}
Ejemplo n.º 15
0
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
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);
}
Ejemplo n.º 16
0
void tst_QMenu::overrideMenuAction()
{
	//test the override menu action by first creating an action to which we set its menu
	QMainWindow w;

	QAction *aFileMenu = new QAction("&File", &w);
	w.menuBar()->addAction(aFileMenu);

	QMenu *m = new QMenu(&w);
	QAction *menuaction = m->menuAction();
	connect(m, SIGNAL(triggered(QAction*)), SLOT(onActivated(QAction*)));
	aFileMenu->setMenu(m); //this sets the override menu action for the QMenu
    QCOMPARE(m->menuAction(), aFileMenu);

#ifdef Q_WS_MAC
    QSKIP("On Mac, we need to create native key events to test menu action activation", SkipAll);
#elif defined(Q_OS_WINCE)
    QSKIP("On Windows CE, we need to create native key events to test menu action activation", SkipAll);
#elif defined(Q_OS_SYMBIAN)
    QSKIP("On Symbian OS, we need to create native key events to test menu action activation", SkipAll);
#endif

    QAction *aQuit = new QAction("Quit", &w);
	aQuit->setShortcut(QKeySequence("Ctrl+X"));
	m->addAction(aQuit);

	w.show();
    QApplication::setActiveWindow(&w);
    w.setFocus();
    QTest::qWaitForWindowShown(&w);
    QTRY_VERIFY(w.hasFocus());

	//test of the action inside the menu
	QTest::keyClick(&w, Qt::Key_X, Qt::ControlModifier);
    QTRY_COMPARE(activated, aQuit);

	//test if the menu still pops out
	QTest::keyClick(&w, Qt::Key_F, Qt::AltModifier);
    QTRY_VERIFY(m->isVisible());

	delete aFileMenu;

	//after the deletion of the override menu action,
	//the menu should have its default menu action back
	QCOMPARE(m->menuAction(), menuaction);

}
Ejemplo n.º 17
0
void
MainWindow::showAndEnableMenu(QMenu &menu,
                              bool show) {

  if (show)
    ui->menuBar->insertMenu(ui->menuHelp->menuAction(), &menu);
  else
    ui->menuBar->removeAction(menu.menuAction());
}
Ejemplo n.º 18
0
void MenuManager::setup(MenuItem* menuItems) const
{
    if (!menuItems)
        return; // empty menu bar

    QMenuBar* menuBar = getMainWindow()->menuBar();
    //menuBar->setUpdatesEnabled(false);

    QList<MenuItem*> items = menuItems->getItems();
    QList<QAction*> actions = menuBar->actions();
    for (QList<MenuItem*>::ConstIterator it = items.begin(); it != items.end(); ++it)
    {
        // search for the menu action
        QAction* action = findAction(actions, QString::fromAscii((*it)->command().c_str()));
        if (!action) {
            // There must be not more than one separator in the menu bar, so
            // we can safely remove it if available and append it at the end
            if ((*it)->command() == "Separator") {
                action = menuBar->addSeparator();
                action->setObjectName(QLatin1String("Separator"));
            }
            else {
                // create a new menu
                std::string menuName = (*it)->command();
                QMenu* menu = menuBar->addMenu(
                    QApplication::translate("Workbench", menuName.c_str(),
                                            0, QApplication::UnicodeUTF8));
                action = menu->menuAction();
                menu->setObjectName(QString::fromAscii(menuName.c_str()));
                action->setObjectName(QString::fromAscii(menuName.c_str()));
            }

            // set the menu user data
            action->setData(QString::fromAscii((*it)->command().c_str()));
        }
        else {
            // put the menu at the end
            menuBar->removeAction(action);
            menuBar->addAction(action);
            action->setVisible(true);
            int index = actions.indexOf(action);
            actions.removeAt(index);
        }

        // flll up the menu
        if (!action->isSeparator())
            setup(*it, action->menu());
    }

    // hide all menus which we don't need for the moment
    for (QList<QAction*>::Iterator it = actions.begin(); it != actions.end(); ++it) {
        (*it)->setVisible(false);
    }

    // enable update again
    //menuBar->setUpdatesEnabled(true);
}
Ejemplo n.º 19
0
void
MainWindow::showAndEnableMenu(QMenu &menu,
                              bool show) {
  auto &action = *menu.menuAction();
  action.setVisible(show);
  action.setEnabled(show);
  for (auto const &action : menu.actions())
    action->setEnabled(show);
}
Ejemplo n.º 20
0
void QtMenu::updateMenuVisibility(QMenu& qMenu)
{
	auto children = qMenu.findChildren<QMenu*>(QString(), Qt::FindDirectChildrenOnly);
	for (auto& child : children)
	{
		updateMenuVisibility(*child);
	}

	qMenu.menuAction()->setVisible(!qMenu.isEmpty());
}
Ejemplo n.º 21
0
void QtTestPlugin::extensionsInitialized()
{
    ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
    Core::ICore *core = Core::ICore::instance();
    Core::ActionManager *am = core->actionManager();

    m_messageOutputWindow = new TestOutputWindow();
    pm->addObject(m_messageOutputWindow);

    m_testResultsWindow = TestResultsWindow::instance();
    connect(m_testResultsWindow, SIGNAL(stopTest()), this, SLOT(stopTesting()));
    connect(m_testResultsWindow, SIGNAL(retryFailedTests(QStringList)),
        this, SLOT(retryTests(QStringList)));
    connect(TestExecuter::instance(), SIGNAL(testStarted()),
        m_testResultsWindow, SLOT(onTestStarted()));
    connect(TestExecuter::instance(), SIGNAL(testStop()),
        m_testResultsWindow, SLOT(onTestStopped()));
    connect(TestExecuter::instance(), SIGNAL(testFinished()),
        m_testResultsWindow, SLOT(onTestFinished()));
    pm->addObject(m_testResultsWindow);
    connect(testResultsPane(), SIGNAL(defectSelected(TestCaseRec)),
        this, SLOT(onDefectSelected(TestCaseRec)));

    // Add context menu to CPP editor
    Core::ActionContainer *mcontext = am->actionContainer(CppEditor::Constants::M_CONTEXT);
    m_contextMenu->init(mcontext->menu(), 2, this);

    // Add context menu to JS editor
    mcontext = am->actionContainer(QmlJSEditor::Constants::M_CONTEXT);
    m_contextMenu->init(mcontext->menu(), 2, this);

    // Add a Test menu to the menu bar
    Core::ActionContainer* ac = am->createMenu("QtTestPlugin.TestMenu");
    ac->menu()->setTitle(tr("&Test"));
    m_contextMenu->init(ac->menu(), 0, 0);

    // Insert the "Test" menu between "Window" and "Help".
    QMenu *windowMenu = am->actionContainer(Core::Constants::M_TOOLS)->menu();
    QMenuBar *menuBar = am->actionContainer(Core::Constants::MENU_BAR)->menuBar();
    menuBar->insertMenu(windowMenu->menuAction(), ac->menu());

    ProjectExplorer::ProjectExplorerPlugin *explorer =
        ProjectExplorer::ProjectExplorerPlugin::instance();

    connect(explorer->session(), SIGNAL(startupProjectChanged(ProjectExplorer::Project*)),
        this, SLOT(onStartupProjectChanged(ProjectExplorer::Project *)));

    connect(core->progressManager(), SIGNAL(allTasksFinished(QString)),
        this, SLOT(onAllTasksFinished(QString)));

    connect(explorer->session(), SIGNAL(aboutToRemoveProject(ProjectExplorer::Project *)),
        this, SLOT(onProjectRemoved(ProjectExplorer::Project *)));

    m_contextMenu->init(0, 3, this);
}
Ejemplo n.º 22
0
void MenuBar::addProjectMenu()
{
    QMenu *m = new QMenu(__("project", "menubar"), this);
    m->addAction(__("reload", "menubar"), parent(), SLOT(onMenuBarProjectReload()));
    m->addSeparator();
    m->addAction(__("build", "menubar"), parent(), SLOT(onMenuBarProjectBuild()), Qt::Key_F5);
    m->addSeparator();
    m->addAction(__("sign_export", "menubar"), parent(), SLOT(onMenuBarProjectSignExport()));
    m->addAction(__("install", "menubar"), parent(), SLOT(onMenuBarProjectInstall()));
    addAction(m->menuAction());
}
Ejemplo n.º 23
0
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;
}
Ejemplo n.º 24
0
void MenuBar::addProjectMenu()
{
    QMenu *m = new QMenu(Qrc::text("menubar.project"), this);
    m->addAction(Qrc::text("menubar.project.reload"), parent(), SLOT(onMenuBarProjectReload()));
    m->addSeparator();
    m->addAction(Qrc::text("menubar.project.build"), parent(), SLOT(onMenuBarProjectBuild()), Qt::Key_F5);
    m->addSeparator();
    m->addAction(Qrc::text("menubar.project.sign_export"), parent(), SLOT(onMenuBarProjectSignExport()));
    m->addAction(Qrc::text("menubar.project.install"), parent(), SLOT(onMenuBarProjectInstall()));
    addAction(m->menuAction());
}
Ejemplo n.º 25
0
void MenuBar::addFileMenu()
{
    QMenu *m = new QMenu(__("file", "menubar"), this);
    QMenu *o = new QMenu(__("open", "menubar"), m);
    o->addAction(__("apk", "menubar"), parent(), SLOT(onMenuBarFileOpenApk()), QKeySequence::New);
    o->addAction(__("directory", "menubar"), parent(), SLOT(onMenuBarFileOpenDir()), QKeySequence::Open);
    o->addSeparator();
    o->addAction(__("file", "menubar"), parent(), SLOT(onMenuBarFileOpenFile()));
    m->addAction(o->menuAction());
    m->addSeparator();
    m->addAction(__("close", "menubar"), parent(), SLOT(onMenuBarFileClose()), QKeySequence::Close);
    m->addAction(__("close_all", "menubar"), parent(), SLOT(onMenuBarFileCloseAll()));
    m->addSeparator();
    m->addAction(__("save", "menubar"), parent(), SLOT(onMenuBarFileSave()), QKeySequence::Save);
    m->addAction(__("save_all", "menubar"), parent(), SLOT(onMenuBarFileSaveAll()));
    m->addSeparator();
    m->addAction(__("terminal", "menubar"), parent(), SLOT(onMenuBarFileTerminal()));
    m->addSeparator();
    m->addAction(__("quit", "menubar"), parent(), SLOT(onMenuBarFileQuit()), QKeySequence::Quit);
    addAction(m->menuAction());
}
Ejemplo n.º 26
0
void ScriptToolbox::menuRemove(QObject * menu, QObject * action)
{
    QMenu * m = qobject_cast<QMenu*>(menu);
    QAction * act = qobject_cast<QAction*>(action);
    if (!act)
    {
        QMenu * ma = qobject_cast<QMenu*>(action);
        act = ma->menuAction();
    }
    if(m && act)
        m->removeAction(act);
}
Ejemplo n.º 27
0
//! Creates the menus
void DebuggerMainWindow::createMenus()
{
  //Create the menus
  QMenu *pDebugMenu = new QMenu(menuBar());
  pDebugMenu->setTitle(tr("&Debug"));
  // add actions to Debug menu
  pDebugMenu->addAction(mpDebugConfigurationsAction);
  pDebugMenu->addAction(mpAttachDebuggerToRunningProcessAction);
  // add Debug menu to menu bar
  menuBar()->addAction(pDebugMenu->menuAction());
  // View menu
  QMenu *pViewMenu = new QMenu(menuBar());
  pViewMenu->setTitle(tr("&View"));
  // add actions to View menu
  pViewMenu->addAction(mpStackFramesDockWidget->toggleViewAction());
  pViewMenu->addAction(mpBreakpointsDockWidget->toggleViewAction());
  pViewMenu->addAction(mpLocalsDockWidget->toggleViewAction());
  pViewMenu->addAction(mpGDBLoggerDockWidget->toggleViewAction());
  pViewMenu->addAction(mpTargetOutputDockWidget->toggleViewAction());
  // add View menu to menu bar
  menuBar()->addAction(pViewMenu->menuAction());
}
Ejemplo n.º 28
0
QMenu *BlMainWindow::newMenu ( const QString &name, const QString &objname, const QString &before )
{
    BL_FUNC_DEBUG
    /// Miramos si existe un menu Ventas
    QMenu *pPluginMenu = menuBar() ->findChild<QMenu *> ( objname );
    /// Creamos el men&uacute;.
    if ( !pPluginMenu || objname == "" ) {
        QMenu *pPluginMaestro = menuBar() ->findChild<QMenu *> ( before );
        pPluginMenu = new QMenu ( name, menuBar() );
        pPluginMenu->setObjectName (  objname );
        menuBar()->insertMenu ( pPluginMaestro->menuAction(), pPluginMenu );
    } // end if
    return pPluginMenu;
}
Ejemplo n.º 29
0
void toResultTableView::slotDisplayMenu(const QPoint &pos)
{
    if (!Menu)
    {
        Menu = new QMenu(this);
        Menu->addAction(displayAct);
        Menu->addAction(refreshAct);

        QMenu *just = new QMenu(tr("A&lignment"), this);
        just->addAction(leftAct);
        just->addAction(centerAct);
        just->addAction(rightAct);
        connect(just,
                SIGNAL(triggered(QAction *)),
                this,
                SLOT(slotMenuCallback(QAction *)));
        Menu->addAction(just->menuAction());

        Menu->addSeparator();

        Menu->addAction(copyAct);
        Menu->addAction(copyFormatAct);
        // not implemented
        // Menu->addAction(copyTransAct);

        Menu->addSeparator();

        Menu->addAction(selectAllAct);

        Menu->addSeparator();

        Menu->addAction(exportAct);

        Menu->addSeparator();

        Menu->addAction(editAct);

        Menu->addSeparator();

        Menu->addAction(rowCountAct);
        Menu->addAction(readAllAct);

        connect(Menu,
                SIGNAL(triggered(QAction *)),
                this,
                SLOT(slotMenuCallback(QAction *)));

        emit displayMenu(Menu);
    }
Ejemplo n.º 30
0
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;
}