Esempio n. 1
0
 Window::Window(Model& model) : model(model)
 {
     this->setWindowTitle("Cantionale");
     
     QMenuBar *menubar = new QMenuBar(this);
     menubar->addMenu(tr("File"));
     menubar->addMenu(tr("Edit"));
     QMenu *view_menu = menubar->addMenu(tr("View"));
     menubar->addMenu(tr("Help"));
     this->setMenuBar(menubar);
     
     documents = new QTabWidget(this);
     documents->setDocumentMode(true);
     documents->setMovable(true);
     documents->setTabsClosable(true);
     this->setCentralWidget(documents);
     
     QStatusBar *status = new QStatusBar(this);
     this->setStatusBar(status);
     
     sources = new QDockWidget(tr("Sources"), this);
     sources->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
     sources->setWidget(new SourcesListWidget(model, this));
     view_menu->addAction(sources->toggleViewAction());
     
     this->addDockWidget(Qt::LeftDockWidgetArea, sources);
     
     connect(documents, SIGNAL(tabCloseRequested(int)),
             this, SLOT(onDocCloseRequest(int)));
 }
Esempio n. 2
0
/**
 * @brief GUI::buildMenuBar
 * @return The built menu bar for the PARAS gui.
 */
QMenuBar *GUI::buildMenuBar()
{
    QMenuBar *menu = new QMenuBar();
    
    
    QMenu *pspace = new QMenu("PSpaceIndex");
    
    QAction *open = new QAction("Create New Index", this);
    QObject::connect(open, SIGNAL(triggered()), this, SLOT(createPSpaceIndex()));
    
    QAction *openEx = new QAction("Open Existing Index", this);
    QObject::connect(openEx, SIGNAL(triggered()), this, SLOT(loadExistingIndex()));
        
    close = new QAction("Close Index", this);
    QObject::connect(close, SIGNAL(triggered()), this, SLOT(closeIndex()));
    
    pspace->addAction(open);
    pspace->addAction(openEx);
    pspace->addAction(close);
    
    
    QMenu *help = new QMenu("Help");
    
    QAction *about = new QAction("About", this);
    QAction *helpAction = new QAction("Help", this);
    
    help->addAction(helpAction);
    help->addAction(about);
    
    
    menu->addMenu(pspace);
    menu->addMenu(help);
    return menu;
}
Esempio n. 3
0
void MainWindow::createMenus()
{
    QMenuBar *mBar = menuBar();

    QMenu *m = mBar->addMenu(tr("Game"));
    m->addAction(newAct);
    m->addSeparator();
    m->addAction(pauseAct);
    m->addAction(showHighScoreAct);
    m->addSeparator();
    m->addAction(quitAct);

    m = mBar->addMenu(tr("Settings"));
    m->addAction(showToolbarAct);
    m->addAction(showStatusbarAct);
    m->addSeparator();
    m = m->addMenu(tr("Difficulty"));
    m->addAction(easyAct);
    m->addAction(mediumAct);
    m->addAction(hardAct);
    m->addAction(customAct);

    m = mBar->addMenu(tr("Help"));
    m->addAction(aboutAct);
}
Esempio n. 4
0
void NPlayer::createGlobalMenu()
{
	#ifdef Q_WS_MAC
	// removing icons from context menu
	QList<NAction *> actions = findChildren<NAction *>();
	for (int i = 0; i < actions.size(); ++i)
		actions.at(i)->setIcon(QIcon());

	QMenuBar *menuBar = new QMenuBar(m_mainWindow);

	QMenu *fileMenu = menuBar->addMenu(tr("File"));
	fileMenu->addAction(m_addFilesAction);
	fileMenu->addAction(m_addDirAction);
	fileMenu->addAction(m_savePlaylistAction);
	fileMenu->addAction(m_aboutAction);
	fileMenu->addAction(m_exitAction);
	fileMenu->addAction(m_preferencesAction);

	QMenu *controlsMenu = menuBar->addMenu(tr("Controls"));
	controlsMenu->addAction(m_playAction);
	controlsMenu->addAction(m_stopAction);
	controlsMenu->addAction(m_prevAction);
	controlsMenu->addAction(m_nextAction);
	controlsMenu->addSeparator();
	controlsMenu->addMenu(m_playlistSubMenu);

	menuBar->addMenu(m_windowSubMenu);
#endif
}
Esempio n. 5
0
void Window::dealMenu(void)
{
	QMenuBar * MenuBar = new QMenuBar(this);
	QMenu * GameMenu = new QMenu(tr("GAME"), MenuBar);
	QMenu * HelpMenu = new QMenu(tr("Help"), MenuBar);

	QAction * StartGame = new QAction(tr("Start"), GameMenu);
	QAction * StopGame = new QAction(tr("End"), GameMenu);
	QAction * QuitGame = new QAction(tr("Quit"), GameMenu);
	GameMenu->addAction(StartGame);
	GameMenu->addAction(StopGame);
	GameMenu->addAction(QuitGame);
	MenuBar->addMenu(GameMenu);
	connect(StartGame, SIGNAL(triggered()), this, SLOT(startGame()));
	connect(StopGame, SIGNAL(triggered()), this, SLOT(stopGame()));
	connect(QuitGame, SIGNAL(triggered()), this, SLOT(close()));


	QAction * About = new QAction(tr("About"), HelpMenu);
	HelpMenu->addAction(About);
	MenuBar->addMenu(HelpMenu);
	connect(About, SIGNAL(triggered()), this, SLOT(showAbout()));


	setMenuBar(MenuBar);
}
Esempio n. 6
0
QMenuBar* MainWindow::createMenuBar()
{
   QMenuBar* bar = new QMenuBar(this);

   QMenu* sessionMenu = bar->addMenu(tr("&File"));
   sessionMenu->addAction(QIcon(":/icons/16x16/canvas-add.png"), tr("&Create"), this, SLOT(createCanvas()));
   sessionMenu->addAction(QIcon(":/icons/16x16/canvas-add.png"), tr("N&etwork"), d->netWin, SLOT(show()));
   sessionMenu->addAction(QIcon(":/icons/16x16/save-as.png"), tr("&Save Image"), this, SLOT(renderCanvas()), tr("Ctrl+S"));
   sessionMenu->addSeparator();
   sessionMenu->addAction(QIcon(":/icons/16x16/exit.png"), tr("&Quit"), this, SLOT(close()), tr("Ctrl+Q"));

   QMenu* editMenu = bar->addMenu(tr("&Edit"));
   editMenu->addAction(QIcon(":/icons/16x16/canvas-clear.png"), tr("&Clear"), d->containment, SLOT(clearCanvas()));
   editMenu->addSeparator();
   editMenu->addAction(QIcon(":/icons/16x16/configure.png"), tr("&Gestures"),d->ge, SLOT(show()));
   editMenu->addAction(QIcon(":/icons/16x16/configure.png"), tr("&Options"))->setEnabled(false);

   QMenu* helpMenu = bar->addMenu(tr("&Help"));
   helpMenu->addAction(QIcon(":/icons/16x16/help-contents.png"), tr("&Help"))->setEnabled(false);
   helpMenu->addSeparator();
   helpMenu->addAction(QIcon(":/icons/16x16/application.png"), tr("&About"), this, SLOT(about()));
   helpMenu->addAction(tr("About &Qt"), qApp, SLOT(aboutQt()));

   return bar;
}
QMenuBar *
ActionCollection::createMenuBar( QWidget *parent )
{
    QMenuBar *menuBar = new QMenuBar( parent );

    QMenu *controlsMenu = new QMenu( tr( "&Controls" ), menuBar );
    controlsMenu->addAction( m_actionCollection[ "playPause" ] );
    controlsMenu->addAction( m_actionCollection[ "previousTrack" ] );
    controlsMenu->addAction( m_actionCollection[ "nextTrack" ] );
    controlsMenu->addSeparator();
    controlsMenu->addAction( m_actionCollection[ "togglePrivacy" ] );
    controlsMenu->addAction( m_actionCollection[ "showOfflineSources" ] );
    controlsMenu->addAction( m_actionCollection[ "toggleOnline" ] );
    controlsMenu->addSeparator();
    controlsMenu->addAction( m_actionCollection[ "loadXSPF" ] );
    controlsMenu->addAction( m_actionCollection[ "updateCollection" ] );
    controlsMenu->addAction( m_actionCollection[ "rescanCollection" ] );
    controlsMenu->addSeparator();
    controlsMenu->addAction( m_actionCollection[ "quit" ] );

    QMenu *settingsMenu = new QMenu( tr( "&Settings" ), menuBar );
#ifndef Q_OS_MAC
    settingsMenu->addAction( m_actionCollection[ "toggleMenuBar" ] );
#endif
    settingsMenu->addAction( m_actionCollection[ "preferences" ] );

    QMenu *helpMenu = new QMenu( tr( "&Help" ), menuBar );
    helpMenu->addAction( m_actionCollection[ "diagnostics" ] );
    helpMenu->addAction( m_actionCollection[ "aboutTomahawk" ] );
    helpMenu->addAction( m_actionCollection[ "legalInfo" ] );

    // Setup update check
#ifndef Q_OS_MAC
    helpMenu->insertSeparator( m_actionCollection[ "aboutTomahawk" ] );
#endif

#if defined( Q_OS_MAC ) && defined( HAVE_SPARKLE )
    helpMenu->addAction( m_actionCollection[ "checkForUpdates" ] );
#elif defined( Q_WS_WIN )
    helpMenu->addSeparator();
    helpMenu->addAction( m_actionCollection[ "checkForUpdates" ] );
#endif
    if ( qApp->arguments().contains( "--debug" ) )
    {
        helpMenu->addSeparator();
        helpMenu->addAction( m_actionCollection[ "crashNow" ] );
    }

    menuBar->addMenu( controlsMenu );
    menuBar->addMenu( settingsMenu );
#if defined( Q_OS_MAC )
    QMenu *windowMenu = new QMenu( tr( "&Window" ), menuBar );
    windowMenu->addAction( m_actionCollection[ "minimize" ] );
    windowMenu->addAction( m_actionCollection[ "zoom" ] );

    menuBar->addMenu( windowMenu );
#endif
    menuBar->addMenu( helpMenu );
    return menuBar;
}
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    //ui->setupUi(this);
    //ustvarim Widget
    centralWidget = new QWidget(this);
    this->setCentralWidget( centralWidget );
    centralWidget->setWindowTitle("DLX");
    centralWidget->setMaximumSize(1000, 1000);
    centralWidget->setMinimumSize(10, 10);
    centralWidget->resize(400,400);
    mainLayout = new QGridLayout( centralWidget );
    mainLayout->setSpacing(0);
    for(int mr = 0; mr < 3; mr++)//ustvarim 3 vrstice
    {
        for(int mc = 0; mc < 3; mc++)//ustvarim 3 stolpce
        {
            //veliki robovi
            QFrame * widget = new QFrame;
            widget->setFrameStyle(QFrame::Plain);
            widget->setFrameShape(QFrame::Box);

            //znotraj velikih robov se en grid
            QGridLayout * gridLayout = new QGridLayout(widget);
            gridLayout->setSpacing(0);
            gridLayout->setMargin(0);

            for(int r = 0; r < 3; r++)//3 vrstice
            {
                for(int c = 0; c < 3; c++)//3 stolpci
                {
                    //ustvarim skatlo s textom
                    QTextEdit * tile = new QTextEdit("");
                    tile->setFrameStyle(QFrame::Plain);
                    tile->setFrameShape(QFrame::Box);
                    tile->setAlignment(Qt::AlignCenter);
                    tile->setTabChangesFocus(true);
                    tile->setStyleSheet("font: 24pt ;");

                    gridLayout->addWidget(tile, r, c, 1, 1, Qt::AlignCenter);
                }
            }
           mainLayout->addWidget(widget, mr, mc, 1, 1, Qt::AlignCenter);
        }
    }
    //ustvarim menu z eventom
    QMenuBar* menuBar = new QMenuBar();
    QMenu *fileMenu = new QMenu("Algoritem");
    menuBar->addMenu(fileMenu);
    QAction *helpAction = fileMenu->addAction("Find solution");
    connect(helpAction, SIGNAL(triggered()), this, SLOT(algoritem()));
    centralWidget->layout()->setMenuBar(menuBar);
    QMenu *fileMenu1 = new QMenu("Input");
    menuBar->addMenu(fileMenu1);
    QAction *Action = fileMenu1->addAction("Reset");
    connect(Action, SIGNAL(triggered()), this, SLOT(reset()));
    QAction *Action2 = fileMenu1->addAction("Qassim Hamza");
    connect(Action2, SIGNAL(triggered()), this, SLOT(hamza()));
}
Esempio n. 9
0
void LSMainWindow::createActions() {
	m_newArchiveAction = new QAction("&New Archive", this);
	m_openArchiveAction = new QAction("&Open Archive...", this);
	m_saveAction = new QAction("&Save", this);
	m_saveArchiveAsAction = new QAction("Save Archive &As...", this);

	m_newArchiveAction->setShortcuts(QKeySequence::New);
	m_openArchiveAction->setShortcuts(QKeySequence::Open);
	m_saveAction->setShortcuts(QKeySequence::Save);
	m_saveArchiveAsAction->setShortcuts(QKeySequence::SaveAs);

	connect(m_newArchiveAction, SIGNAL(triggered()), SLOT(newArchive()));
	connect(m_openArchiveAction, SIGNAL(triggered()), SLOT(openArchive()));
	connect(m_saveAction, SIGNAL(triggered()), SLOT(save()));
	connect(m_saveArchiveAsAction, SIGNAL(triggered()), SLOT(saveArchiveAs()));

	m_addLayoutAction = new QAction("New &Layout...", this);
	m_addAnimationAction = new QAction("New &Animation...", this);
	m_addTextureAction = new QAction("New &Texture...", this);
	m_importNewAction = new QAction("&New Item...", this);
	m_importAction = new QAction("&Replace This Item...", this);
	m_exportAction = new QAction("&Export to File...", this);
	m_renameAction = new QAction("Re&name Item...", this);
	m_removeAction = new QAction("&Remove Item...", this);

	m_addActionMapper = new QSignalMapper(this);
	m_addActionMapper->setMapping(m_addLayoutAction, (int)LYTPackageBase::Layout);
	m_addActionMapper->setMapping(m_addAnimationAction, (int)LYTPackageBase::Animation);
	m_addActionMapper->setMapping(m_addTextureAction, (int)LYTPackageBase::Texture);

	connect(m_addLayoutAction, SIGNAL(triggered()), m_addActionMapper, SLOT(map()));
	connect(m_addAnimationAction, SIGNAL(triggered()), m_addActionMapper, SLOT(map()));
	connect(m_addTextureAction, SIGNAL(triggered()), m_addActionMapper, SLOT(map()));
	connect(m_addActionMapper, SIGNAL(mapped(int)), SLOT(handleAddSomething(int)));

	connect(m_renameAction, SIGNAL(triggered()), SLOT(handleRenameItem()));
	connect(m_removeAction, SIGNAL(triggered()), SLOT(handleRemoveItem()));

	QMenuBar *bar = menuBar();
	QMenu *m;

	m = bar->addMenu("&File");
	m->addAction(m_newArchiveAction);
	m->addAction(m_openArchiveAction);
	m->addAction(m_saveAction);
	m->addAction(m_saveArchiveAsAction);

	m = bar->addMenu("&Edit");
	m->addAction(m_addLayoutAction);
	m->addAction(m_addAnimationAction);
	m->addAction(m_addTextureAction);
	m->addSeparator();
	QMenu *importMenu = m->addMenu("&Import from File");
	importMenu->addAction(m_importNewAction);
	importMenu->addAction(m_importAction);
	m->addAction(m_exportAction);
	m->addSeparator();
	m->addAction(m_renameAction);
	m->addAction(m_removeAction);
}
Esempio n. 10
0
// Create and initialize the UI.
FeaturesUI::FeaturesUI ( QWidget * parent ) : QMainWindow ( parent )
{
  doc = new FeaturesDoc ( this );
  QStatusBar * statusBar = new QStatusBar ( this );
  setStatusBar ( statusBar );
  QObject::connect ( doc, SIGNAL ( alert ( QString ) ),
                     statusBar, SLOT ( showMessage ( const QString & ) ) );
  // Create the main window.
  setFixedSize ( minWidth, minHeight );
  setWindowTitle ( "Features" );

  // Create the menu bar.
  QMenuBar * menuBar = new QMenuBar ( this );

  menuBar->addMenu ( createFileMenu ( menuBar ) );
  menuBar->addMenu ( createImageMenu ( menuBar ) );
  menuBar->addMenu ( createOptionsMenu ( menuBar ) );
  menuBar->addMenu ( createHelpMenu ( menuBar ) );

  setMenuBar ( menuBar );

  QWidget * widget = new QWidget ( this );
  QHBoxLayout * layout = new QHBoxLayout ( widget );

  // Create the subwindows for viewing the query and result images.
  queryView = new ImageView ( this );
  layout->addWidget ( queryView );

  resultView = new ImageView ( this );
  layout->addWidget ( resultView );

  widget->setLayout ( layout );

  setCentralWidget ( widget );
}
Esempio n. 11
0
QMenuBar * Menu::createMenuBar(MainEngine *w)
{
    QMenuBar *menuBar = new QMenuBar();
    QMenu *fileMenu = menuBar->addMenu(tr("&File"));
    fileMenu->addAction(tr("Load team"), this, SLOT(loadTeam()), tr("Ctrl+L", "Load team"));
    fileMenu->addAction(tr("Close tab"), w, SLOT(closeTab()), tr("Ctrl+W", "Close tab"));
    fileMenu->addAction(tr("Open &replay"),w,SLOT(loadReplayDialog()), Qt::CTRL+Qt::Key_R);
    fileMenu->addAction(tr("&Quit"),qApp,SLOT(quit()),Qt::CTRL+Qt::Key_Q);

    w->addThemeMenu(menuBar);
    w->addStyleMenu(menuBar);

    QMenu *langMenu = menuBar->addMenu(tr("&Language"));
    QFile in ("languages.txt");
    in.open(QIODevice::ReadOnly);

    QSettings s;
    QStringList langs = QString::fromUtf8(in.readAll()).trimmed().split('\n');
    QActionGroup *ag = new QActionGroup(langMenu);
    foreach(QString a, langs) {
        QAction *act = langMenu->addAction(a,w, SLOT(changeLanguage()));
        act->setCheckable(true);
        act->setChecked(s.value("language").toString() == a.section("(", 1).section(")", 0, 0));
        ag->addAction(act);
    }
void QmitkWorkbenchWindowAdvisor::PostWindowCreate()
{
  // very bad hack...
  berry::IWorkbenchWindow::Pointer window = this->GetWindowConfigurer()->GetWindow();
  QMainWindow* mainWindow = static_cast<QMainWindow*>(window->GetShell()->GetControl());

  QMenuBar* menuBar = mainWindow->menuBar();

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

  fileMenu->addAction(new QmitkFileOpenAction(window));
  fileMenu->addSeparator();
  fileMenu->addAction(new QmitkFileExitAction(window));

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

  QMenu* viewMenu = menuBar->addMenu("Show &View");

  // sort elements (converting vector to map...)
  std::vector<berry::IViewDescriptor::Pointer>::const_iterator iter;
  std::map<std::string, berry::IViewDescriptor::Pointer> VDMap;

  for (iter = viewDescriptors.begin(); iter != viewDescriptors.end(); ++iter)
  {
    if ((*iter)->GetId() == "org.blueberry.ui.internal.introview")
      continue;
    std::pair<std::string, berry::IViewDescriptor::Pointer> p((*iter)->GetLabel(), (*iter)); 
    VDMap.insert(p);
  }

  QToolBar* qToolbar = new QToolBar;
  
  std::map<std::string, berry::IViewDescriptor::Pointer>::const_iterator MapIter;
  for (MapIter = VDMap.begin(); MapIter != VDMap.end(); ++MapIter)
  {
    berry::QtShowViewAction* viewAction = new berry::QtShowViewAction(window, (*MapIter).second);
    //m_ViewActions.push_back(viewAction);
    viewMenu->addAction(viewAction);
    qToolbar->addAction(viewAction);
  }
  
  mainWindow->addToolBar(qToolbar);

  QStatusBar* qStatusBar = new QStatusBar();

  //creating a QmitkStatusBar for Output on the QStatusBar and connecting it with the MainStatusBar
  QmitkStatusBar *statusBar = new QmitkStatusBar(qStatusBar);
  //disabling the SizeGrip in the lower right corner
  statusBar->SetSizeGripEnabled(false);

  QmitkProgressBar *progBar = new QmitkProgressBar();
  qStatusBar->addPermanentWidget(progBar, 0);
  progBar->hide();
  mainWindow->setStatusBar(qStatusBar);

  QmitkMemoryUsageIndicatorView* memoryIndicator = new QmitkMemoryUsageIndicatorView();
  qStatusBar->addPermanentWidget(memoryIndicator, 0);
}
Esempio n. 13
0
void SpreadSheet::init()
{
    inInit = true;

    project = new QSProject( this, "spreadsheet_project" );
    interpreter = project->interpreter();
#ifndef QSA_NO_GUI
	QSInputDialogFactory *fac = new QSInputDialogFactory;
    interpreter->addObjectFactory( fac );
#endif

    project->addObject( new SheetInterface( sheet1, this, "sheet1" ) );

    project->load( "spreadsheet.qsa" );
    connect( project, SIGNAL( projectEvaluated() ),
	     project, SLOT( save() ) );

    
    QMenuBar *menuBar = new QMenuBar(this);
    QMenu *fileMenu = menuBar->addMenu("&File");    
    QAction *fileExitAction = fileMenu->addAction("E&xit");
    connect(fileExitAction, SIGNAL(triggered(bool)), this, SLOT(fileExit()));

    scriptsMenu = menuBar->addMenu("&Scripts");
    QAction *scriptsNewAction = scriptsMenu->addAction(QIcon(":/images/hi22-action-run.png"), 
                                                       "&New...");
    connect(scriptsNewAction, SIGNAL(triggered(bool)), this, SLOT(addScript()));
    QAction *scriptsQSA = scriptsMenu->addAction(QIcon(":/images/hi22-action-project_open.png"), 
                                                 "QSA &Workbench");   
    connect(scriptsQSA, SIGNAL(triggered(bool)), this, SLOT(openIDE()));
    setMenuBar(menuBar);

    QToolBar *toolBar = new QToolBar("Calculation Toolbar", this);
    currentCell = new QLabel("A1", toolBar);
        toolBar->addWidget(currentCell);
    formulaEdit = new QLineEdit(toolBar);
        toolBar->addWidget(formulaEdit);
        connect(formulaEdit, SIGNAL(returnPressed()), this, SLOT(formulaEdited()));
    addToolBar(toolBar);

    scriptsToolbar = new QToolBar("Scripts Toolbar", this);
    scriptsToolbar->addAction(scriptsNewAction);
    scriptsToolbar->addAction(scriptsQSA);
    addToolBar(scriptsToolbar);        

    for (int i=0; i<sheet1->rowCount(); ++i) {
        sheet1->setVerticalHeaderItem(i, new QTableWidgetItem(QString::number(i + 1)));

        for (int j=0; j<sheet1->columnCount(); ++j) {
            sheet1->setItem(i, j, new QTableWidgetItem);
            if (i == 0) {
                sheet1->setHorizontalHeaderItem(j, new QTableWidgetItem);
            }
        }
    }

    setupSheet( sheet1 );
    inInit = false;
}
Esempio n. 14
0
void MainWindow::createMenu()
{
    QMenuBar *menubar = menuBar();
    QMenu *file = menubar->addMenu("&File");
    file->addAction(openMeshFileAction);

    QMenu *view = menubar->addMenu("&View");
    view->addAction(scaleSelectionDockWidget->toggleViewAction());
}
Esempio n. 15
0
void Widgets::createMenubar()
{
    QMenuBar* mainMenuBar = menuBar();
    QMenu* menuFile = new QMenu(tr("&File"), this);
    mainMenuBar->addMenu(menuFile);

    menuFile->addAction(m_actNew);
    menuFile->addAction(m_actOpen);
    menuFile->addAction(m_actClose);
    menuFile->addAction(m_actSave);
    menuFile->addAction(m_actSaveAs);

    menuFile->addSeparator();

#ifndef QT_NO_PRINTER
    menuFile->addAction(m_actPrint);

    menuFile->addAction(m_actPrintPreview);
    menuFile->addSeparator();
#endif
    menuFile->addAction(m_actExit);

    m_menuView = new QMenu(tr("&View"), this);
    mainMenuBar->addMenu(m_menuView);
    m_menuView->addAction(m_styleDock->toggleViewAction());
    m_menuView->addAction(m_propDock->toggleViewAction());
    m_menuView->addAction(m_toolBoxDock->toggleViewAction());
    m_menuView->addSeparator();
    m_menuView->addAction(m_actDefaultStyle);
    m_menuView->addAction(m_actOffice2007Style);
    m_menuView->addAction(m_actRibbonStyle);
    m_menuView->addSeparator();
    m_menuTheme = new QMenu(tr("&Theme"), this); 
    m_menuTheme->addAction(m_actBlueTheme);
    m_menuTheme->addAction(m_actBlackTheme);
    m_menuTheme->addAction(m_actSilverTheme);
    m_menuTheme->addAction(m_actAquaTheme);
    m_menuTheme->addSeparator();
    m_menuTheme->addAction(m_actScenicTheme);
    m_menuTheme->addSeparator();
    m_menuTheme->addAction(m_actBlue2010Theme);
    m_menuTheme->addAction(m_actSilver2010Theme);
    m_menuTheme->addAction(m_actBlack2010Theme);
    m_menuTheme->addSeparator();
    m_menuTheme->addAction(m_act2013WhiteTheme);

    m_menuView->addMenu(m_menuTheme);
    m_menuView->addSeparator();
    QAction* actStyleDialog = new QAction(tr("Style Dialog..."), this);
    m_menuView->addAction(actStyleDialog);
    connect(actStyleDialog, SIGNAL(triggered()), this, SLOT(createStyleDialog()));

    QMenu* menuHelp = new QMenu(tr("&Help"), this);
    mainMenuBar->addMenu(menuHelp);
    menuHelp->addAction(m_actHelp);
}
Esempio n. 16
0
void MainWindow::_createMenus()
{
	QMenuBar* menu = menuBar() ;
	QMenu* viewMenu = menu->addMenu(QString("View")) ;
	viewMenu->addActions(_viewStack->actions()) ;
	QMenu* layoutMenu = menu->addMenu(QString("Layout")) ;

	layoutMenu->addActions(_viewStack->layoutActions()) ;

}
EDFViewerWindow::EDFViewerWindow(QWidget *parent)
    : QWidget(parent){
    QVBoxLayout *vb;
    QHBoxLayout *hb;
    QMenu *menu;
    QAction *act;
    QMenuBar* menuBar;

    vb=new QVBoxLayout();
    hb=new QHBoxLayout();
    vb->addLayout(hb);
    menuBar = new QMenuBar();
    menu= menuBar->addMenu(tr("&File"));
    act=new QAction(tr("&Open"), this);
    menu->addAction(act);
    connect(act, SIGNAL(triggered()), this, SLOT(fileOpen()));
    act=new QAction(tr("&Exit"), this);
    connect(act, SIGNAL(triggered()), this, SLOT(close()));
    menu->addAction(act);
    menu= menuBar->addMenu(tr("&EDF"));
    act=new QAction(tr("&EDF Data"), this);
    menu->addAction(act);
    QObject::connect(act,&QAction::triggered,datawindow);
    act=new QAction(tr("&Signals"), this);
    menu->addAction(act);
    QObject::connect(act,&QAction::triggered,signalswindow);
    hb->addWidget(menuBar);
    hb->setStretch(hb->count()-1,1);
    menuBar = new QMenuBar();
    menu= menuBar->addMenu(tr("&Help"));
    act=new QAction(tr("&About"), this);
    menu->addAction(act);
    QObject::connect(act,&QAction::triggered,aboutwindow);
    hb->addWidget(menuBar);

    vb->addWidget(paintWidget=new PaintWidget());
    vb->setStretch(vb->count()-1,1);
    hScrollBar = new QScrollBar(Qt::Horizontal, this);
    connect(hScrollBar, SIGNAL(valueChanged(int)),this,SLOT(changehbar(int)));
    hb=new QHBoxLayout();
    hb->addWidget(hScrollBar);
    hb->setStretch(hb->count()-1,1);
    le1=new QLineEdit();
    le1->setText("4");
    le1->setFixedSize(32,16);
    hb->addWidget(le1);
    connect(le1, SIGNAL(textChanged(const QString &)), this, SLOT(screentimechanged(const QString &)));
    hb->addWidget(new QLabel("sec"));
    vb->addLayout(hb);
    resize(450,400);
    setLayout(vb);
}
Esempio n. 18
0
void BatDown::createMenus() {
    QMenuBar *mbar = menuBar();

    fileMenu = mbar->addMenu(tr("&File"));
    fileMenu->addAction(analyseAct);
    fileMenu->addAction(downloadAct);
    fileMenu->addAction(editScriptAct);
    fileMenu->addSeparator();
    fileMenu->addAction(quitAct);

    helpMenu = mbar->addMenu(tr("&Help"));
    helpMenu->addAction(aboutAct);
}
Esempio n. 19
0
void SVPlotMainWindow::SVPlotMainWindowPrivate::setupMenus() {
  menuRecentFiles = new QMenu("Open &Recent", mw);
  menuRecentFiles->setEnabled(!config().recentFiles().isEmpty());
  connect(menuRecentFiles, SIGNAL(aboutToShow()),
          mw, SLOT(prepareRecentFilesMenu()));

  menuExportAs = new QMenu("E&xport As", mw);
  menuExportAs->setEnabled(false);

  supportedFormatsMap::const_iterator i = exportAsFormat.constBegin();
  for ( ; i != exportAsFormat.constEnd(); ++i) {
    QAction *action = menuExportAs->addAction(QString("%1 (%2)").arg(i.value()).arg(i.key()));
    connect(action, SIGNAL(triggered()),
            exportAsFormatMapper, SLOT(map()));
    exportAsFormatMapper->setMapping(action, i.key());
  }

  QMenuBar *menuBar = mw->menuBar();

  menuFile = new QMenu("&File", mw);
  menuFile->addAction(actionNew);
  menuFile->addAction(actionLoad);
  menuFile->addMenu(menuRecentFiles);
  menuFile->addMenu(menuExportAs);
  menuFile->addAction(actionPrint);
  menuFile->addSeparator();
  menuFile->addAction(actionQuit);
  menuBar->addMenu(menuFile);

  menuPlot = new QMenu("&Plot", mw);
  menuPlot->addAction(actionZoomFit);
  menuPlot->addSeparator();
  menuPlot->addActions(actionGroupZoomMove->actions());
  menuBar->addMenu(menuPlot);

  menuView = new QMenu("&View", mw);
  menuView->addAction(svplotToolBar->toggleViewAction());
  menuView->addAction(browserDock->toggleViewAction());
  menuView->addAction(fileDock->toggleViewAction());
  menuView->addAction(propertyDock->toggleViewAction());
  menuBar->addMenu(menuView);

  menuWindow = new QMenu("&Window", mw);
  connect(menuWindow, SIGNAL(aboutToShow()),
          mw, SLOT(prepareWindowMenu()));
  menuBar->addMenu(menuWindow);

  menuHelp = new QMenu("&Help", mw);
  menuHelp->addAction(actionAbout);
  menuBar->addMenu(menuHelp);
}
Esempio n. 20
0
/* 初始化菜单栏 */
void TextEditer::initMenu()
{
	QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
	QMenuBar *bar = this->menuBar();	/* 获取窗口的菜单栏*/

	/* 文件菜单 */
	menuFile = new QMenu(tr("文件(&F)"), this);
	actNew = menuFile->addAction(tr("新建(&N)"));
	actNew->setIcon(QIcon(":/images/new.png"));
	actNew->setShortcut(QKeySequence(tr("Ctrl+N")));	/* 设置新建的快捷键 */
	actOpen = menuFile->addAction(tr("打开(&O)"));
	actOpen->setIcon(QIcon(":/images/open.png"));
	actOpen->setShortcut(QKeySequence(tr("Ctrl+O")));	/* 设置打开的快捷键 */
	actClose = menuFile->addAction(tr("关闭(&C)"));
	mSepOne = menuFile->addSeparator();
	actSave = menuFile->addAction(tr("保存(&S)"));
	actSave->setShortcut(QKeySequence(tr("Ctrl+S")));	/* 设置保存的快捷键 */
	actSave->setIcon(QIcon(":/images/save.png"));
	actASave = menuFile->addAction(tr("另存为...(&A)"));
	actASave->setIcon(QIcon(":/images/asave.png"));
	mSepTwo = menuFile->addSeparator();
	actExit = menuFile->addAction(tr("退出(&X)"));
	bar->addMenu(menuFile);	/* 将生成的文件菜单添加到菜单栏中 */

	/* 编辑菜单 */
	menuEdit = new QMenu(tr("编辑(&E)"), this);
	actUndo = menuEdit->addAction(tr("撤消(&U)"));
	actUndo->setIcon(QIcon(":/images/undo.png"));
	actUndo->setShortcut(QKeySequence(tr("Ctrl+Z")));	/* 设置撤消的快捷键 */
	actRedo = menuEdit->addAction(tr("重做(&R)"));
	actRedo->setShortcut(QKeySequence(tr("Ctrl+R")));	/* 设置重做的快捷键 */
	actRedo->setIcon(QIcon(":/images/editor.png"));
	actCut = menuEdit->addAction(tr("剪切(&T)"));
	actCut->setIcon(QIcon(":/images/cut.png"));
	actCut->setShortcut(QKeySequence(tr("Ctrl+X")));	/* 设置剪切的快捷键 */
	actCopy = menuEdit->addAction(tr("复制(&P)"));
	actCopy->setIcon(QIcon(":/images/copy.png"));
	actCopy->setShortcut(QKeySequence(tr("Ctrl+C")));	/* 设置复制的快捷键 */
	actPast = menuEdit->addAction(tr("粘贴(&P)"));
	actPast->setIcon(QIcon(":/images/paste.png"));
	actPast->setShortcut(QKeySequence(tr("Ctrl+P")));	/* 设置粘贴的快捷键 */
	menuEdit->addSeparator();
	actAll = menuEdit->addAction(tr("全选(&A)"));
	actAll->setShortcut(QKeySequence(tr("Ctrl+A")));	/* 设置全选的快捷键 */
	bar->addMenu(menuEdit);

	/* 工具菜单 */
	menuTool = new QMenu(tr("工具(&T)"), this);
	actFont = menuTool->addAction(tr("字体(&F)"));
	bar->addMenu(menuTool);
}
Esempio n. 21
0
HomeWindow::HomeWindow()
: m_langCode("enu")
{
	m_translator = new SimpleTranslator();
	m_translator->loadDefaultDict(QString::fromUtf8(":/LPCModule/i18n/en.qph"));

	QVBoxLayout *rootLayout = new QVBoxLayout();
	setLayout(rootLayout);

	QMenuBar *menuBar = new QMenuBar();
	rootLayout->addWidget(menuBar);

	m_tab = new QTabWidget();
	rootLayout->addWidget(m_tab);

	QMenu *languageMenu = menuBar->addMenu(tr("language"));
	QAction *act = languageMenu->addAction(tr("enu"));
	connect(act, SIGNAL(triggered()), SLOT(onLanguageAction()));
	act = languageMenu->addAction(tr("deu"));
	connect(act, SIGNAL(triggered()), SLOT(onLanguageAction()));

	QMenu *testMenu = menuBar->addMenu(tr("test"));
	act = testMenu->addAction(tr("popup1"));
	connect(act, SIGNAL(triggered()), SLOT(onPopup1()));
	act = testMenu->addAction(tr("popup2"));
	connect(act, SIGNAL(triggered()), SLOT(onPopup2()));

	QMenu *navMenu = menuBar->addMenu(tr("nav"));
	for (size_t i = 0; i < sizeof(g_pageNames) / sizeof(g_pageNames[0]); i++) {
		act = navMenu->addAction(QString::fromUtf8(g_pageNames[i]));
		connect(act, SIGNAL(triggered()), SLOT(onNav()));
	}

	QWidget *homePage = new QWidget();
	QVBoxLayout *homeLayout = new QVBoxLayout();
	homePage->setLayout(homeLayout);
	QPushButton *bigButton = new QPushButton(tr("lpc"));
	homeLayout->addWidget(bigButton);
	homeLayout->addStretch();

	m_lpcFrame = new LPCMainFrame(this, this);

	m_tab->addTab(homePage, tr("home"));
	m_tab->addTab(m_lpcFrame, tr("lpc"));

	connect(m_tab, SIGNAL(currentChanged(int)), SLOT(onSwitchTab()));
	connect(bigButton, SIGNAL(clicked()), SLOT(onBigButtonClicked()));

	qApp->postEvent(this, new QEvent(QEvent::LanguageChange));
	resize(600, 480);
}
Esempio n. 22
0
void    MainWindow::init()
{
    QMenuBar *myMenuBar = menuBar();
    QMenu *fileMenu = myMenuBar->addMenu("File");
    QMenu *EditionMenu = myMenuBar->addMenu("Edition");
    QMenu *helpMenu = myMenuBar->addMenu("Help");

    myMenuBar->setObjectName("myMenuBar");
    fileMenu->setObjectName("myFileMenu");
    EditionMenu->setObjectName("myEditionMenu");
    helpMenu->setObjectName("myHelpMenu");

    _dockWidget = new QDockWidget;

    _dockWidget->setFeatures(QDockWidget::NoDockWidgetFeatures | QDockWidget::DockWidgetMovable);

    _dockWidget->setVisible(false);

    _stackedWidget = new QStackedWidget;

    _accountInterface = AccountSingleton::getInstance();
    _centralWidget = CentralWidgetSingleton::getInstance();
    _dockWidgetContent = DockWidgetContentSingleton::getInstance();

    _stackedWidget->addWidget(_accountInterface);
    _stackedWidget->addWidget(_centralWidget);

    setCentralWidget(_stackedWidget);

    _dockWidget->setWidget(_dockWidgetContent);

    _dockWidget->setMinimumSize(400, 600);

    addDockWidget(Qt::LeftDockWidgetArea, _dockWidget, Qt::Vertical);

    setWindowTitle("Babel Client");
    setMinimumSize(800, 700);

    connect(ListenServerSingleton::getInstance(), SIGNAL(connected()), this, SLOT(switchOnConnectedState()));
    connect(ListenServerSingleton::getInstance(), SIGNAL(warningPopUp(QString const&,QString const&)),
            this, SLOT(showWarningPopUp(QString const&,QString const&)));
    connect(ListenServerSingleton::getInstance(), SIGNAL(successPopUp(QString const&,QString const&)),
            this, SLOT(showSuccessPopUp(QString const&,QString const&)));
    connect(ListenServerSingleton::getInstance(), SIGNAL(contactStatusChanged(QString,int)), _dockWidgetContent, SLOT(updateStatusForContact(QString,int)));
    connect(ListenServerSingleton::getInstance(), SIGNAL(callOccured(QString const &, unsigned int)), _centralWidget, SLOT(showCallPopUp(QString const &, unsigned int)));
    connect(ListenServerSingleton::getInstance(), SIGNAL(callFail()), _centralWidget, SLOT(showFailCall()));
    connect(ListenServerSingleton::getInstance(), SIGNAL(newContactToUpdateList(QString const &)), _dockWidgetContent, SLOT(addContactToUpdateList(QString const &)));
    connect(ListenServerSingleton::getInstance(), SIGNAL(textMessageChanged(QString const &)), _centralWidget, SLOT(updateTalkWindowText(QString const&)));
    connect(ListenServerSingleton::getInstance(), SIGNAL(hungUp(QString const &)), _centralWidget, SLOT(applyHangUp(QString const&)));
    connect(_dockWidgetContent, SIGNAL(called()), _centralWidget, SLOT(call()));
}
ViewerPluginTest::ViewerPluginTest(QWidget *parent)
    : QWidget(parent)
{
    QMenuBar *menuBar = new QMenuBar(this);
    QVBoxLayout *vbox = new QVBoxLayout;
    setLayout(vbox);
    vbox->addWidget(menuBar);
    QTextEdit *textEdit = new QTextEdit;
    vbox->addWidget(textEdit);

    QWidget *toolManagerWidget = new QWidget;
    vbox->addWidget(toolManagerWidget);
    vbox = new QVBoxLayout;
    vbox->setMargin(0);
    vbox->setSpacing(0);
    toolManagerWidget->setLayout(vbox);
    MessageViewer::ViewerPluginToolManager *toolManager = new MessageViewer::ViewerPluginToolManager(toolManagerWidget, this);
    connect(toolManager, &MessageViewer::ViewerPluginToolManager::activatePlugin, this, &ViewerPluginTest::slotActivatePlugin);

    toolManager->setPluginName(QStringLiteral("messageviewer"));
    toolManager->setServiceTypeName(QStringLiteral("MessageViewer/ViewerPlugin"));
    if (!toolManager->initializePluginList()) {
        qDebug() << " Impossible to initialize plugins";
    }
    toolManager->setActionCollection(new KActionCollection(this));
    toolManager->createView();
    QMenu *menu = new QMenu(this);
    menu->setTitle(QStringLiteral("tools"));
    menu->addActions(toolManager->viewerPluginActionList(MessageViewer::ViewerPluginInterface::All));
    menuBar->addMenu(menu);

    menu = new QMenu(this);
    menu->setTitle(QStringLiteral("selected tools"));
    menu->addActions(toolManager->viewerPluginActionList(MessageViewer::ViewerPluginInterface::NeedSelection));
    menuBar->addMenu(menu);

    menu = new QMenu(this);
    menu->setTitle(QStringLiteral("message tools"));
    menu->addActions(toolManager->viewerPluginActionList(MessageViewer::ViewerPluginInterface::NeedMessage));
    menuBar->addMenu(menu);

    menu = new QMenu(this);
    menu->setTitle(QStringLiteral("message tools and selected tools"));
    MessageViewer::ViewerPluginInterface::SpecificFeatureTypes featureTypes;
    featureTypes |= MessageViewer::ViewerPluginInterface::NeedMessage;
    featureTypes |= MessageViewer::ViewerPluginInterface::NeedSelection;
    featureTypes |= MessageViewer::ViewerPluginInterface::NeedUrl;
    menu->addActions(toolManager->viewerPluginActionList(featureTypes));
    menuBar->addMenu(menu);
}
Esempio n. 24
0
QMenuBar *TeamBuilder::createMenuBar(MainEngine *w)
{
    QMenuBar *menuBar = new QMenuBar();
    menuBar->setObjectName("TeamBuilder");
    QMenu *fileMenu = menuBar->addMenu(tr("&File"));
    fileMenu->addAction(tr("&New"),this,SLOT(newTeam()),tr("Ctrl+N", "New"));
    fileMenu->addAction(tr("&Save all"),this,SLOT(saveAll()),tr("Ctrl+S", "Save all"));
    fileMenu->addAction(tr("&Load all"),this,SLOT(openLoadWindow()),tr("Ctrl+L", "Load all"));
    fileMenu->addSeparator();
    fileMenu->addAction(tr("&Quit"),qApp,SLOT(quit()),tr("Ctrl+Q", "Quit"));
    QMenu *teamMenu = menuBar->addMenu(tr("&Team"));
    if (currentWidget() && currentWidget() == this->teamMenu) {
        teamMenu->addAction(tr("Choose pokemon"), this->teamMenu, SLOT(choosePokemon()), tr("Alt+E", "Choose Pokemon"));
    }
    teamMenu->addAction(tr("Trainer Menu"), this, SLOT(switchToTrainer()), tr("Ctrl+B", "Trainer Menu"));
    teamMenu->addSeparator();
    teamMenu->addAction(tr("&Add team"), this, SLOT(addTeam()), tr("Ctrl+A", "Add team"));
    teamMenu->addAction(tr("&Load team"), this, SLOT(openTeam()), tr("Ctrl+Shift+L", "Load team"));
    teamMenu->addAction(tr("&Save team"), this, SLOT(saveTeam()), tr("Ctrl+Shift+S", "Save team"));
    teamMenu->addAction(tr("&Import team"), this, SLOT(importTeam()), tr("Ctrl+I", "Import team"));
    teamMenu->addAction(tr("&Export team"), this, SLOT(exportTeam()), tr("Ctrl+E", "Export team"));
    teamMenu->addSeparator();
    teamMenu->addAction(tr("Import from Android"), this, SLOT(importAndroid()), tr("Ctrl+Shift+I", "Import from Android"));
    teamMenu->addAction(tr("Export to Android"), this, SLOT(exportAndroid()), tr("Ctrl+Shift+E", "Export to Android"));

    currentWidget()->addMenus(menuBar);

    /* Loading mod menu */
    QMenu *menuMods = menuBar->addMenu(tr("&Mods"));
    QActionGroup *group = new QActionGroup(menuMods);

    QString currentMod = PokemonInfoConfig::currentMod();
    // No mod option.
    QAction *noMod = menuMods->addAction(tr("&No mod"), this, SLOT(setNoMod()));
    noMod->setCheckable(true);
    noMod->setChecked(currentMod.length()==0);
    group->addAction(noMod);

    menuMods->addSeparator();

    QStringList mods = PokemonInfoConfig::availableMods();

    foreach(QString smod, mods) {
        QAction *mod = menuMods->addAction(smod, this, SLOT(changeMod()));
        mod->setProperty("name", smod);
        mod->setCheckable(true);
        mod->setChecked(currentMod == smod);
        group->addAction(mod);
    }
Esempio n. 25
0
MainWin::MainWin(QWidget *parent)
	:QMainWindow(parent)
{
	resize(800, 600);

	speech = new QtSpeech(this);

	srlirc = new SrlIrc(speech, this);
	twitchirc = new TwitchIrc(speech, this);
	streamwatch = new StreamWatch(speech, this);

	QTabWidget *tabber = new QTabWidget(this);

	tabber->addTab(srlirc, "SRL IRC");
	tabber->addTab(twitchirc, "Twitch IRC");
	tabber->addTab(streamwatch, "Stream Watch");

	setCentralWidget(tabber);

	QMenuBar *mbar = menuBar();

	QMenu *filemenu = mbar->addMenu("File");

	filemenu->addAction("Exit", this, SLOT(close()));

	QMenu *voicemenu = mbar->addMenu("Voices");

	QActionGroup *ag = new QActionGroup(voicemenu);
	ag->setExclusive(true);

	for(const QtSpeech::VoiceName &vname: speech->voices())
	{
		QAction *vaction = ag->addAction(vname.name);
		voicemenu->addAction(vaction);

		vaction->setCheckable(true);

		if(speech->name().id == vname.id)
			vaction->setChecked(true);

		connect(vaction, &QAction::triggered, this, [this, vname, vaction]()
		{
			speech->deleteLater();
			speech = new QtSpeech(vname, this);

			vaction->setChecked(true);
		});
	}
}
Esempio n. 26
0
MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags flags)
	: QMainWindow(parent, flags), gbw(nullptr), boardSize(5), redai(false),
	  redPlayerAgent(nullptr), whitePlayerAgent(nullptr), startBoard(5),
	  currentWorker(nullptr)
{
	setMinimumSize(400, 400);

	QMenuBar *mb = menuBar();
	QMenu* game = mb->addMenu("&Game");
	QMenu* size = game->addMenu("&New");
	connect(size, SIGNAL(triggered(QAction*)), this, SLOT(resetGame()));

	size->addAction("&Tiny", this, SLOT(tinyGame()));
	size->addAction("&Small", this, SLOT(smallGame()));
	size->addAction("&Medium", this, SLOT(mediumGame()));
	size->addAction("&Normal", this, SLOT(normalGame()));
	size->addAction("&Large", this, SLOT(largeGame()));

	game->addAction("&AI Versus", this, SLOT(AIGame()));

	game->addSeparator();
	game->addAction("&Quit", QApplication::instance(), SLOT(quit()), QKeySequence::Quit);

	QMenu* state = mb->addMenu("&State");

	state->addAction("&Forfeit move", this, SLOT(forfeitMove()));
	state->addSeparator();
	state->addAction("&Print History", this, SLOT(printGameHistory()));
	state->addAction("Write &Graph", this, SLOT(writeGraphviz()));
	state->addAction("Write &Image", this, SLOT(writeStateImage()));


	QMenu* help = mb->addMenu("&Help");
	help->addAction("&About Qt", QGuiApplication::instance(), SLOT(aboutQt()));

	statusLabel = new QLabel();
	statusBar()->addWidget(statusLabel);

	gbw = new GameBoardWidget(this);
	
	setCentralWidget(gbw);

	normalGame();

	setCurrentPlayer(T_RED);

	connect(gbw, SIGNAL(boardClicked(BoardIndex,BoardIndex)), this, SLOT(playerClick(BoardIndex,BoardIndex)));
}
Esempio n. 27
0
void tst_QMenu::mouseActivation()
{
    QWidget topLevel;
    QMenu menu(&topLevel);
    topLevel.show();
    menu.addAction("Menu Action");
    menu.show();
    QTest::mouseClick(&menu, Qt::LeftButton, 0, menu.rect().center(), 300);
    QVERIFY(!menu.isVisible());

    //context menus can always be accessed with right click except on windows
    menu.show();
    QTest::mouseClick(&menu, Qt::RightButton, 0, menu.rect().center(), 300);
    QVERIFY(!menu.isVisible());

#ifdef Q_OS_WIN
    //on windows normal mainwindow menus Can only be accessed with left mouse button
    QMenuBar menubar;
    QMenu submenu("Menu");
    submenu.addAction("action");
    QAction *action = menubar.addMenu(&submenu);
    menubar.show();

    QTest::mouseClick(&menubar, Qt::LeftButton, 0, menubar.actionGeometry(action).center(), 300);
    QVERIFY(submenu.isVisible());
    QTest::mouseClick(&submenu, Qt::LeftButton, 0, QPoint(5, 5), 300);
    QVERIFY(!submenu.isVisible());

    QTest::mouseClick(&menubar, Qt::LeftButton, 0, menubar.actionGeometry(action).center(), 300);
    QVERIFY(submenu.isVisible());
    QTest::mouseClick(&submenu, Qt::RightButton, 0, QPoint(5, 5), 300);
    QVERIFY(submenu.isVisible());
#endif
}
Esempio n. 28
0
void ChessWindow::createMenu() {
    QMenuBar *menuBar = ui_.menubar;
    menuBar->setStyleSheet("QMenuBar::item {background-color: #ffffe7; border-radius: 1px; border: 1px solid #74440e; color: black;"
                   "spacing: 10px; padding: 1px 4px; background: transparent; }"
                   "QMenuBar::item:selected { background-color: #ffeeaf; color: black;  }"
                   "QMenuBar::item:pressed { background: #ffeeaf; color: black;  }");

    QAction *loadAction = new QAction(tr("Load game"), menuBar);
    QAction *saveAction = new QAction(tr("Save game"), menuBar);
    QAction *quitAction = new QAction(tr("Quit"), menuBar);
    loseAction = new QAction(tr("Resign"), menuBar);
    QAction *soundAction = new QAction(tr("Enable sound"),menuBar);
    soundAction->setCheckable(true);
    soundAction->setChecked(enabledSound);

    QMenu *fileMenu = menuBar->addMenu(tr("File"));
    QMenu *gameMenu = menuBar->addMenu(tr("Game"));

    fileMenu->addAction(loadAction);
    fileMenu->addAction(saveAction);
    fileMenu->addSeparator();
    fileMenu->addAction(quitAction);
    gameMenu->addAction(loseAction);
    gameMenu->addSeparator();
    gameMenu->addAction(soundAction);

    connect(loadAction, SIGNAL(triggered()), this, SLOT(load()));
    connect(saveAction, SIGNAL(triggered()), this, SLOT(save()));
    connect(quitAction, SIGNAL(triggered()), this, SLOT(close()), Qt::QueuedConnection);
    connect(loseAction, SIGNAL(triggered()), this, SIGNAL(lose()));
    connect(soundAction, SIGNAL(triggered(bool)), this, SIGNAL(toggleEnableSound(bool)));
}
Esempio n. 29
0
void KkrEditMain::setupMainMenu()
{
    QMenuBar *pMainMenu = new QMenuBar;

    // File menu
    QMenu *pMenuFile = new QMenu{tr("&File")};
    pMenuFile->addAction(tr("&New..."), this, &KkrEditMain::newWorkBoard);
    pMenuFile->addAction(tr("E&xit"), this, &QWidget::close);
    pMainMenu->addMenu(pMenuFile);

    // View menu
    m_pMenuView = new QMenu{tr("&View")};
    pMainMenu->addMenu(m_pMenuView);

    setMenuBar(pMainMenu);
}
Esempio n. 30
0
void QtTrader::createGUI ()
{
  QMenuBar *menuBar = new QMenuBar();
  setMenuBar(menuBar);
  QMenu *menu = new QMenu("&Help");

  QAction* a = new QAction(QIcon(":icons/info"), tr("&About"), this);
  a->setIconVisibleInMenu(true);
  connect(a, SIGNAL(activated()), this, SLOT(about()));
  menu->addAction(a);
  menuBar->addMenu(menu);

  statusBar()->showMessage(tr("Ready"), 2000);

  QSettings settings(g_settings);
  settings.beginGroup("plugins");
  QStringList value = settings.value("gui").toStringList();
  settings.endGroup();

  QToolBar* toolbar = new QToolBar();
  for(int i = 0; i<value.size(); i++){
      toolbar->addAction(value.at(i), this, SLOT(pluginLoader()));
  }
  toolbar->show();
  toolbar->setObjectName("MainToolbar");

  addToolBar(toolbar);
  setUnifiedTitleAndToolBarOnMac(true);
}