QToolBar* MainWindow::createFormatToolBar() { QToolBar *pFormatBar = new QToolBar(); pFormatBar->setWindowTitle( "Format Bar" ); m_pCmbFont = new QFontComboBox; m_pCmbFont->setEditable( false ); m_pCmbFont->setFocusPolicy( Qt::NoFocus ); m_pCmbFontPointSize = new QComboBox; updateFontPointSize( m_pCmbFont->currentText() ); m_pCmbFontPointSize->setFocusPolicy( Qt::NoFocus ); QToolButton *pBtnMoreOptions = new QToolButton; pBtnMoreOptions->setText( "More..." ); pBtnMoreOptions->setStyleSheet( "border: 1px solid #000000" ); pBtnMoreOptions->setFixedHeight( 20 ); pBtnMoreOptions->setFocusPolicy( Qt::NoFocus ); pFormatBar->addWidget( m_pCmbFont ); pFormatBar->addWidget( m_pCmbFontPointSize ); pFormatBar->addWidget( pBtnMoreOptions ); connect( m_pCmbFont, SIGNAL(currentIndexChanged(int)), this, SLOT(onFontFamilyChanged()) ); connect( m_pCmbFontPointSize, SIGNAL(currentIndexChanged(int)), this, SLOT(onFontPointSizeChanged()) ); connect( pBtnMoreOptions, SIGNAL(clicked()), this, SLOT(onFormatMoreBtnClicked()) ); return pFormatBar; }
void MainWindow::createToolBars() { QToolBar *fileTool = addToolBar("File"); QToolBar *editTool = addToolBar("Edit"); QToolButton *fileNewBtn = new QToolButton; fileNewBtn->setIcon(QIcon(":/images/new.png")); QToolButton *fileOpenBtn = new QToolButton; fileOpenBtn->setIcon(QIcon(":/images/open.png")); QToolButton *fileSaveBtn = new QToolButton; fileSaveBtn->setIcon(QIcon(":/images/save.png")); fileTool->addWidget(fileNewBtn); fileTool->addWidget(fileOpenBtn); fileTool->addWidget(fileSaveBtn); QToolButton *copyBtn = new QToolButton; copyBtn->setIcon(QIcon(":/images/copy.png")); QToolButton *cutBtn = new QToolButton; cutBtn->setIcon(QIcon(":/images/cut.png")); QToolButton *pasteBtn = new QToolButton; pasteBtn->setIcon(QIcon(":/images/paste.png")); editTool->addWidget(copyBtn); editTool->addWidget(cutBtn); editTool->addWidget(pasteBtn); }
void DevGUI::setupTextActions() { QToolBar *tb = new QToolBar(this); tb->setAllowedAreas(Qt::TopToolBarArea | Qt::BottomToolBarArea); tb->setWindowTitle(tr("Format Actions")); addToolBarBreak(Qt::TopToolBarArea); addToolBar(tb); Font = new QComboBox(tb); tb->addWidget(Font); Font->setEditable(true); QFontDatabase db; Font->addItems(db.families()); connect(Font, SIGNAL(activated(const QString &)), this, SLOT(textFamily(const QString &))); Font->setCurrentIndex(Font->findText(DevApp::font().family())); Size = new QComboBox(tb); Size->setObjectName("Size"); tb->addWidget(Size); Size->setEditable(true); foreach(int size, db.standardSizes()) Size->addItem(QString::number(size)); connect(Size, SIGNAL(activated(const QString &)), this, SLOT(textSize(const QString &))); Size->setCurrentIndex(Size->findText(QString::number(DevApp::font().pointSize()))); }
void BitcoinGUI::createToolBars2() { QLabel *mylabel = new QLabel (this); mylabel->setPixmap(QPixmap(":images/head")); mylabel->show(); QToolBar *toolbar = addToolBar(tr("Tabs toolbar")); toolbar->setObjectName("toolbar"); addToolBar(Qt::LeftToolBarArea,toolbar); toolbar->setOrientation(Qt::Vertical); toolbar->setMovable( false ); toolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); toolbar->setIconSize(QSize(50,25)); toolbar->addWidget(mylabel); toolbar->addAction(overviewAction); toolbar->addAction(sendCoinsAction); toolbar->addAction(receiveCoinsAction); toolbar->addAction(historyAction); toolbar->addAction(addressBookAction); toolbar->addAction(blockAction); toolbar->addAction(statisticsAction); toolbar->addAction(optionsAction); QWidget* spacer = new QWidget(); spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); toolbar->addWidget(spacer); spacer->setObjectName("spacer"); toolbar->setStyleSheet( "#toolbar { font-weight:600;border:none;height:100%;padding-top:20px; background: rgb(37,40,46); text-align: left; color: white;min-width:180px;max-width:180px;}" "QToolBar QToolButton:hover {background:rgb(28,29,33);}" "QToolBar QToolButton:checked {background:rgba(28,29,33,100);}" "QToolBar QToolButton { font-weight:600;font-size:10px;font-family:'Century Gothic';padding-left:20px;padding-right:181px;padding-top:5px;padding-bottom:5px; width:100%; color: white; text-align: left; background:transparent;text-transform:uppercase; }"); wId = new QWidget(this); wId3 = new QWidget(this); QToolBar *toolbars = addToolBar(tr("Settings2")); addToolBar(Qt::RightToolBarArea,toolbars); toolbars->setOrientation(Qt::Horizontal); toolbars->setMovable( false ); toolbars->setStyleSheet("QToolBar QToolButton {border:0px;margin-right:3px} QToolBar{ border:0px; }"); toolbars->setIconSize(QSize(102,25)); QHBoxLayout *vbox5 = new QHBoxLayout(); vbox5->addWidget(toolbars); vbox5->setContentsMargins(0,0,0,0); wId3->setFixedSize(250,30); wId3->move(260,10); wId3->setLayout(vbox5); wId3->setFocus(); wId3->raise(); QMenu *menu = new QMenu(tr("Mini")); menu->setStyleSheet("border:none;background:none;"); menu->addAction(toggleHideAction); menu->menuAction()->setIcon(QIcon(":/icons/mini")); QHBoxLayout *vbox3 = new QHBoxLayout(); vbox3->setContentsMargins(0,0,0,0); wId->setFixedSize(120,40); wId->move(915,1); wId->setLayout(vbox3); wId->setFocus(); }
/*! Create and return the toolbar to use for digital signal generation. */ QToolBar* UiDigitalGenerator::createToolBar() { // Deallocation: // Re-parented when calling verticalLayout->addWidget in the constructor QToolBar* toolBar = new QToolBar("Digital generator settings"); mAddAction = toolBar->addAction("Add"); connect(mAddAction, SIGNAL(triggered()), this, SLOT(addSignal())); mRemoveAction = toolBar->addAction("Remove"); connect(mRemoveAction, SIGNAL(triggered()), this, SLOT(removeSelectedSignals())); mRemoveAction->setEnabled(false); toolBar->addSeparator(); mRate = createRateBox(); // Deallocation: Toolbar takes ownership of label toolBar->addWidget(new QLabel(tr(" Rate "))); toolBar->addWidget(mRate); mStatesBox = createStatesBox(); toolBar->addSeparator(); // Deallocation: Toolbar takes ownership of label toolBar->addWidget(new QLabel(tr(" States "))); toolBar->addWidget(mStatesBox); return toolBar; }
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)); showKeyboard = getAction("show-keys"); showKeyboard->setCheckable(true); tb->addAction(showKeyboard); typefaceBold = tb->addAction(*icons[int(Icons::textBold_ICON)], ""); typefaceBold->setToolTip(tr("Bold")); typefaceBold->setCheckable(true); typefaceItalic = tb->addAction(*icons[int(Icons::textItalic_ICON)], ""); typefaceItalic->setToolTip(tr("Italic")); typefaceItalic->setCheckable(true); typefaceUnderline = tb->addAction(*icons[int(Icons::textUnderline_ICON)], ""); typefaceUnderline->setToolTip(tr("Underline")); typefaceUnderline->setCheckable(true); tb->addSeparator(); typefaceSubscript = tb->addAction(*icons[int(Icons::textSub_ICON)], ""); typefaceSubscript->setToolTip(tr("Subscript")); typefaceSubscript->setCheckable(true); typefaceSuperscript = tb->addAction(*icons[int(Icons::textSuper_ICON)], ""); typefaceSuperscript->setToolTip(tr("Superscript")); typefaceSuperscript->setCheckable(true); tb->addSeparator(); typefaceFamily = new QFontComboBox(this); tb->addWidget(typefaceFamily); typefaceSize = new QDoubleSpinBox(this); typefaceSize->setFocusPolicy(Qt::ClickFocus); tb->addWidget(typefaceSize); setWidget(tb); QWidget* w = new QWidget(this); setTitleBarWidget(w); titleBarWidget()->hide(); connect(typefaceSize, SIGNAL(valueChanged(double)), SLOT(sizeChanged(double))); connect(typefaceFamily, SIGNAL(currentFontChanged(const QFont&)), SLOT(fontChanged(const QFont&))); connect(typefaceBold, SIGNAL(triggered(bool)), SLOT(boldClicked(bool))); connect(typefaceItalic, SIGNAL(triggered(bool)), SLOT(italicClicked(bool))); connect(typefaceUnderline, SIGNAL(triggered(bool)), SLOT(underlineClicked(bool))); connect(typefaceSubscript, SIGNAL(triggered(bool)), SLOT(subscriptClicked(bool))); connect(typefaceSuperscript, SIGNAL(triggered(bool)), SLOT(superscriptClicked(bool))); connect(showKeyboard, SIGNAL(triggered(bool)), SLOT(showKeyboardClicked(bool))); }
int main(int argc, char **argv) { QApplication app(argc, argv); QMainWindow mainWindow; mainWindow.setCentralWidget(new StaticWidget()); mainWindow.setStatusBar(new QStatusBar()); QDockWidget *dockWidget = new QDockWidget(); dockWidget->setWidget(new StaticWidget()); mainWindow.addDockWidget(Qt::LeftDockWidgetArea, dockWidget); QToolBar *toolBar = new QToolBar(); toolBar->addWidget(new StaticWidget())->setVisible(true);; toolBar->addWidget(new QSpinBox())->setVisible(true);; mainWindow.addToolBar(toolBar); mainWindow.resize(600, 400); mainWindow.show(); return app.exec(); }
void MainWindow::createToolBar(){ QToolBar* toolBar = new QToolBar(); toolBar->setMovable(false); newFileButton = new QPushButton(); newFileButton->setIcon(QIcon(":new-file.png")); newFileButton->setIconSize(QSize(20,20)); newFileButton->setToolTip(tr("Create a new file")); newFileButton->setMaximumWidth(28); newFileButton->setCursor(Qt::PointingHandCursor); connect(newFileButton,SIGNAL(released()),this,SLOT(createNewFile())); toolBar->addWidget(newFileButton); openFileButton = new QPushButton(); openFileButton->setIcon(QIcon(":open-file.png")); openFileButton->setIconSize(QSize(20,20)); openFileButton->setToolTip(tr("Open a file")); openFileButton->setMaximumWidth(28); openFileButton->setCursor(Qt::PointingHandCursor); connect(openFileButton,SIGNAL(released()),this,SLOT(openFile())); toolBar->addWidget(openFileButton); saveFileButton = new QPushButton(); saveFileButton->setIcon(QIcon(":save-file.png")); saveFileButton->setIconSize(QSize(20,20)); saveFileButton->setToolTip(tr("Save the current file")); saveFileButton->setMaximumWidth(28); saveFileButton->setCursor(Qt::PointingHandCursor); saveFileButton->setShortcut(QKeySequence("Ctrl+S")); connect(saveFileButton,SIGNAL(released()),this,SLOT(saveFile())); toolBar->addWidget(saveFileButton); addToolBar(toolBar); }
MainWidget::MainWidget(QWidget*) : board(NULL) { layout = new QVBoxLayout(this); //cubeSettingsLayout = new QHBoxLayout; QPushButton* newgame = new QPushButton(tr("&New game")); QLabel* cubeLabel = new QLabel(tr("Board size: ")); QComboBox* opponent = new QComboBox; status = new QLabel; cubeSize = new QSpinBox; cubeSize->setRange(6, 50); cubeSize->setValue(15); connect(newgame, SIGNAL(clicked()), this, SLOT(newGame())); QToolBar* toolbar = new QToolBar(tr("Settings")); toolbar->addWidget(cubeLabel); toolbar->addWidget(cubeSize); toolbar->addSeparator(); toolbar->addWidget(opponent); //cubeSettingsLayout->addWidget(cubeLabel); //cubeSettingsLayout->addWidget(cubeSize); layout->addWidget(newgame, 1); layout->addWidget(toolbar); layout->addWidget(status); newGame(); setLayout(layout); //setFixedSize(sizeHint()); }
void BitcoinGUI::createToolBars() { QToolBar *toolbar = addToolBar(tr("Tabs toolbar")); toolbar->setObjectName("toolbar"); addToolBar(Qt::LeftToolBarArea,toolbar); toolbar->setOrientation(Qt::Vertical); toolbar->setFixedWidth(205); toolbar->setMovable( false ); toolbar->setToolButtonStyle(Qt::ToolButtonTextOnly); QLabel* header = new QLabel(); header->setMinimumSize(156,156); header->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); header->setPixmap(QPixmap(":/images/header")); header->setMaximumSize(156,156); header->setContentsMargins(26,26,0,0); header->setScaledContents(true); toolbar->addWidget(header); QLabel *l = new QLabel(this); l->setPixmap(QPixmap(":/images/spacer")); toolbar->addWidget(l); toolbar->addAction(overviewAction); toolbar->addAction(sendCoinsAction); toolbar->addAction(receiveCoinsAction); toolbar->addAction(historyAction); toolbar->addAction(addressBookAction); toolbar->setStyleSheet("#toolbar {background: transparent; text-align: center; color: black;padding-right: 30px;} QToolBar QToolButton:hover {background-color: transparent;} QToolBar QToolButton:selected {background-color: transparent;} QToolBar QToolButton:checked {background-color: transparent;} QToolBar QToolButton:pressed {background-color: transparent;} QToolBar QToolButton {font-family:Steps; font-size:15px; font-weight: bold; min-width:125px;max-width:125px; min-height:25px;max-height:25px; color: white; text-align: left; }"); }
CurveletGUI::CurveletGUI(QWidget *parent) : QMainWindow(parent) { this->resize(800,600); this->FileListView = new QListWidget; this->FileListView->isSortingEnabled(); this->setCentralWidget(this->FileListView); this->InputFileList.clear(); QToolBar * mainToolBar = new QToolBar(this); this->exitAction = new QAction(tr("Exit"), this); connect(this->exitAction, SIGNAL(triggered()), this, SLOT(close())); this->exitAction->setShortcut(QKeySequence::Close); this->menuBar()->addAction(this->exitAction); this->loadImages = new QAction("Load Images", this); connect(this->loadImages, SIGNAL(triggered()), this, SLOT(BrowseFiles())); this->menuBar()->addAction(this->loadImages); this->ProcessImages = new QAction("Run Curvelets on Images", this); connect(this->ProcessImages, SIGNAL(triggered()), this, SLOT(ProcessFiles())); this->ProcessImages->setEnabled(false); this->menuBar()->addAction(this->ProcessImages); this->SigmaValue = new QDoubleSpinBox(this); this->SigmaValue->setRange(0,1); this->SigmaValue->setValue(.03); this->SigmaValue->setSingleStep(.01); mainToolBar->addWidget(new QLabel("Sigma Value: ")); mainToolBar->addWidget(this->SigmaValue); this->addToolBar(mainToolBar); }
MainWindow::MainWindow( QWidget *parent ): QMainWindow( parent ) { d_plot = new Plot( this ); setCentralWidget( d_plot ); QToolBar *toolBar = new QToolBar( this ); QComboBox *typeBox = new QComboBox( toolBar ); typeBox->addItem( "Bars" ); typeBox->addItem( "CandleSticks" ); typeBox->setCurrentIndex( 1 ); typeBox->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); QToolButton *btnExport = new QToolButton( toolBar ); btnExport->setText( "Export" ); btnExport->setToolButtonStyle( Qt::ToolButtonTextUnderIcon ); connect( btnExport, SIGNAL( clicked() ), d_plot, SLOT( exportPlot() ) ); toolBar->addWidget( typeBox ); toolBar->addWidget( btnExport ); addToolBar( toolBar ); d_plot->setMode( typeBox->currentIndex() ); connect( typeBox, SIGNAL( currentIndexChanged( int ) ), d_plot, SLOT( setMode( int ) ) ); }
SidebarWidget::SidebarWidget(QWidget *parent) : QWidget(parent), m_resizeTimer(0), m_ui(new Ui::SidebarWidget) { m_ui->setupUi(this); QToolBar *toolbar = new QToolBar(this); toolbar->setIconSize(QSize(16, 16)); toolbar->addWidget(new PanelChooserWidget(ActionsManager::ActionEntryDefinition(), this)); toolbar->addAction(ActionsManager::getAction(ActionsManager::OpenPanelAction, this)); QWidget *spacer = new QWidget(toolbar); spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); toolbar->addWidget(spacer); toolbar->addAction(ActionsManager::getAction(ActionsManager::ClosePanelAction, this)); m_ui->panelLayout->addWidget(toolbar); m_ui->panelsButton->setPopupMode(QToolButton::InstantPopup); m_ui->panelsButton->setIcon(ThemesManager::getIcon(QLatin1String("list-add"))); optionChanged(QLatin1String("Sidebar/CurrentPanel"), SettingsManager::getValue(QLatin1String("Sidebar/CurrentPanel"))); optionChanged(QLatin1String("Sidebar/Panels"), SettingsManager::getValue(QLatin1String("Sidebar/Panels"))); optionChanged(QLatin1String("Sidebar/Reverse"), SettingsManager::getValue(QLatin1String("Sidebar/Reverse"))); connect(SettingsManager::getInstance(), SIGNAL(valueChanged(QString,QVariant)), this, SLOT(optionChanged(QString,QVariant))); }
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; }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { setWindowTitle(QStringLiteral("Enginio TODO example")); QByteArray EnginioBackendId = backendId("todo"); //![client] m_client = new EnginioClient(this); m_client->setBackendId(EnginioBackendId); //![client] QObject::connect(m_client, &EnginioClient::error, this, &MainWindow::error); //![model] m_model = new TodosModel(this); m_model->setClient(m_client); QJsonObject query; query["objectType"] = QString::fromUtf8("objects.todos"); m_model->setQuery(query); //![model] QToolBar *toolBar = new QToolBar(this); m_addNewButton = new QPushButton(toolBar); m_addNewButton->setText("&Add"); QObject::connect(m_addNewButton, &QPushButton::clicked, this, &MainWindow::appendItem); m_removeButton = new QPushButton(toolBar); m_removeButton->setText("&Remove"); m_removeButton->setEnabled(false); QObject::connect(m_removeButton, &QPushButton::clicked, this, &MainWindow::removeItem); m_toggleButton = new QPushButton(toolBar); m_toggleButton->setText("&Toggle Completed"); m_toggleButton->setEnabled(false); QObject::connect(m_toggleButton, &QPushButton::clicked, this, &MainWindow::toggleCompleted); toolBar->addWidget(m_addNewButton); toolBar->addWidget(m_removeButton); toolBar->addWidget(m_toggleButton); m_view = new QTreeView(this); m_view->setAlternatingRowColors(true); QFrame *frame = new QFrame(this); QVBoxLayout *windowLayout = new QVBoxLayout(frame); windowLayout->addWidget(m_view); windowLayout->addWidget(toolBar); setCentralWidget(frame); //![assignModel] m_view->setModel(m_model); //![assignModel] m_view->setSelectionModel(new QItemSelectionModel(m_model, m_model)); QObject::connect(m_view->selectionModel(), &QItemSelectionModel::selectionChanged, this, &MainWindow::selectionChanged); }
void MainWindow::createToolbars() { ////////////////// QToolBar *fileToolBar; fileToolBar = addToolBar(tr("fileToolbar")); fileToolBar->addAction(newAction); fileToolBar->addAction(openFileAction); // fileToolBar->addAction(saveAction); fileToolBar->addAction(saveProjectAction); //Button for contexts related contextItemsButtonGroup = new QButtonGroup(this); QToolButton *selectItemToolButton = new QToolButton(this); selectItemToolButton ->setCheckable(true); selectItemToolButton ->setChecked(true); selectItemToolButton ->setIcon(QIcon(":/images/pointer.png")); QToolButton *insertLineToolButton = new QToolButton(this); insertLineToolButton->setCheckable(true); insertLineToolButton->setIcon(QIcon(":/images/linepointer.png")); QToolButton *insertPolygonToolButton = new QToolButton(this); insertPolygonToolButton->setCheckable(true); insertPolygonToolButton->setIcon(QIcon(":/images/polygon.png")); contextItemsButtonGroup->addButton(selectItemToolButton,int(RbeVisualizeWidget_GraphicsScene::ITEM_SELECTION_MODE)); contextItemsButtonGroup->addButton(insertLineToolButton,int(RbeVisualizeWidget_GraphicsScene::INSERT_LINE_MODE)); contextItemsButtonGroup->addButton(insertPolygonToolButton,int(RbeVisualizeWidget_GraphicsScene::INSERT_POLYGON_MODE)); QToolBar *contextItemsButtonGroupToolBar; contextItemsButtonGroupToolBar = addToolBar(tr("contextItemsButtonGroup")); contextItemsButtonGroupToolBar->addWidget(selectItemToolButton); contextItemsButtonGroupToolBar->addWidget(insertLineToolButton); contextItemsButtonGroupToolBar->addWidget(insertPolygonToolButton); connect(contextItemsButtonGroup, SIGNAL(buttonClicked(int)), this, SLOT(contextItemsButtonGroupClicked())); ////////////////////RULE TOOLBAR QToolBar *ruleToolBar; ruleToolBar = addToolBar(tr("ruleToolbar")); ruleToolBar->addAction(newRuleAction); //////////////////// QToolBar *runToolBar; runToolBar = addToolBar(tr("runToolbar")); //runToolBar->addAction(runAnimateAction); runToolBar->addAction(openVideoAction); runToolBar->addAction(runVirtualFencingAction); ////////////////////// QToolBar *exitToolBar; exitToolBar = addToolBar((tr("exitToolBar"))); exitToolBar->addAction(exitAction); }
PlotTab( bool parametric, QWidget *parent ): QMainWindow( parent ) { Plot *plot = new Plot( parametric, this ); setCentralWidget( plot ); QToolBar *toolBar = new QToolBar( this ); #ifndef QT_NO_PRINTER ToolButton *btnPrint = new ToolButton( "Print", toolBar ); toolBar->addWidget( btnPrint ); QObject::connect( btnPrint, SIGNAL( clicked() ), plot, SLOT( printPlot() ) ); #endif ToolButton *btnOverlay = new ToolButton( "Overlay", toolBar ); btnOverlay->setCheckable( true ); toolBar->addWidget( btnOverlay ); QObject::connect( btnOverlay, SIGNAL( toggled( bool ) ), plot, SLOT( setOverlaying( bool ) ) ); if ( parametric ) { QComboBox *parameterBox = new QComboBox( toolBar ); parameterBox->addItem( "Uniform" ); parameterBox->addItem( "Centripetral" ); parameterBox->addItem( "Chordal" ); parameterBox->addItem( "Manhattan" ); toolBar->addWidget( parameterBox ); connect( parameterBox, SIGNAL( activated( const QString & ) ), plot, SLOT( setParametric( const QString & ) ) ); parameterBox->setCurrentIndex( 2 ); // chordal plot->setParametric( parameterBox->currentText() ); ToolButton *btnClosed = new ToolButton( "Closed", toolBar ); btnClosed->setCheckable( true ); toolBar->addWidget( btnClosed ); QObject::connect( btnClosed, SIGNAL( toggled( bool ) ), plot, SLOT( setClosed( bool ) ) ); } QComboBox *boundaryBox = new QComboBox( toolBar ); boundaryBox->addItem( "Natural" ); boundaryBox->addItem( "Linear Runout" ); boundaryBox->addItem( "Parabolic Runout" ); boundaryBox->addItem( "Cubic Runout" ); boundaryBox->addItem( "Not a Knot" ); toolBar->addWidget( boundaryBox ); connect( boundaryBox, SIGNAL( activated( const QString & ) ), plot, SLOT( setBoundaryCondition( const QString & ) ) ); addToolBar( toolBar ); }
QToolBar* QDatabaseConnectionView::makeOptionButtonsToolBar(QWidget* pParent) { QToolBar *pToolbar = new QToolBar(pParent); m_pRefreshTableListButton = new QPushButton(QIcon::fromTheme("view-refresh"), tr("Refresh"), pToolbar); //TODO needs image rather than text pToolbar->addWidget(m_pRefreshTableListButton); m_pNewWorksheetButton = new QPushButton(QIcon::fromTheme("document-new"), tr("New worksheet"), pToolbar);//TODO needs image rather than text pToolbar->addWidget(m_pNewWorksheetButton); return pToolbar; }
MpMapWidget::MpMapWidget(MainObject *mOb, QWidget *parent) : QWidget(parent) { mainObject = mOb; setProperty("settings_namespace", QVariant("mp_map_window")); mainObject->settings->restoreWindow(this); setWindowTitle(tr("Multi Player Map")); setWindowIcon(QIcon(":/icons/mpmap")); QVBoxLayout *mainLayout = new QVBoxLayout(this); mainLayout->setContentsMargins(0,0,0,0); mainLayout->setSpacing(0); //** Toolbar QToolBar *toolbar = new QToolBar(); mainLayout->addWidget(toolbar, 1); //** Select server QLabel *lblSelectServer = new QLabel("Select Server:"); toolbar->addWidget(lblSelectServer); comboServer = new QComboBox(); toolbar->addWidget(comboServer); comboServer->addItem("MpMap-01", QVariant("http://mpmap01.flightgear.org")); comboServer->addItem("MpMap-02", QVariant("http://mpmap02.flightgear.org")); connect(comboServer, SIGNAL(currentIndexChanged(int)), this, SLOT(on_combo_server(int))); //** Browser browser = new QWebView(this); mainLayout->addWidget(browser, 100); connect(browser, SIGNAL(loadStarted()), this, SLOT(start_progress())); connect(browser, SIGNAL(loadProgress(int)), this, SLOT(update_progress(int))); connect(browser, SIGNAL(loadFinished(bool)), this, SLOT(end_progress(bool))); //*** Status Bar statusBar = new QStatusBar(this); mainLayout->addWidget(statusBar); statusBar->showMessage("Idle"); //** Progress Bar progressBar = new QProgressBar(); progressBar->setVisible(false); statusBar->addPermanentWidget(progressBar); //*** Initialise on_combo_server(0); }
//Initialize the toolbar at the top of the window void GUI::initToolbar(){ QPixmap openPicture("Images/open.png"); QPixmap savePicture("Images/save.png"); QPixmap playPicture("Images/play.png"); QPixmap pausePicture("Images/pause.png"); QPixmap stopPicture("Images/stop.png"); QPixmap zoomInPicture("Images/zoom-in.png"); QPixmap zoomOutPicture("Images/zoom-out.png"); QToolBar * toolbar = addToolBar("Toolbar"); QAction * openAction = toolbar->addAction(QIcon(openPicture), "Open"); QAction * saveAction = toolbar->addAction(QIcon(savePicture), "Save"); toolbar->addSeparator(); QAction * playAction = toolbar->addAction(QIcon(playPicture), "Play"); QAction * pauseAction = toolbar->addAction(QIcon(pausePicture), "Pause"); QAction * stopAction = toolbar->addAction(QIcon(stopPicture), "Stop"); toolbar->addSeparator(); QAction * zoomInAction = toolbar->addAction(QIcon(zoomInPicture), "Zoom-In"); QAction * zoomOutAction = toolbar->addAction(QIcon(zoomOutPicture), "Zoom-Out"); connect(openAction, SIGNAL(triggered()), this, SLOT(openFile())); connect(saveAction, SIGNAL(triggered()), this, SLOT(saveFile())); connect(playAction, SIGNAL(triggered()), this, SLOT(start())); connect(pauseAction, SIGNAL(triggered()), this, SLOT(pause())); connect(stopAction, SIGNAL(triggered()), this, SLOT(stop())); connect(zoomInAction, SIGNAL(triggered()), this, SLOT(zoomIn())); connect(zoomOutAction, SIGNAL(triggered()), this, SLOT(zoomOut())); toolbar->addSeparator(); QPixmap volumePicture("Images/volume.png"); QAction * volumeIcon = toolbar->addAction(QIcon(volumePicture), "Volume"); volumeIcon->setEnabled(false); sliderVolume = new QSlider(Qt::Horizontal, this); sliderVolume->setTickPosition(QSlider::TicksBelow); sliderVolume->setTickInterval(10); sliderVolume->setValue(100); toolbar->addWidget(sliderVolume); toolbar->addSeparator(); QPixmap speedPicture("Images/speed.png"); QAction * speedIcon = toolbar->addAction(QIcon(speedPicture), "Speed"); speedIcon->setEnabled(false); sliderSpeed = new QSlider(Qt::Horizontal, this); sliderSpeed->setTickPosition(QSlider::TicksBelow); sliderSpeed->setTickInterval(10); sliderSpeed->setValue(50); toolbar->addWidget(sliderSpeed); connect(sliderVolume, SIGNAL(valueChanged(int)), this, SLOT(volumeChanged())); connect(sliderSpeed, SIGNAL(valueChanged(int)), this, SLOT(speedChanged())); }
EditTools::EditTools(QWidget* parent) : QDockWidget(parent) { setObjectName("edit-tools"); setWindowTitle(tr("Edit Mode Tools")); setAllowedAreas(Qt::DockWidgetAreas(Qt::TopDockWidgetArea | Qt::BottomDockWidgetArea)); QToolBar* tb = new QToolBar(tr("Edit Mode Tools")); tb->setIconSize(QSize(preferences.iconWidth, preferences.iconHeight)); QToolButton* b = new QToolButton(this); QAction* a = getAction("hraster"); a->setCheckable(true); b->setDefaultAction(a); b->setContextMenuPolicy(Qt::ActionsContextMenu); b->addAction(getAction("config-raster")); tb->addWidget(b); b = new QToolButton(this); a = getAction("vraster"); a->setCheckable(true); b->setDefaultAction(a); b->setContextMenuPolicy(Qt::ActionsContextMenu); b->addAction(getAction("config-raster")); tb->addWidget(b); _editX = new QDoubleSpinBox(this); _editX->setSuffix(tr("sp")); _editX->setRange(-99999, 99999); _editX->setSingleStep(.1); _editY = new QDoubleSpinBox(this); _editY->setSuffix(tr("sp")); _editY->setRange(-99999, 99999); _editY->setSingleStep(.1); xLabel = new QLabel(tr("x:"), this); yLabel = new QLabel(tr("y:"), this); _localEdit = false; tb->addWidget(xLabel); tb->addWidget(_editX); tb->addWidget(yLabel); tb->addWidget(_editY); connect(_editX, SIGNAL(valueChanged(double)), SLOT(editXChanged(double))); connect(_editY, SIGNAL(valueChanged(double)), SLOT(editYChanged(double))); setWidget(tb); QWidget* w = new QWidget(this); setTitleBarWidget(w); titleBarWidget()->hide(); }
void MainWindow::createToolBars() { mWorkflowToolBar = this->registerToolBar("Workflow"); QList<QAction*> actions = stateService()->getWorkflowActions()->actions(); for (int i=0; i<actions.size(); ++i) mWorkflowToolBar->addAction(actions[i]); mDataToolBar = this->registerToolBar("Data"); mDataToolBar->addAction(mActions->getAction("NewPatient")); mDataToolBar->addAction(mActions->getAction("LoadFile")); mDataToolBar->addAction(mActions->getAction("SaveFile")); mDataToolBar->addAction(mActions->getAction("ImportData")); mToolToolBar = this->registerToolBar("Tools"); mToolToolBar->addAction(mActions->getAction("TrackingTools")); mToolToolBar->addAction(mActions->getAction("StartStreaming")); mNavigationToolBar = this->registerToolBar("Navigation"); mNavigationToolBar->addAction(mActions->getAction("CenterToImageCenter")); mNavigationToolBar->addAction(mActions->getAction("CenterToTooltip")); mNavigationToolBar->addAction(mActions->getAction("ShowPointPicker")); mInteractorStyleToolBar = this->registerToolBar("InteractorStyle"); mInteractorStyleToolBar->addActions(mInteractorStyleActionGroup->actions()); mDesktopToolBar = this->registerToolBar("Desktop"); mDesktopToolBar->addAction(mSaveDesktopAction); mDesktopToolBar->addAction(mResetDesktopAction); mScreenshotToolBar = this->registerToolBar("Screenshot"); mScreenshotToolBar->addAction(mActions->getAction("ShootScreen")); mScreenshotToolBar->addAction(mActions->getAction("RecordFullscreen")); QToolBar* camera3DViewToolBar = this->registerToolBar("Camera 3D Views"); camera3DViewToolBar->addActions(mStandard3DViewActions->actions()); QToolBar* samplerWidgetToolBar = this->registerToolBar("Sampler"); samplerWidgetToolBar->addWidget(new SamplerWidget(this)); QToolBar* toolOffsetToolBar = this->registerToolBar("Tool Offset"); DoublePropertyBasePtr offset = DoublePropertyActiveToolOffset::create(ActiveToolProxy::New(mServices->tracking())); SpinBoxAndSliderGroupWidget* offsetWidget = new SpinBoxAndSliderGroupWidget(this, offset); offsetWidget->showLabel(false); toolOffsetToolBar->addWidget(offsetWidget); QToolBar* helpToolBar = this->registerToolBar("Help"); helpToolBar->addAction(mShowContextSensitiveHelpAction); }
FilesystemWidget::FilesystemWidget(QWidget *parent) { setParent(parent); // Create the toolbar QToolBar *fsToolbar = new QToolBar(); fsToolbar->setMovable(false); goUpAction = new QAction(IconFactory::fromTheme("go-up"), tr("Go up"), this); connect(goUpAction, SIGNAL(triggered()), this, SLOT(goUp())); fsToolbar->addAction(goUpAction); goHomeAction = new QAction(IconFactory::fromTheme("go-home"), tr("Go to the home folder"), this); connect(goHomeAction, SIGNAL(triggered()), this, SLOT(goHome())); fsToolbar->addAction(goHomeAction); // TODO: use placeholderText in Qt 4.7. filterEdit = new QLineEdit(); QLabel* filterLabel = new QLabel(tr("Filter:")); filterLabel->setContentsMargins(5, 0, 5, 0); fsToolbar->addSeparator(); fsToolbar->addWidget(filterLabel); fsToolbar->addWidget(filterEdit); connect(filterEdit, SIGNAL(textChanged(QString)), this, SLOT(setNameFilter(QString))); // Create the filesystem view fsWidgetModel = new QFileSystemModel(); fsWidgetModel->setNameFilterDisables(false); fsWidgetModel->setFilter(QDir::AllDirs|QDir::Files|QDir::NoDotAndDotDot); fsListView = new QListView(); fsListView->setSelectionMode(QAbstractItemView::ExtendedSelection); fsListView->setDragEnabled(true); fsListView->setModel(fsWidgetModel); // We shall use this to filter available file extensions from Phonon //fsWidgetModel->setFilter(getPhononExtensions()); connect(fsWidgetModel, SIGNAL(rootPathChanged(QString)), this, SLOT(pathChanged())); connect(fsListView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(doubleClickAt(QModelIndex))); // Create a new horizontal box QVBoxLayout *vlayout = new QVBoxLayout(); vlayout->addWidget(fsToolbar); vlayout->addWidget(fsListView); goHome(); this->setLayout(vlayout); }
void VSCMainWindows::SetupToolBar() { QToolBar *pToolBar = new QToolBar(); pToolBar->addWidget(m_pToolBar); addToolBar(Qt::TopToolBarArea, pToolBar); }
void tst_QToolBar::addWidget() { QToolBar tb; QWidget w(&tb); QAction action1(0); QAction action2(0); tb.addAction(&action1); QAction *widget = tb.addWidget(&w); tb.addAction(&action2); QCOMPARE(tb.actions().count(), 3); QCOMPARE(tb.actions()[0], &action1); QCOMPARE(tb.actions()[1], widget); QCOMPARE(tb.actions()[2], &action2); // it should be possible to reuse the action returned by // addWidget() to place the widget somewhere else in the toolbar tb.removeAction(widget); QCOMPARE(tb.actions().count(), 2); QCOMPARE(tb.actions()[0], &action1); QCOMPARE(tb.actions()[1], &action2); tb.addAction(widget); QCOMPARE(tb.actions().count(), 3); QCOMPARE(tb.actions()[0], &action1); QCOMPARE(tb.actions()[1], &action2); QCOMPARE(tb.actions()[2], widget); tb.clear(); QCOMPARE(tb.actions().count(), 0); }
RoomsDialog::RoomsDialog(const QList<Room*> &rooms, QWidget *parent) : QDialog(parent), ui(new Ui::RoomsDialog), mRoom(0), mRoomItem(0), mTileRow(-1) { ui->setupUi(this); ui->tilesList->clear(); ui->tilesList->addItems(Room::enumLabels()); QToolBar *toolBar = new QToolBar(this); toolBar->setIconSize(QSize(16, 16)); toolBar->addAction(ui->actionAdd); toolBar->addAction(ui->actionDuplicate); toolBar->addAction(ui->actionRemove); #if 1 toolBar->addSeparator(); #else QWidget *spacerWidget = new QWidget(this); spacerWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum); toolBar->addWidget(spacerWidget); #endif toolBar->addAction(ui->actionMoveUp); toolBar->addAction(ui->actionMoveDown); ui->toolBarLayout->addWidget(toolBar); foreach (Room *room, rooms) { Room *copy = new Room(); *copy = *room; mRooms += copy; mRoomsMap[copy] = room; }
WidgetBox::WidgetBox(QDesignerFormEditorInterface *core, QWidget *parent, Qt::WindowFlags flags) : QDesignerWidgetBox(parent, flags), m_core(core), m_view(new WidgetBoxTreeWidget(m_core)) { QVBoxLayout *l = new QVBoxLayout(this); l->setMargin(0); l->setSpacing(0); // Prevent the filter from grabbing focus since Our view has Qt::NoFocus QToolBar *toolBar = new QToolBar(this); QLineEdit *filterWidget = new WidgetBoxFilterLineEdit(toolBar); filterWidget->setPlaceholderText(tr("Filter")); filterWidget->setClearButtonEnabled(true); connect(filterWidget, SIGNAL(textChanged(QString)), m_view, SLOT(filter(QString))); toolBar->addWidget(filterWidget); l->addWidget(toolBar); // View connect(m_view, SIGNAL(pressed(QString,QString,QPoint)), this, SLOT(handleMousePress(QString,QString,QPoint))); l->addWidget(m_view); setAcceptDrops (true); }
int main(int argc, char **argv) { BrowserApplication application(argc, argv); QCoreApplication::setApplicationName(QLatin1String("urllineeditexample")); QMainWindow w; QWidget *window = new QWidget; QComboBox *comboBox = new QComboBox(window); comboBox->setEditable(true); QLineEdit *lineEdit = new QLineEdit(window); LocationBar *s1 = new LocationBar(window); LocationBar *s2 = new LocationBar(window); WebView *view = new WebView(window); view->setUrl(QUrl("http://www.google.com")); s2->setWebView(view); QVBoxLayout *layout = new QVBoxLayout; layout->addWidget(comboBox); layout->addWidget(lineEdit); layout->addWidget(s1); layout->addWidget(s2); layout->addWidget(view); window->setLayout(layout); w.show(); w.setCentralWidget(window); QToolBar *bar = w.addToolBar("foo"); QSplitter *splitter = new QSplitter(window); splitter->addWidget(new LocationBar); splitter->addWidget(new QLineEdit); bar->addWidget(splitter); return application.exec(); }
void BitcoinGUI::createToolBars() { QToolBar *toolbar = addToolBar(tr("Tabs toolbar")); toolbar->setObjectName("toolbar"); toolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); addToolBar(Qt::LeftToolBarArea,toolbar); toolbar->setOrientation(Qt::Vertical); toolbar->setMovable(false); QWidget* header = new QWidget(); header->setMinimumSize(140, 45); header->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); header->setStyleSheet("QWidget { background-color: rgb(0,0,0); background-repeat: no-repeat; background-image: url(:/images/header); background-position: top center; }"); toolbar->addWidget(header); toolbar->addAction(overviewAction); toolbar->addAction(sendCoinsAction); toolbar->addAction(receiveCoinsAction); toolbar->addAction(historyAction); toolbar->addAction(addressBookAction); toolbar->addAction(bittrexPageAction); toolbar->addAction(shockBotAction); toolbar->addAction(blockAction); toolbar->addAction(socialPageAction); toolbar->addAction(chatAction); toolbar->addAction(exportAction); }
void BitcoinGUI::createToolBars() { QToolBar *toolbar = addToolBar(tr("Tabs toolbar")); toolbar->setObjectName("toolbar"); addToolBar(Qt::LeftToolBarArea,toolbar); toolbar->setOrientation(Qt::Vertical); toolbar->setMovable( false ); toolbar->setToolButtonStyle(Qt::ToolButtonTextOnly); QLabel *l = new QLabel(this); l->setPixmap(QPixmap(":/images/spacer")); toolbar->addWidget(l); toolbar->addAction(overviewAction); toolbar->addAction(statisticsAction); toolbar->addAction(blockAction); toolbar->addAction(chatAction); #ifdef ENABLE_TRADE_REQUIRE_QT5 toolbar->addAction(TradingAction); #endif // toolbar->addAction(radioAction); toolbar->addAction(sendCoinsAction); toolbar->addAction(receiveCoinsAction); toolbar->addAction(historyAction); toolbar->addAction(addressBookAction); toolbar->setStyleSheet("#toolbar { border:1px;height:100%;padding-top:100px; background: transparent; text-align: center; color: #4DD0F0;min-width:200px;max-width:200px;} QToolBar QToolButton:hover {background-image: url(:images/1); background-color: transparent;} QToolBar QToolButton:selected {background-color: transparent;} QToolBar QToolButton:checked {background-image: url(:images/2); background-color: transparent;} QToolBar QToolButton:pressed {background-color: transparent;} QToolBar QToolButton { margin: 2px; background-image:url(:images/3); font-family:'Bebas'; font-size:14px; min-width:160px;max-width:160px; min-height:40px;max-height:40px; color: white; text-align: center; }"); }