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


C++ QToolBar::addActions方法代码示例

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


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

示例1: world

Attachments::Attachments( TagWorld *w, Item* i ) :
  world( w ), item( i )
{
  attList = new QListWidget();
  
  QToolBar *tools = new QToolBar();
  actions = new QActionGroup(this);
  addAction = actions->addAction( "+" );
  rmAction = actions->addAction( "-" );
  editAction = actions->addAction( "Edit" );
  openAction = actions->addAction( "Open" );
  tools->addActions(actions->actions());
  
  QVBoxLayout *box = new QVBoxLayout();
  box->addWidget(tools);
  box->addWidget(attList);
  box->setContentsMargins(0,0,0,0);
  box->setSpacing(0);
  
  setLayout( box );
  
  attList->setContextMenuPolicy( Qt::CustomContextMenu );
  
  setWindowTitle( "New attachment" );

  connect(addAction, SIGNAL(triggered()), this, SLOT(add()));
  connect(rmAction, SIGNAL(triggered()), this, SLOT(remove()));
  connect(editAction, SIGNAL(triggered()), this, SLOT(edit()));
  connect(attList, SIGNAL(itemDoubleClicked(QListWidgetItem*)),
          this, SLOT(edit()));
  connect(attList, SIGNAL(customContextMenuRequested(const QPoint &)),
          this, SLOT(contextMenu(const QPoint &)));

  setItem( i );
}
开发者ID:jleben,项目名称:LinkedNotes,代码行数:35,代码来源:Attachments.cpp

示例2: addView

void IdealController::addView(Qt::DockWidgetArea area, View* view)
{
    IdealDockWidget *dock = new IdealDockWidget(this, m_mainWindow);
    // dock object name is used to store toolview settings
    QString dockObjectName = view->document()->title();
    // support different configuration for same docks opened in different areas
    if (m_mainWindow->area())
        dockObjectName += '_' + m_mainWindow->area()->objectName();

    dock->setObjectName(dockObjectName);

    KAcceleratorManager::setNoAccel(dock);
    QWidget *w = view->widget(dock);
    if (w->parent() == 0)
    {
        /* Could happen when we're moving the widget from
           one IdealDockWidget to another.  See moveView below.
           In this case, we need to reparent the widget. */
        w->setParent(dock);
    }

    QList<QAction *> toolBarActions = view->toolBarActions();
    if (toolBarActions.isEmpty()) {
      dock->setWidget(w);
    } else {
      QMainWindow *toolView = new QMainWindow();
      QToolBar *toolBar = new QToolBar(toolView);
      int iconSize = m_mainWindow->style()->pixelMetric(QStyle::PM_SmallIconSize);
      toolBar->setIconSize(QSize(iconSize, iconSize));
      toolBar->setToolButtonStyle(Qt::ToolButtonIconOnly);
      toolBar->setWindowTitle(i18n("%1 Tool Bar", w->windowTitle()));
      toolBar->setFloatable(false);
      toolBar->setMovable(false);
      toolBar->addActions(toolBarActions);
      toolView->setCentralWidget(w);
      toolView->addToolBar(toolBar);
      dock->setWidget(toolView);
    }

    dock->setWindowTitle(view->widget()->windowTitle());
    dock->setWindowIcon(view->widget()->windowIcon());
    dock->setFocusProxy(dock->widget());

    if (IdealButtonBarWidget* bar = barForDockArea(area)) {
        QAction* action = bar->addWidget(
            view->document()->title(), dock,
            static_cast<MainWindow*>(parent())->area(), view);
        m_dockwidget_to_action[dock] = m_view_to_action[view] = action;

        m_docks->addAction(action);
        connect(dock, &IdealDockWidget::closeRequested, action, &QAction::toggle);
    }

    connect(dock, &IdealDockWidget::dockLocationChanged, this, &IdealController::dockLocationChanged);

    dock->hide();

    docks.insert(dock);
}
开发者ID:mali,项目名称:kdevplatform,代码行数:59,代码来源:idealcontroller.cpp

示例3: makeGUIElements

iscore::GUIElements ApplicationPlugin::makeGUIElements()
{
    GUIElements e;

    QToolBar* bar = new QToolBar;
    bar->addActions({m_move, m_scale, m_rotate});
    e.toolbars.emplace_back(bar, StringKey<iscore::Toolbar>("Space"), 0, 5);

    return e;
}
开发者ID:OSSIA,项目名称:iscore-addon-space,代码行数:10,代码来源:ApplicationPlugin.cpp

示例4: BaseWidget

NavigationWidget::NavigationWidget(QWidget* parent) :
    BaseWidget(parent, "NavigationWidget", "Navigation Properties"),
    mVerticalLayout(new QVBoxLayout(this)),
    mCameraGroupBox(new QGroupBox(tr("Camera Style"), this)),
    mCameraGroupLayout(new QVBoxLayout())
{
	this->setToolTip("Camera follow style");
  //camera setttings
  mCameraGroupBox->setLayout(mCameraGroupLayout);

  QToolBar* toolBar = new QToolBar(this);
  mCameraGroupLayout->addWidget(toolBar);
  toolBar->addActions(viewService()->createInteractorStyleActionGroup()->actions());

  QWidget* toolOffsetWidget = new SliderGroupWidget(this, DoublePropertyActiveToolOffset::create());

  //layout
  this->setLayout(mVerticalLayout);
  mVerticalLayout->addWidget(mCameraGroupBox);
  mVerticalLayout->addWidget(toolOffsetWidget);
  mVerticalLayout->addStretch();
}
开发者ID:normit-nav,项目名称:CustusX,代码行数:22,代码来源:cxNavigationWidget.cpp

示例5: setupTextActions

void TextEdit::setupTextActions()
{
    QToolBar *tb = new QToolBar(this);
    tb->setWindowTitle(tr("Format Actions"));
    addToolBar(tb);

    QMenu *menu = new QMenu(tr("F&ormat"), this);
    menuBar()->addMenu(menu);

    actionTextBold = new QAction(QIcon::fromTheme("format-text-bold", QIcon(rsrcPath + "/textbold.png")),
                                 tr("&Bold"), this);
    actionTextBold->setShortcut(Qt::CTRL + Qt::Key_B);
    actionTextBold->setPriority(QAction::LowPriority);
	QFont bold;
    bold.setBold(true);
    actionTextBold->setFont(bold);
    connect(actionTextBold, SIGNAL(triggered()), this, SLOT(textBold()));
    tb->addAction(actionTextBold);
    menu->addAction(actionTextBold);
    actionTextBold->setCheckable(true);

    actionTextItalic = new QAction(QIcon::fromTheme("format-text-italic", QIcon(rsrcPath + "/textitalic.png")),
                                   tr("&Italic"), this);
    actionTextItalic->setPriority(QAction::LowPriority);
    actionTextItalic->setShortcut(Qt::CTRL + Qt::Key_I);
    QFont italic;
    italic.setItalic(true);
    actionTextItalic->setFont(italic);
    connect(actionTextItalic, SIGNAL(triggered()), this, SLOT(textItalic()));
    tb->addAction(actionTextItalic);
    menu->addAction(actionTextItalic);
    actionTextItalic->setCheckable(true);

    actionTextUnderline = new QAction(QIcon::fromTheme("format-text-underline", QIcon(rsrcPath + "/textunder.png")),
                                      tr("&Underline"), this);
    actionTextUnderline->setShortcut(Qt::CTRL + Qt::Key_U);
    actionTextUnderline->setPriority(QAction::LowPriority);
    QFont underline;
    underline.setUnderline(true);
    actionTextUnderline->setFont(underline);
    connect(actionTextUnderline, SIGNAL(triggered()), this, SLOT(textUnderline()));
    tb->addAction(actionTextUnderline);
    menu->addAction(actionTextUnderline);
    actionTextUnderline->setCheckable(true);

    menu->addSeparator();

    QActionGroup *grp = new QActionGroup(this);
    connect(grp, SIGNAL(triggered(QAction*)), this, SLOT(textAlign(QAction*)));

    // Make sure the alignLeft  is always left of the alignRight
    if (QApplication::isLeftToRight()) {
        actionAlignLeft = new QAction(QIcon::fromTheme("format-justify-left", QIcon(rsrcPath + "/textleft.png")),
                                      tr("&Left"), grp);
        actionAlignCenter = new QAction(QIcon::fromTheme("format-justify-center", QIcon(rsrcPath + "/textcenter.png")), tr("C&enter"), grp);
        actionAlignRight = new QAction(QIcon::fromTheme("format-justify-right", QIcon(rsrcPath + "/textright.png")), tr("&Right"), grp);
    } else {
        actionAlignRight = new QAction(QIcon::fromTheme("format-justify-right", QIcon(rsrcPath + "/textright.png")), tr("&Right"), grp);
        actionAlignCenter = new QAction(QIcon::fromTheme("format-justify-center", QIcon(rsrcPath + "/textcenter.png")), tr("C&enter"), grp);
        actionAlignLeft = new QAction(QIcon::fromTheme("format-justify-left", QIcon(rsrcPath + "/textleft.png")), tr("&Left"), grp);
    }
    actionAlignJustify = new QAction(QIcon::fromTheme("format-justify-fill", QIcon(rsrcPath + "/textjustify.png")), tr("&Justify"), grp);

    actionAlignLeft->setShortcut(Qt::CTRL + Qt::Key_L);
    actionAlignLeft->setCheckable(true);
    actionAlignLeft->setPriority(QAction::LowPriority);
    actionAlignCenter->setShortcut(Qt::CTRL + Qt::Key_E);
    actionAlignCenter->setCheckable(true);
    actionAlignCenter->setPriority(QAction::LowPriority);
    actionAlignRight->setShortcut(Qt::CTRL + Qt::Key_R);
    actionAlignRight->setCheckable(true);
    actionAlignRight->setPriority(QAction::LowPriority);
    actionAlignJustify->setShortcut(Qt::CTRL + Qt::Key_J);
    actionAlignJustify->setCheckable(true);
    actionAlignJustify->setPriority(QAction::LowPriority);

    tb->addActions(grp->actions());
    menu->addActions(grp->actions());

    menu->addSeparator();

    QPixmap pix(24, 24);
    
    pix.fill(Qt::black);
    actionTextColor = new QAction(QIcon::fromTheme("text-color", QIcon(rsrcPath + "/textcolor.png")), 
    									tr("&Text Color..."), this);
    connect(actionTextColor, SIGNAL(triggered()), this, SLOT(textColor()));
    tb->addAction(actionTextColor);
    menu->addAction(actionTextColor);
    
    pix.fill(Qt::green);
    actionHighlightedTextColor = new QAction(QIcon::fromTheme("text-highlight-color", QIcon(rsrcPath + "/texthighlight.png")), 
    									tr("&Text Highlight Color..."), this);
    connect(actionHighlightedTextColor, SIGNAL(triggered()), this, SLOT(HighlightedText()));
    tb->addAction(actionHighlightedTextColor);
    menu->addAction(actionHighlightedTextColor);
    
    
   //pix.fill(Qt::white);
    actionBackgroundColor = new QAction(QIcon::fromTheme("bg-color", QIcon(rsrcPath + "/bgfill.png")), 
//.........这里部分代码省略.........
开发者ID:Giova84,项目名称:LittleWriter,代码行数:101,代码来源:textedit.cpp

示例6: toolBar

QToolBar* specActionLibrary::toolBar(QWidget* target)
{
	QToolBar* bar = new QToolBar(target) ;
	bar->setContentsMargins(0, 0, 0, 0) ;
	bar->setIconSize(QSize(20, 20)) ;

	specView* view = dynamic_cast<specView*>(target) ;
	specDataView*   dataView   = dynamic_cast<specDataView*>(target) ;
	specMetaView*   metaView   = dynamic_cast<specMetaView*>(target) ;
	specLogView*    logView    = dynamic_cast<specLogView*>(target) ;
	specPlot*       plot       = dynamic_cast<specPlot*>(target) ;
	specPlotWidget* plotWidget = dynamic_cast<specPlotWidget*>(target) ;

	if(view && view->model())
	{
		addParent(view) ;
		addParent(view->model()) ;
		addNewAction(bar, new specAddFolderAction(target)) ;
		if(metaView)
			addNewAction(bar, new specNewMetaItemAction(target));
		else
		{
			addNewAction(bar, new specImportSpecAction(target)) ;
			addNewAction(bar, new specTreeAction(target)) ;
			addNewAction(bar, new specFlattenTreeAction(target)) ;
		}
		if(dataView || metaView)
			addNewAction(bar, new specAddSVGItemAction(target)) ;
		addNewAction(bar, new genericExportAction(target)) ;
		bar->addSeparator() ;
		addNewAction(bar, new specCopyAction(target)) ;
		if(dataView || metaView)
			addNewAction(bar, new matrixExportAction(target)) ;
		addNewAction(bar, new specCutAction(target)) ;
		addNewAction(bar, new specPasteAction(target)) ;
		addNewAction(bar, new specDeleteAction(target)) ;
		bar->addSeparator() ;
		if(metaView || logView)
		{
			bar->addAction(undoAction(view)) ;
			bar->addAction(redoAction(view)) ;
			bar->addSeparator() ;
		}
		if(dataView)
		{
			addNewAction(bar, new toggle3DPlotAction(target)) ;
			addNewAction(bar, new specMergeAction(target)) ;
			addNewAction(bar, new specTiltMatrixAction(target)) ;
			addNewAction(bar, new specDescriptorEditAction(target)) ;
			bar->addSeparator() ;
			addNewAction(bar, new specRemoveDataAction(target)) ;
			addNewAction(bar, new specAverageDataAction(target)) ;
			addNewAction(bar, new specSpectrumCalculatorAction(target)) ;
			addNewAction(bar, new specNormalizeAction(target)) ;
		}
		addNewAction(bar, new specItemPropertiesAction(target)) ;
		addNewAction(bar, new specSetMultilineAction(target)) ;
		if(metaView)
		{
			addNewAction(bar, new specAddConnectionsAction(target)) ;
			addNewAction(bar, new specSelectConnectedAction(target)) ;
			addNewAction(bar, new specAddFitAction(target)) ;
			addNewAction(bar, new specRemoveFitAction(target)) ;
			addNewAction(bar, new specToggleFitStyleAction(target));
			addNewAction(bar, new specConductFitAction(target)) ;
		}
		if(logView)
			addNewAction(bar, new specDescriptorEditAction(target)) ;
		bar->addSeparator() ;
		if(dataView || metaView)
			addNewAction(bar, new changePlotStyleAction(target)) ;
		bar->setWindowTitle(tr("Items toolbar"));
	}

	if(plot)
	{
		addParent(plot);
		addNewAction(bar, new specTitleAction(target)) ;
		addNewAction(bar, new specXLabelAction(target)) ;
		addNewAction(bar, new specYLabelAction(target)) ;
		bar->addActions(plot->actions());
		bar->setWindowTitle(tr("Plot toolbar"));
	}

	if(plotWidget)
	{
		delete bar ;
		bar = plotWidget->createToolbar() ;
		bar-> addSeparator() ;
		bar-> addAction(purgeUndoAction) ;
		bar-> addSeparator() ;
		bar-> addAction(undoAction(this)) ;
		bar-> addAction(redoAction(this)) ;
		bar->setWindowTitle(tr("Main toolbar"));
	}

	return bar ;
}
开发者ID:hvennekate,项目名称:data_element,代码行数:98,代码来源:specactionlibrary.cpp

示例7: QDockWidget

TextTools::TextTools(QWidget* parent)
   : QDockWidget(parent)
      {
      _textElement = 0;
      setObjectName("text-tools");
      setWindowTitle(tr("Text Tools"));
      setAllowedAreas(Qt::DockWidgetAreas(Qt::TopDockWidgetArea | Qt::BottomDockWidgetArea));

      QToolBar* tb = new QToolBar(tr("Text Edit"));
      tb->setIconSize(QSize(preferences.iconWidth, preferences.iconHeight));

      textStyles = new QComboBox;
      tb->addWidget(textStyles);

      showKeyboard = getAction("show-keys");
      showKeyboard->setCheckable(true);
      tb->addAction(showKeyboard);

      typefaceBold = tb->addAction(*icons[textBold_ICON], "");
      typefaceBold->setToolTip(tr("bold"));
      typefaceBold->setCheckable(true);

      typefaceItalic = tb->addAction(*icons[textItalic_ICON], "");
      typefaceItalic->setToolTip(tr("italic"));
      typefaceItalic->setCheckable(true);

      typefaceUnderline = tb->addAction(*icons[textUnderline_ICON], "");
      typefaceUnderline->setToolTip(tr("underline"));
      typefaceUnderline->setCheckable(true);

      tb->addSeparator();

      QActionGroup* ha = new QActionGroup(tb);
      leftAlign   = new QAction(*icons[textLeft_ICON],   "", ha);
      leftAlign->setToolTip(tr("align left"));
      leftAlign->setCheckable(true);
      leftAlign->setData(ALIGN_LEFT);
      hcenterAlign = new QAction(*icons[textCenter_ICON], "", ha);
      hcenterAlign->setToolTip(tr("align horizontal center"));
      hcenterAlign->setCheckable(true);
      hcenterAlign->setData(ALIGN_HCENTER);
      rightAlign  = new QAction(*icons[textRight_ICON],  "", ha);
      rightAlign->setToolTip(tr("align right"));
      rightAlign->setCheckable(true);
      rightAlign->setData(ALIGN_RIGHT);
      tb->addActions(ha->actions());

      QActionGroup* va = new QActionGroup(tb);
      topAlign  = new QAction(*icons[textTop_ICON],  "", va);
      topAlign->setToolTip(tr("align top"));
      topAlign->setCheckable(true);
      topAlign->setData(ALIGN_TOP);

      bottomAlign  = new QAction(*icons[textBottom_ICON],  "", va);
      bottomAlign->setToolTip(tr("align bottom"));
      bottomAlign->setCheckable(true);
      bottomAlign->setData(ALIGN_BOTTOM);

      baselineAlign  = new QAction(*icons[textBaseline_ICON],  "", va);
      baselineAlign->setToolTip(tr("align vertical baseline"));
      baselineAlign->setCheckable(true);
      baselineAlign->setData(ALIGN_BASELINE);

      vcenterAlign  = new QAction(*icons[textVCenter_ICON],  "", va);
      vcenterAlign->setToolTip(tr("align vertical center"));
      vcenterAlign->setCheckable(true);
      vcenterAlign->setData(ALIGN_VCENTER);
      tb->addActions(va->actions());

      typefaceSubscript   = tb->addAction(*icons[textSub_ICON], "");
      typefaceSubscript->setToolTip(tr("subscript"));
      typefaceSubscript->setCheckable(true);

      typefaceSuperscript = tb->addAction(*icons[textSuper_ICON], "");
      typefaceSuperscript->setToolTip(tr("superscript"));
      typefaceSuperscript->setCheckable(true);

      unorderedList = tb->addAction(*icons[formatListUnordered_ICON], "");
      unorderedList->setToolTip(tr("unordered list"));

      orderedList = tb->addAction(*icons[formatListOrdered_ICON], "");
      orderedList->setToolTip(tr("ordered list"));

      indentMore = tb->addAction(*icons[formatIndentMore_ICON], "");
      indentMore->setToolTip(tr("indent more"));

      indentLess = tb->addAction(*icons[formatIndentLess_ICON], "");
      indentLess->setToolTip(tr("indent less"));

      tb->addSeparator();

      typefaceFamily = new QFontComboBox(this);
      tb->addWidget(typefaceFamily);
      typefaceSize = new QDoubleSpinBox(this);
      tb->addWidget(typefaceSize);

      setWidget(tb);
      QWidget* w = new QWidget(this);
      setTitleBarWidget(w);
      titleBarWidget()->hide();
//.........这里部分代码省略.........
开发者ID:BlueMockingbird,项目名称:MuseScore,代码行数:101,代码来源:texttools.cpp

示例8: iconSize

MainWindow::MainWindow()
    : hotkeyID(1)
    , previousPath(QDir::homePath())
{
    // Install a native event filter to handle the hotkeys
    this->nativeEventFilter = new NativeEventFilter;

    // Create the actions. they will be available in the main toolbar
    this->actionNewList = new QAction(QIcon(":/icon64/NewList.png"), "", this);
    this->actionNewList->setToolTip(tr("Create a new empty list"));

    this->actionOpenList = new QAction(QIcon(":/icon64/OpenList.png"), "", this);
    this->actionOpenList->setToolTip(tr("Open an existing list"));

    this->actionSaveList = new QAction(QIcon(":/icon64/SaveList.png"), "", this);
    this->actionSaveList->setToolTip(tr("Save the current list"));

    this->actionNewTimer = new QAction(QIcon(":/icon64/NewTimer.png"), "", this);
    this->actionNewTimer->setToolTip(tr("Create a new Timer for the current list"));

    this->actionEditTimer = new QAction(QIcon(":/icon64/EditTimer.png"), "", this);
    this->actionEditTimer->setToolTip(tr("Modify the currently selected Timer"));

    this->actionRemoveTimer = new QAction(QIcon(":/icon64/RemoveTimer.png"), "", this);
    this->actionRemoveTimer->setToolTip(tr("Remove the currently selected timer"));

    this->actionMisc = new QAction(QIcon(":/icon64/Misc.png"), "", this);
    this->actionMisc->setToolTip(tr("About, Help and Licenses"));

    QAction* actionSeparator1 = new QAction(this);
    QAction* actionSeparator2 = new QAction(this);
    actionSeparator1->setSeparator(true);
    actionSeparator2->setSeparator(true);

    // Create the main toolbar and insert the actions
    QList<QAction*> actionList;
    actionList << actionNewList << actionOpenList << actionSaveList << actionSeparator1 << actionNewTimer << actionEditTimer << actionRemoveTimer
               << actionSeparator2 << actionMisc;

    QSize iconSize(MAIN_TOOLBAR_ICON_WIDTH, MAIN_TOOLBAR_ICON_HEIGHT);

    QToolBar* toolBar = new QToolBar(this);
    toolBar->setIconSize(iconSize);
    toolBar->addActions(actionList);
    toolBar->setMovable(false);
    this->addToolBar(toolBar);

    // Create the main widget, a table which display the timers
    // The table display three columns: sound name, period and hotkey
    this->timerTable = new QTableWidget(0, COLUMN_COUNT, this);

    // Table properties
    this->timerTable->setShowGrid(true);
    this->timerTable->setSortingEnabled(false);
    this->timerTable->setAlternatingRowColors(true);
    this->timerTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
    this->timerTable->setSelectionMode(QAbstractItemView::SingleSelection);
    this->timerTable->setSelectionBehavior(QAbstractItemView::SelectRows);
    this->timerTable->horizontalHeader()->setStretchLastSection(true);
    this->timerTable->verticalHeader()->setVisible(false);

    // Set the columns header and size
    QStringList labels;
    labels << tr("Status") << tr("Sound name") << tr("Period") << tr("Hotkey");
    this->timerTable->setHorizontalHeaderLabels(labels);

    this->timerTable->setColumnWidth(COLUMN_STATUS, 60);
    this->timerTable->setColumnWidth(COLUMN_NAME, 200);
    this->timerTable->setColumnWidth(COLUMN_PERIOD, 100);
    this->timerTable->setColumnWidth(COLUMN_HOTKEY, 150);

    // Finally, install the table in the main window
    setCentralWidget(this->timerTable);

    // Main toolbar connections
    connect(this->actionNewList, &QAction::triggered, this, &MainWindow::newListTriggerred);
    connect(this->actionOpenList, &QAction::triggered, this, &MainWindow::openListTriggerred);
    connect(this->actionSaveList, &QAction::triggered, [this] { promptForFilename() && save(); });
    connect(this->actionNewTimer, &QAction::triggered, this, &MainWindow::newTimerTriggerred);
    connect(this->actionEditTimer, &QAction::triggered, this, &MainWindow::editTimerTriggerred);
    connect(this->actionRemoveTimer, &QAction::triggered, this, &MainWindow::removeTimerTriggerred);
    connect(this->actionMisc, &QAction::triggered, [this] { DlgMisc::showDlgMisc(this); });

    // Table connections
    connect(this->timerTable, &QTableWidget::itemSelectionChanged, this, &MainWindow::timerSelectionChanged);
    connect(this->timerTable, &QTableWidget::itemDoubleClicked, this, &MainWindow::editTimerTriggerred);

    // Interface update
    connect(&this->modified, &Modified::changed, this, &MainWindow::updateUI);

    // Trigger some slots to have a consistent interface
    timerSelectionChanged();
    updateUI();
    adjustSize();
}
开发者ID:Folcogh,项目名称:SC2Metro,代码行数:95,代码来源:MainWindow.cpp

示例9: createGui

void MainWindow::createGui()
{
    // Menus
    fileMenu = menuBar()->addMenu(tr("Файл"));
    fileMenu->addAction(action_file_newdatabase);
    fileMenu->addAction(action_file_open);
    fileMenu->addSeparator();
    fileMenu->addAction(action_file_save);
    fileMenu->addAction(action_file_saveas);
    fileMenu->addAction(action_file_export);
    fileMenu->addSeparator();
    fileMenu->addAction(action_file_properties);
    fileMenu->addAction(action_file_print);
    fileMenu->addSeparator();
    fileMenu->addAction(action_file_exit);

    editMenu = menuBar()->addMenu(tr("Правка"));
    editMenu->addAction(action_edit_undo);
    editMenu->addAction(action_edit_redo);
    editMenu->addSeparator();
    editMenu->addAction(action_edit_cut);
    editMenu->addAction(action_edit_copy);
    editMenu->addAction(action_edit_paste);
    editMenu->addSeparator();
    editMenu->addAction(action_edit_find);
    editMenu->addAction(action_edit_selectall);
    editMenu->addSeparator();
    editMenu->addAction(action_edit_delete);

    viewMenu = menuBar()->addMenu(tr("Вид"));
    viewMenu->addAction(action_view_tree);

    taskMenu = menuBar()->addMenu(tr("Инструменты"));
    taskMenu->addAction(action_task_info);
    taskMenu->addAction(action_task_calendar);
    taskMenu->addAction(action_task_strat);
    taskMenu->addAction(action_task_plan);
    taskMenu->addAction(action_task_artifact);
    taskMenu->addSeparator();
    taskMenu->addAction(action_task_settings);

    helpMenu = menuBar()->addMenu(tr("Справка"));
    helpMenu->addAction(action_help_activation);
    helpMenu->addSeparator();
    helpMenu->addAction(action_help_about);

    // Tool Bar
    QToolBar *toolBar = new QToolBar;
    toolBar->addActions(actions_toolbar);
    addToolBar(Qt::TopToolBarArea, toolBar);
    toolBar->setContextMenuPolicy(Qt::PreventContextMenu);

    // Status Bar
    statusBar()->showMessage(tr(" "));

    // Central widget
    centralWidget = new CentralWidget(this);
    QWidget *w = new QWidget;
    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->addWidget(centralWidget);
    //mainLayout->addWidget(console);
    w->setLayout(mainLayout);
    setCentralWidget(w);

    // ObjectsTree dock
    dock = new QDockWidget(this);
    objectsTree = new ArchObjectsTree;
    objectsTree->setupActions(actions_tasks);
    dock->setWidget(objectsTree);
    addDockWidget(Qt::LeftDockWidgetArea, dock);
    dock->setWindowTitle(tr("Дерево объектов"));

    // MainWindow
    setWindowIcon(QIcon(":/images/logo.png"));
}
开发者ID:khasanov,项目名称:ArchaeologicalProject,代码行数:75,代码来源:MainWindow.cpp

示例10: QMainWindow

Window::Window(QWidget* parent) :
    QMainWindow(parent)
{
    setObjectName("ChatWindow");

    Settings::getInstance().load();
    connect(&Settings::getInstance(), &Settings::dataChanged, this, &Window::applySettings);

    QToolBar* toolbar = new QToolBar(this);
    toolbar->setIconSize(QSize(24, 24));
    toolbar->setFloatable(false);
    toolbar->setContextMenuPolicy(Qt::PreventContextMenu);
    addToolBar(toolbar);

    //QAction* refreshAction = toolbar->addAction(QIcon(":/icons/refresh.png"), "refresh");
    //connect(refreshAction, SIGNAL(triggered()), this, SLOT(refreshPlanets()));

    QDockWidget* inputDock = new QDockWidget(this);
    inputDock->setObjectName("Input dock");
    inputDock->setFeatures(QDockWidget::NoDockWidgetFeatures);
    inputDock->setTitleBarWidget(new QWidget(inputDock));
    inputDock->setContextMenuPolicy(Qt::PreventContextMenu);
    addDockWidget(Qt::BottomDockWidgetArea, inputDock);
    QWidget* inputDockWidget = new QWidget(inputDock);
    QHBoxLayout* inputDockWidgetLayout = new QHBoxLayout(inputDockWidget);
    nickLabel = new QLabel(inputDockWidget);
    nickLabel->hide();
    inputLine = new QLineEdit(inputDockWidget);

    connect(inputLine, &QLineEdit::returnPressed, this, &Window::sendMessage);
    inputDockWidgetLayout->addWidget(nickLabel);
    inputDockWidgetLayout->addWidget(inputLine);
    inputDockWidgetLayout->setContentsMargins(2, 2, 2, 6);
    inputDockWidget->setLayout(inputDockWidgetLayout);
    inputDock->setFixedHeight(inputDock->height());
    inputDock->setWidget(inputDockWidget);

    QDockWidget* tabDock = new QDockWidget(this);
    tabDock->setObjectName("Tab dock");
    tabDock->setFeatures(QDockWidget::NoDockWidgetFeatures);
    tabDock->setTitleBarWidget(new QWidget(tabDock));
    tabDock->setContextMenuPolicy(Qt::PreventContextMenu);
    addDockWidget(Qt::LeftDockWidgetArea, tabDock);
    setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea);
    setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea);
    tabTree = new TabTree(tabDock, 100);
    tabTree->setHeaderLabel("Chats");
    tabTree->setIndentation(8);
    tabTree->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    tabTree->setMinimumWidth(1);
    tabTree->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
    tabDock->setWidget(tabTree);
    tabTree->setContextMenuPolicy(Qt::CustomContextMenu);
    connect(tabTree, &QTreeWidget::itemSelectionChanged, this, &Window::tabSelected);
    connect(tabTree, &QTreeWidget::customContextMenuRequested, this, &Window::showTabTreeContextMenu);

    QAction* connectAction = new QAction(QIcon(":/icons/connect.png"), "Connect", toolbar);
    QAction* disconnectAction = new QAction(QIcon(":/icons/disconnect.png"), "Disconnect", toolbar);
    QAction* settingsAction = toolbar->addAction(QIcon(":/icons/settings.png"), "Settings");
    connect(connectAction, &QAction::triggered, this, &Window::connectToServer);
    connect(disconnectAction, &QAction::triggered, this, &Window::disconnectFromServer);
    connect(settingsAction, &QAction::triggered, this, &Window::showSettingsDialog);
    toolbar->addActions(QList<QAction*>() << connectAction << disconnectAction << settingsAction);

    serverTab = new QTreeWidgetItem(tabTree, QStringList() << "IRC Server");
    tabTree->addTopLevelItem(serverTab);

    userDock = new QDockWidget(this);
    userDock->setObjectName("User dock");
    userDock->setFeatures(QDockWidget::NoDockWidgetFeatures);
    userDock->setTitleBarWidget(new QWidget(userDock));
    userDock->setContextMenuPolicy(Qt::PreventContextMenu);
    addDockWidget(Qt::RightDockWidgetArea, userDock);
    setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea);
    setCorner(Qt::TopRightCorner, Qt::RightDockWidgetArea);
    userTree = new UserTree(userDock, 100);
    userTree->setItemsExpandable(false);
    userTree->setIndentation(8);
    userTree->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    userTree->setMinimumWidth(1);
    userTree->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
    userDock->setWidget(userTree);
    connect(userTree, &UserTree::privateActionTriggered, this, &Window::startPrivate);

    topicDock = new QDockWidget(this);
    topicDock->setObjectName("Topic dock");
    topicDock->setFeatures(QDockWidget::NoDockWidgetFeatures);
    topicDock->setTitleBarWidget(new QWidget(topicDock));
    topicDock->setContextMenuPolicy(Qt::PreventContextMenu);
    addDockWidget(Qt::TopDockWidgetArea, topicDock);
    topicLine = new TopicLabel(topicDock);
    topicDock->setWidget(topicLine);

    QMainWindow* pagesWindow = new QMainWindow(0);
    pages = new QStackedWidget(pagesWindow);

    serverPage = new ServerPage(serverTab, tabTree);
    connect(serverPage, &ServerPage::connectActionTriggered,    this, &Window::connectToServer);
    connect(serverPage, &ServerPage::disconnectActionTriggered, this, &Window::disconnectFromServer);

//.........这里部分代码省略.........
开发者ID:nurupo,项目名称:nfk-lobby,代码行数:101,代码来源:chatwindow.cpp

示例11: setupTextActions

void GraphicTextDialog::setupTextActions()
{
    QToolBar *tb = toolBar;

    QString rsrcPath = Qucs::bitmapDirectory();
    actionTextBold = new QAction(QIcon(rsrcPath + "textbold.png"), tr("&Bold"), this);
    actionTextBold->setShortcut(Qt::CTRL + Qt::Key_B);
    QFont bold;
    bold.setBold(true);
    actionTextBold->setFont(bold);
    connect(actionTextBold, SIGNAL(triggered()), this, SLOT(textBold()));
    tb->addAction(actionTextBold);

    actionTextBold->setCheckable(true);

    actionTextItalic = new QAction(QIcon(rsrcPath + "textitalic.png"), tr("&Italic"), this);
    actionTextItalic->setShortcut(Qt::CTRL + Qt::Key_I);
    QFont italic;
    italic.setItalic(true);
    actionTextItalic->setFont(italic);
    connect(actionTextItalic, SIGNAL(triggered()), this, SLOT(textItalic()));
    tb->addAction(actionTextItalic);

    actionTextItalic->setCheckable(true);

    actionTextUnderline = new QAction(QIcon(rsrcPath + "textunder.png"), tr("&Underline"), this);
    actionTextUnderline->setShortcut(Qt::CTRL + Qt::Key_U);
    QFont underline;
    underline.setUnderline(true);
    actionTextUnderline->setFont(underline);
    connect(actionTextUnderline, SIGNAL(triggered()), this, SLOT(textUnderline()));
    tb->addAction(actionTextUnderline);

    actionTextUnderline->setCheckable(true);

    QActionGroup *grp = new QActionGroup(this);
    connect(grp, SIGNAL(triggered(QAction *)), this, SLOT(textAlign(QAction *)));

    actionAlignLeft = new QAction(QIcon(rsrcPath + "textleft.png"), tr("&Left"), grp);
    actionAlignLeft->setShortcut(Qt::CTRL + Qt::Key_L);
    actionAlignLeft->setCheckable(true);
    actionAlignCenter = new QAction(QIcon(rsrcPath + "textcenter.png"), tr("C&enter"), grp);
    actionAlignCenter->setShortcut(Qt::CTRL + Qt::Key_E);
    actionAlignCenter->setCheckable(true);
    actionAlignRight = new QAction(QIcon(rsrcPath + "textright.png"), tr("&Right"), grp);
    actionAlignRight->setShortcut(Qt::CTRL + Qt::Key_R);
    actionAlignRight->setCheckable(true);
    actionAlignJustify = new QAction(QIcon(rsrcPath + "textjustify.png"), tr("&Justify"), grp);
    actionAlignJustify->setShortcut(Qt::CTRL + Qt::Key_J);
    actionAlignJustify->setCheckable(true);

    tb->addActions(grp->actions());
    tb->addSeparator();

    QPixmap pix(16, 16);
    pix.fill(Qt::black);
    actionTextColor = new QAction(pix, tr("&Color..."), this);
    connect(actionTextColor, SIGNAL(triggered()), this, SLOT(textColor()));
    tb->addAction(actionTextColor);

    tb = new QToolBar(this);
    tb->setIconSize(QSize(16, 16));
    mainLayout->insertWidget(2, tb);
    comboStyle = new QComboBox(tb);
    tb->addWidget(comboStyle);
    comboStyle->addItem("Standard");
    comboStyle->addItem("Bullet List (Disc)");
    comboStyle->addItem("Bullet List (Circle)");
    comboStyle->addItem("Bullet List (Square)");
    comboStyle->addItem("Ordered List (Decimal)");
    comboStyle->addItem("Ordered List (Alpha lower)");
    comboStyle->addItem("Ordered List (Alpha upper)");
    connect(comboStyle, SIGNAL(activated(int)),
            this, SLOT(textStyle(int)));

    comboFont = new QFontComboBox(tb);
    tb->addWidget(comboFont);
    connect(comboFont, SIGNAL(activated(const QString &)),
            this, SLOT(textFamily(const QString &)));
    comboFont->setCurrentFont(font());

    comboSize = new QComboBox(tb);
    comboSize->setObjectName("comboSize");
    tb->addWidget(comboSize);
    comboSize->setEditable(true);

    QFontDatabase db;
    foreach(int size, db.standardSizes()) {
        comboSize->addItem(QString::number(size));
    }

    connect(comboSize, SIGNAL(activated(const QString &)),
            this, SLOT(textSize(const QString &)));
    comboSize->setCurrentIndex(comboSize->findText(QString::number(QApplication::font()
                    .pointSize())));
    tb->addSeparator();
    grp = new QActionGroup(this);
    connect(grp, SIGNAL(triggered(QAction *)), this, SLOT(textAlignSubSuperScript(QAction *)));

    actionAlignSubscript = new QAction(QIcon(rsrcPath + "sub.png"), tr("Subscript"), grp);
//.........这里部分代码省略.........
开发者ID:damiansimanuk,项目名称:qucs-qt4,代码行数:101,代码来源:graphictextdialog.cpp

示例12: setupTextActions

void TextEdit::setupTextActions()
{
    QToolBar *tb = new QToolBar(this);
    tb->setWindowTitle(tr("Format Actions"));
    toolBar1.addWidget(tb);

    actionTextBold = new QAction(QIcon(rsrcPath + "/textbold.png"), tr("&Bold"), this);
    actionTextBold->setShortcut(Qt::CTRL + Qt::Key_B);
    QFont bold;
    bold.setBold(true);
    actionTextBold->setFont(bold);
    connect(actionTextBold, SIGNAL(triggered()), this, SLOT(textBold()));
    tb->addAction(actionTextBold);
    actionTextBold->setCheckable(true);

    actionTextItalic = new QAction(QIcon(rsrcPath + "/textitalic.png"), tr("&Italic"), this);
    actionTextItalic->setShortcut(Qt::CTRL + Qt::Key_I);
    QFont italic;
    italic.setItalic(true);
    actionTextItalic->setFont(italic);
    connect(actionTextItalic, SIGNAL(triggered()), this, SLOT(textItalic()));
    tb->addAction(actionTextItalic);
    actionTextItalic->setCheckable(true);

    actionTextUnderline = new QAction(QIcon(rsrcPath + "/textunder.png"), tr("&Underline"), this);
    actionTextUnderline->setShortcut(Qt::CTRL + Qt::Key_U);
    QFont underline;
    underline.setUnderline(true);
    actionTextUnderline->setFont(underline);
    connect(actionTextUnderline, SIGNAL(triggered()), this, SLOT(textUnderline()));
    tb->addAction(actionTextUnderline);
    actionTextUnderline->setCheckable(true);

    QActionGroup *grp = new QActionGroup(this);
    connect(grp, SIGNAL(triggered(QAction *)), this, SLOT(textAlign(QAction *)));

    // Make sure the alignLeft  is always left of the alignRight
    if (QApplication::isLeftToRight()) {
	actionAlignLeft = new QAction(QIcon(rsrcPath + "/textleft.png"), tr("&Left"), grp);
	actionAlignCenter = new QAction(QIcon(rsrcPath + "/textcenter.png"), tr("C&enter"), grp);
	actionAlignRight = new QAction(QIcon(rsrcPath + "/textright.png"), tr("&Right"), grp);
    } else {
	actionAlignRight = new QAction(QIcon(rsrcPath + "/textright.png"), tr("&Right"), grp);
	actionAlignCenter = new QAction(QIcon(rsrcPath + "/textcenter.png"), tr("C&enter"), grp);
	actionAlignLeft = new QAction(QIcon(rsrcPath + "/textleft.png"), tr("&Left"), grp);
    }
    actionAlignJustify = new QAction(QIcon(rsrcPath + "/textjustify.png"), tr("&Justify"), grp);

    actionAlignLeft->setShortcut(Qt::CTRL + Qt::Key_L);
    actionAlignLeft->setCheckable(true);
    actionAlignCenter->setShortcut(Qt::CTRL + Qt::Key_E);
    actionAlignCenter->setCheckable(true);
    actionAlignRight->setShortcut(Qt::CTRL + Qt::Key_R);
    actionAlignRight->setCheckable(true);
    actionAlignJustify->setShortcut(Qt::CTRL + Qt::Key_J);
    actionAlignJustify->setCheckable(true);

    tb->addActions(grp->actions());

    QPixmap pix(16, 16);
    pix.fill(Qt::black);
    actionTextColor = new QAction(pix, tr("&Color..."), this);
    connect(actionTextColor, SIGNAL(triggered()), this, SLOT(textColor()));
    tb->addAction(actionTextColor);

    tb = new QToolBar(this);
    tb->setAllowedAreas(Qt::TopToolBarArea | Qt::BottomToolBarArea);
    tb->setWindowTitle(tr("Format Actions"));
    toolBar2.addWidget(tb);

    comboStyle = new QComboBox(tb);
    tb->addWidget(comboStyle);
    comboStyle->addItem("Standard");
    comboStyle->addItem("Bullet List (Disc)");
    comboStyle->addItem("Bullet List (Circle)");
    comboStyle->addItem("Bullet List (Square)");
    comboStyle->addItem("Ordered List (Decimal)");
    comboStyle->addItem("Ordered List (Alpha lower)");
    comboStyle->addItem("Ordered List (Alpha upper)");
    connect(comboStyle, SIGNAL(activated(int)),
	    this, SLOT(textStyle(int)));

    comboFont = new QFontComboBox(tb);
    tb->addWidget(comboFont);
    connect(comboFont, SIGNAL(activated(const QString &)),
	    this, SLOT(textFamily(const QString &)));

    comboSize = new QComboBox(tb);
    comboSize->setObjectName("comboSize");
    tb->addWidget(comboSize);
    comboSize->setEditable(true);

    QFontDatabase db;
    foreach(int size, db.standardSizes())
	comboSize->addItem(QString::number(size));

    connect(comboSize, SIGNAL(activated(const QString &)),
	    this, SLOT(textSize(const QString &)));
    comboSize->setCurrentIndex(comboSize->findText(QString::number(QApplication::font()
								   .pointSize())));
//.........这里部分代码省略.........
开发者ID:ferustigris,项目名称:code-generator,代码行数:101,代码来源:textedit.cpp

示例13: geom

HelpWindow::HelpWindow(QWidget *parent) :
    QMainWindow(parent),
    mActionGoMainPage(new QAction(tr("Home"), this)),
    mActionBackward(new QAction(tr("Backward"), this)),
    mActionForward(new QAction(tr("Forward"), this)),
    mHelpEngine(new QHelpEngine(settingsObj.getPath(MSUSettings::PATH_SHARE_HELP) + "msuproj-qt.qhc", this)),
    mPageWidget(new HelpBrowser(mHelpEngine, this))
{
    QByteArray geom(settingsObj.getGeometry(MSUSettings::HELPWINDOW));
    if (geom.size() > 0)
    {
        this->restoreGeometry(geom);
        this->restoreState(settingsObj.getState(MSUSettings::HELPWINDOW));
    }
    else
        this->resize(900, 600);
    this->setContentsMargins(5, 0, 5, 5);
    this->setCentralWidget(mPageWidget);

    bool errorLoadingHelp = true;
    if (mHelpEngine->setupData())
    {
        locale = settingsObj.getLocale();
        if (!mHelpEngine->filterAttributes().contains(locale) ||
            !QFile(mHelpEngine->documentationFileName("amigos.msuproj-qt." + locale)).exists())
            locale = "en";

        if(QFile(mHelpEngine->documentationFileName("amigos.msuproj-qt." + locale)).exists())
        {
            errorLoadingHelp = false;
            mHelpEngine->setCurrentFilter(locale);

            QToolBar *navigationBar = new QToolBar(tr("Navigation"), this);
            navigationBar->setObjectName("HelpWindowNavBar");
            navigationBar->addActions({mActionGoMainPage, mActionBackward, mActionForward});
            this->addToolBar(navigationBar);

            QDockWidget *contentsDockWidget = new QDockWidget(tr("Contents"), this);
            contentsDockWidget->setObjectName("HelpWindowContentsDock");
            contentsDockWidget->setFeatures(QDockWidget::NoDockWidgetFeatures);
            this->addDockWidget(Qt::LeftDockWidgetArea, contentsDockWidget);

            QHelpContentWidget *contentWidget = mHelpEngine->contentWidget();
            contentsDockWidget->setWidget(contentWidget);

            connect(contentWidget, &QHelpContentWidget::clicked, this, &HelpWindow::setPage);
            connect(this, &HelpWindow::contentChange, mPageWidget, &HelpBrowser::setSource);

            connect(mPageWidget, &HelpBrowser::backwardAvailable, mActionBackward, &QAction::setEnabled);
            connect(mActionBackward, &QAction::triggered, mPageWidget, &HelpBrowser::backward);

            connect(mPageWidget, &HelpBrowser::forwardAvailable, mActionForward, &QAction::setEnabled);
            connect(mActionForward, &QAction::triggered, mPageWidget, &HelpBrowser::forward);

            connect(mActionGoMainPage, &QAction::triggered, this, &HelpWindow::goMainPage);

            connect(mPageWidget, &HelpBrowser::anchorClicked, this, &HelpWindow::setCurrentContentIndex);
            connect(mActionBackward, &QAction::triggered, this, &HelpWindow::setCurrentContentIndex);
            connect(mActionForward, &QAction::triggered, this, &HelpWindow::setCurrentContentIndex);

            this->goMainPage();
        }
    }

    if (errorLoadingHelp)
        mPageWidget->setHtml(QString("<html><head/><body><p align=\"center\"><span style=\" font-size:16pt; font-weight:600;\">%1</span></p>"
                                     "<p align=\"center\">%2</p></body></html>")
                             .arg(tr("Error loading help files."),
                                  tr("Could not load help files. Have You installed the MSUProj-Qt Help package?")));
}
开发者ID:mentaljam,项目名称:MSUProj,代码行数:70,代码来源:helpwindow.cpp

示例14: QMainWindow


//.........这里部分代码省略.........
            // Select row
            if (catergory == Player::Catergory::Hitter) {
                auto proxyModel = dynamic_cast<QSortFilterProxyModel*>(hitterTableView->model());
                auto proxyIdx = proxyModel->mapFromSource(srcIdx);
                hitterTableView->selectRow(proxyIdx.row());
                hitterTableView->setFocus();
            } else if (catergory == Player::Catergory::Pitcher) {
                auto proxyModel = dynamic_cast<QSortFilterProxyModel*>(pitcherTableView->model());
                auto proxyIdx = proxyModel->mapFromSource(srcIdx);
                pitcherTableView->selectRow(proxyIdx.row());
                pitcherTableView->setFocus();
            }
        };

        // Select the target 
        connect(completer, static_cast<void (QCompleter::*)(const QModelIndex&)>(&QCompleter::activated), [=](const QModelIndex& index) {

            // Get player index
            QAbstractProxyModel* proxyModel = dynamic_cast<QAbstractProxyModel*>(completer->completionModel());
            auto srcIdx = proxyModel->mapToSource(index);
            
            // Highlight this player
            HighlightPlayerInTable(srcIdx);
        });


        // Search widget
        QLineEdit* playerSearch = new QLineEdit(this);
        playerSearch->setCompleter(completer);

        // Main toolbar
        QToolBar* toolbar = new QToolBar("Toolbar");
        toolbar->addWidget(new QLabel(" Status: ", this));
        toolbar->addActions(QList<QAction*>{filterDrafted, filterReplacement});
        toolbar->addSeparator();
        toolbar->addWidget(new QLabel(" Leagues: ", this));
        toolbar->addActions(QList<QAction*>{filterAL, filterNL, filterFA});
        toolbar->addSeparator();
        toolbar->addWidget(new QLabel(" Positions: ", this));
        toolbar->addActions(QList<QAction*>{filterStarter, filterRelief});
        toolbar->addActions(QList<QAction*>{filterC, filter1B, filter2B, filterSS, filter3B, filterOF, filterCI, filterMI, filterDH, filterU});
        toolbar->addWidget(spacer);
        toolbar->addWidget(new QLabel("Player Search: ", this));
        toolbar->addWidget(playerSearch);
        toolbar->setFloatable(false);
        toolbar->setMovable(false);
        QMainWindow::addToolBar(toolbar);

        // Helper to adjust filters
        auto ToggleFilterGroups = [=](int index)
        {
            switch (index)
            {
            case uint32_t(PlayerTableTabs::Hitters):
                pitchingFilters->setVisible(false);
                hittingFilters->setVisible(true);
                break;
            case uint32_t(PlayerTableTabs::Pitchers):
                pitchingFilters->setVisible(true);
                hittingFilters->setVisible(false);
                break;
            default:
                break;
            }
        };
开发者ID:kspagnoli,项目名称:fbb,代码行数:66,代码来源:old_main.cpp

示例15: MDIChild

MDIClass::MDIClass( QWidget* parent )
	: MDIChild( parent )
{
	setObjectName( "MDIClass" );
	setType( ctClass );
	setWindowIcon( QIcon( ":/Icons/Icons/projectshowfile.png" ) );
	//
	QVBoxLayout* vboxLayout = new QVBoxLayout( this );
	vboxLayout->setObjectName( "vboxLayout" );
	vboxLayout->setSpacing( 0 );
	vboxLayout->setMargin( 0 );
	// Toolbar
	QToolBar* tb = new QToolBar( tr( "Files" ), this );
	tb->setFixedHeight( tb->height() );
	tb->setIconSize( QSize(16, 16 ) );
	// Action Group
	aGroup = new QActionGroup( this );
	aGroup->setObjectName( "aGroup" );
	// Actions
	actionForm = new QAction( QIcon( ":/Icons/Icons/form.png" ), tr( "Form" ), this );
	actionForm->setCheckable( true );
	aGroup->addAction( actionForm );
	actionHeader = new QAction( QIcon( ":/Icons/Icons/h.png" ), tr( "Header" ), this );
	actionHeader->setCheckable( true );
	aGroup->addAction( actionHeader );
	actionSource = new QAction( QIcon( ":/Icons/Icons/cpp.png" ), tr( "Source" ), this );
	actionSource->setCheckable( true );
	aGroup->addAction( actionSource );
	tb->addActions( aGroup->actions() );
	vboxLayout->addWidget( tb );
	// Workspace
	wSpace = new QWorkspace( this );
	wSpace->setObjectName( "wSpace" );
	vboxLayout->addWidget( wSpace );
	// Form
	// Header
	teHeader = new TextEditor( this );
	teHeader->setObjectName( "teHeader" );
	teHeader->setFrameShape( QFrame::NoFrame );
	teHeader->setFrameShadow( QFrame::Plain );
	teHeader->setMidLineWidth( 1 );
	teHeader->setDefaultComponents( true );
	teHeader->setWindowIcon( actionHeader->icon() );
	setSettings( teHeader );
	connect( teHeader, SIGNAL( replaceDialogRequested() ), this, SIGNAL( replaceDialogRequested() ) );
	connect( teHeader->completion(), SIGNAL( beforeCompletionShow() ), this, SLOT( beforeCompletionShow() ) );
	connect( teHeader->document(), SIGNAL( modificationChanged( bool ) ), this, SIGNAL( modified( bool ) ) );
	connect( teHeader, SIGNAL( fileOpen( bool ) ), this, SLOT( fileOpened( bool ) ) );
	connect( teHeader, SIGNAL( completionRequested( Completion*, TextEditor* ) ), this, SLOT( completionRequested( Completion*, TextEditor* ) ) );
	wSpace->addWindow( teHeader, Qt::WindowTitleHint );
	// Source
	teSource = new TextEditor( this );
	teSource->setObjectName( "teSource" );
	teSource->setFrameShape( QFrame::NoFrame );
	teSource->setFrameShadow( QFrame::Plain );
	teSource->setMidLineWidth( 1 );
	teSource->setDefaultComponents( true );
	teSource->setWindowIcon( actionSource->icon() );
	setSettings( teSource );
	connect( teSource, SIGNAL( replaceDialogRequested() ), this, SIGNAL( replaceDialogRequested() ) );
	connect( teSource, SIGNAL( beforeCompletionShow() ), this, SLOT( beforeCompletionShow() ) );
	connect( teSource->document(), SIGNAL( modificationChanged( bool ) ), this, SIGNAL( modified( bool ) ) );
	connect( teSource, SIGNAL( fileOpen( bool ) ), this, SLOT( fileOpened( bool ) ) );
	connect( teSource, SIGNAL( completionRequested( Completion*, TextEditor* ) ), this, SLOT( completionRequested( Completion*, TextEditor* ) ) );
	wSpace->addWindow( teSource, Qt::WindowTitleHint );
	// Connections
	QMetaObject::connectSlotsByName( this );
}
开发者ID:pasnox,项目名称:monkeystudio1,代码行数:68,代码来源:MDIClass.cpp


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