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(); }
//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RiuPlotMainWindow::createToolBars() { caf::CmdFeatureManager* cmdFeatureMgr = caf::CmdFeatureManager::instance(); CVF_ASSERT(cmdFeatureMgr); QStringList toolbarNames; toolbarNames << "Standard" << "Window Management" << "View Snapshots" << "View"; for (QString toolbarName : toolbarNames) { QToolBar* toolbar = addToolBar(toolbarName); toolbar->setObjectName(toolbar->windowTitle()); QStringList toolbarCommands = toolbarCommandIds(toolbarName); for (QString s : toolbarCommands) { toolbar->addAction(cmdFeatureMgr->action(s)); } } m_wellLogPlotToolBarEditor = new caf::PdmUiToolBarEditor("Well Log Plot", this); m_wellLogPlotToolBarEditor->hide(); m_summaryPlotToolBarEditor = new caf::PdmUiToolBarEditor("Summary Plot", this); m_summaryPlotToolBarEditor->hide(); }
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; }"); }
void spincoinGUI::createToolBars() { 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->addAction(overviewAction); toolbar->addAction(sendCoinsAction); toolbar->addAction(receiveCoinsAction); toolbar->addAction(historyAction); toolbar->addAction(addressBookAction); toolbar->addAction(statisticsAction); toolbar->addAction(blockAction); toolbar->addAction(unlockWalletAction); toolbar->addAction(lockWalletAction); // toolbar->addAction(exportAction); QWidget* spacer = new QWidget(); spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); toolbar->addWidget(spacer); spacer->setObjectName("spacer"); }
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); }
/* * Steps to reproduce issue: * - start application * - click "add horizontal" * - click "add horizontal" * - click "add vertical" * - click "add horizontal" * ... the layout will look like this: * 11 22 44 * 33333 44 * - click "save state" * - close application * * - start application * - click "add vertical" 5 times * ... the layout will look like this: * 11 * 22 * 33 * 44 * 55 * - click "restore state" * ... the layout will look like this: * 11 22 44 55 * 33333 44 55 * * BUT since 5 was not known before I would expect its orientation * (vertical) to not change by the restoreState invocation * ... the layout should look like this: * 11 22 44 * 33333 44 * 55555555 */ int main(int argc, char** argv) { QApplication* app = new QApplication(argc, argv); QSettings* settings = new QSettings(QSettings::IniFormat, QSettings::UserScope, "qt_restore_state_orientation", "qt_restore_state_orientation"); QMainWindow* mw = new QMainWindow(); mw->resize(800, 600); mw->setCentralWidget(new QLabel("foo")); QToolBar* tb = new QToolBar(); tb->setObjectName("toolbar"); mw->addToolBar(tb); QAction* aha = new AddHorizontalAction("add horizontal", tb); tb->addAction(aha); QAction* ava = new AddVerticalAction("add vertical", tb); tb->addAction(ava); QAction* ss = new SaveStateAction("save state", tb, settings); tb->addAction(ss); QAction* rs = new RestoreStateAction("restore state", tb, settings); tb->addAction(rs); mw->show(); app->exec(); }
void BitcoinGUI::createToolBars() { QToolBar *toolbar = addToolBar(tr("Screens 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->addAction(overviewAction); toolbar->addAction(sendCoinsAction); toolbar->addAction(receiveCoinsAction); toolbar->addAction(historyAction); toolbar->addAction(addressBookAction); toolbar->addAction(exportAction); toolbar->addAction(optionsAction); QWidget* spacer = new QWidget(); spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); toolbar->addWidget(spacer); spacer->setObjectName("spacer"); QToolBar *toolbar2 = addToolBar(tr("Actions toolbar")); toolbar2->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); toolbar2->addAction(openRPCConsoleAction); toolbar2->setVisible(false); }
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); }
void MainWindow::createToolbars() { QToolBar* fileToolBar = addToolBar("File"); fileToolBar->setObjectName("FileToolBar"); fileToolBar->addAction(mNewFileAction); fileToolBar->addAction(mSaveFileAction); fileToolBar->addAction(mLoadFileAction); QToolBar* allToolBar = addToolBar("All"); allToolBar->setObjectName("AllToolBar"); allToolBar->addAction(mNewPersonAction); allToolBar->addAction(mNewPaymentAction); allToolBar->addAction(mNewDebtAction); allToolBar->addAction(mDeleteRowAction); }
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; }"); }
QToolBar *String_Toolbar::create(QMainWindow *w) const { QToolBar *toolbar = new QToolBar(title,w); toolbar->setObjectName(name); w->addToolBar(Qt::TopToolBarArea,toolbar); foreach(const QString&item, actions) { if ( item.isEmpty() ) toolbar->addSeparator(); else { QAction* act = w->findChild<QAction*>(item); if ( !act ) { QMenu *menu = w->findChild<QMenu*>(item); if ( menu ) act = menu->menuAction(); } if ( act ) toolbar->addAction ( act ); else qWarning() << QObject::tr("Warning:") << QObject::tr("Unknown action %1").arg(item); } } return toolbar; }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { QMenuBar *menuBar; QToolBar *mainToolBar; QWidget *centralWidget; QStatusBar *statusBar; if (this->objectName().isEmpty()) this->setObjectName(QString::fromUtf8("MainWindow")); this->resize(400, 300); menuBar = new QMenuBar(this); menuBar->setObjectName(QString::fromUtf8("menuBar")); this->setMenuBar(menuBar); mainToolBar = new QToolBar(this); mainToolBar->setObjectName(QString::fromUtf8("mainToolBar")); this->addToolBar(mainToolBar); centralWidget = new QWidget(this); centralWidget->setObjectName(QString::fromUtf8("centralWidget")); this->setCentralWidget(centralWidget); statusBar = new QStatusBar(this); statusBar->setObjectName(QString::fromUtf8("statusBar")); this->setStatusBar(statusBar); #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) this->setWindowTitle(QApplication::translate("MainWindow", "MainWindow", 0)); #else this->setWindowTitle(QApplication::translate("MainWindow", "MainWindow", 0, QApplication::UnicodeUTF8)); #endif QMetaObject::connectSlotsByName(this); }
QToolBar* MainWindow::registerToolBar(QString name, QString groupname) { QToolBar* toolbar = new QToolBar(name); toolbar->setObjectName(QString(name).remove(" ")+"ToolBar"); mDockWidgets->registerToolBar(toolbar, groupname); return toolbar; }
void BitcoinGUI::createToolBars() { QToolBar *toptoolbar = new QToolBar(tr("Tabs Top toolbar")); toptoolbar->addWidget(new Header); addToolBar(Qt::TopToolBarArea,toptoolbar); QToolBar *toolbar = new QToolBar(tr("Tabs toolbar")); toolbar->setObjectName("leftToolbar"); toolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); // toolbar->setContentsMargins(50,0,20,0); _addButtonInToolbar(overviewAction,toolbar); _addButtonInToolbar(sendCoinsAction,toolbar); _addButtonInToolbar(receiveCoinsAction,toolbar); _addButtonInToolbar(historyAction,toolbar); _addButtonInToolbar(blockAction,toolbar); _addButtonInToolbar(addressBookAction,toolbar); addToolBar(Qt::LeftToolBarArea,toolbar); // QToolBar *toolbar2 = new QToolBar(tr("Actions toolbar")); // toolbar2->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); // toolbar2->addAction(exportAction); // addToolBar(Qt::LeftToolBarArea, toolbar2); }
static QToolBar *createToolBar(const QString &title, const QString &objectName, const ActionList &actions) { QToolBar *rc = new QToolBar; rc->setObjectName(objectName); rc->setWindowTitle(title); addActionsToToolBar(actions, rc); return rc; }
static QToolBar* createToolBar(const QString& name, QWidget* parent, bool visible) { QToolBar* bar = new QToolBar(parent); bar->setObjectName(name); bar->setFloatable(false); bar->setMovable(true); bar->setVisible(visible); return bar; }
void CQTOpenGLLuaMainWindow::CreateFileActions() { QIcon cFileNewIcon; cFileNewIcon.addPixmap(QPixmap(m_pcMainWindow->GetIconDir() + "/new.png")); m_pcFileNewAction = new QAction(cFileNewIcon, tr("&New"), this); m_pcFileNewAction->setToolTip(tr("Create a new file")); m_pcFileNewAction->setStatusTip(tr("Create a new file")); m_pcFileNewAction->setShortcut(QKeySequence::New); connect(m_pcFileNewAction, SIGNAL(triggered()), this, SLOT(New())); QIcon cFileOpenIcon; cFileOpenIcon.addPixmap(QPixmap(m_pcMainWindow->GetIconDir() + "/open.png")); m_pcFileOpenAction = new QAction(cFileOpenIcon, tr("&Open..."), this); m_pcFileOpenAction->setToolTip(tr("Open a file")); m_pcFileOpenAction->setStatusTip(tr("Open a file")); m_pcFileOpenAction->setShortcut(QKeySequence::Open); connect(m_pcFileOpenAction, SIGNAL(triggered()), this, SLOT(Open())); for (int i = 0; i < MAX_RECENT_FILES; ++i) { m_pcFileOpenRecentAction[i] = new QAction(this); m_pcFileOpenRecentAction[i]->setVisible(false); connect(m_pcFileOpenRecentAction[i], SIGNAL(triggered()), this, SLOT(OpenRecentFile())); } QIcon cFileSaveIcon; cFileSaveIcon.addPixmap(QPixmap(m_pcMainWindow->GetIconDir() + "/save.png")); m_pcFileSaveAction = new QAction(cFileSaveIcon, tr("&Save"), this); m_pcFileSaveAction->setToolTip(tr("Save the current file")); m_pcFileSaveAction->setStatusTip(tr("Save the current file")); m_pcFileSaveAction->setShortcut(QKeySequence::Save); connect(m_pcFileSaveAction, SIGNAL(triggered()), this, SLOT(Save())); QIcon cFileSaveAsIcon; cFileSaveAsIcon.addPixmap(QPixmap(m_pcMainWindow->GetIconDir() + "/saveas.png")); m_pcFileSaveAsAction = new QAction(cFileSaveAsIcon, tr("S&ave as..."), this); m_pcFileSaveAsAction->setToolTip(tr("Save the current file under a new name")); m_pcFileSaveAsAction->setStatusTip(tr("Save the current file under a new name")); m_pcFileSaveAsAction->setShortcut(QKeySequence::SaveAs); connect(m_pcFileSaveAsAction, SIGNAL(triggered()), this, SLOT(SaveAs())); QMenu* pcMenu = menuBar()->addMenu(tr("&File")); pcMenu->addAction(m_pcFileNewAction); pcMenu->addSeparator(); pcMenu->addAction(m_pcFileOpenAction); pcMenu->addSeparator(); pcMenu->addAction(m_pcFileSaveAction); pcMenu->addAction(m_pcFileSaveAsAction); m_pcFileSeparateRecentAction = pcMenu->addSeparator(); for (int i = 0; i < MAX_RECENT_FILES; ++i) { pcMenu->addAction(m_pcFileOpenRecentAction[i]); } QToolBar* pcToolBar = addToolBar(tr("File")); pcToolBar->setObjectName("FileToolBar"); pcToolBar->setIconSize(QSize(32,32)); pcToolBar->addAction(m_pcFileNewAction); pcToolBar->addAction(m_pcFileOpenAction); pcToolBar->addAction(m_pcFileSaveAction); UpdateRecentFiles(); }
void JuffEd::initUI() { menus_[Juff::MenuFile] = new QMenu(tr("&File")); menus_[Juff::MenuEdit] = new QMenu(tr("&Edit")); menus_[Juff::MenuView] = new QMenu(tr("&View")); menus_[Juff::MenuSearch] = new QMenu(tr("&Search")); menus_[Juff::MenuFormat] = new QMenu(tr("For&mat")); menus_[Juff::MenuTools] = new QMenu(tr("&Tools")); menus_[Juff::MenuHelp] = new QMenu(tr("&Help")); // recent files recentFilesMenu_ = new QMenu(JuffEd::tr("Recent files")); connect(recentFilesMenu_, SIGNAL(aboutToShow()), SLOT(initRecentFilesMenu())); QString recentFiles = MainSettings::get(MainSettings::RecentFiles); if ( !recentFiles.isEmpty() ) { QStringList fileList = recentFiles.split(";"); int count = fileList.count(); for(int i = count - 1; i >= 0; --i) { const QString& fileName = fileList.at(i); if ( !fileName.isEmpty() ) addToRecentFiles(fileName); } } openWithCharsetGr_ = new QActionGroup(this); setCharsetGr_ = new QActionGroup(this); charsetMenu_ = new QMenu(JuffEd::tr("Charset")); openWithCharsetMenu_ = new QMenu(JuffEd::tr("Open with charset...")); setCharsetMenu_ = new QMenu(JuffEd::tr("Set charset")); initCharsetMenus(); charsetMenu_->addMenu(openWithCharsetMenu_); charsetMenu_->addMenu(setCharsetMenu_); docksMenu_ = new QMenu(tr("Docks")); toolBarsMenu_ = new QMenu(tr("Toolbars")); menus_[Juff::MenuTools]->addMenu(docksMenu_); menus_[Juff::MenuTools]->addMenu(toolBarsMenu_); CommandStorageInt* st = Juff::Utils::commandStorage(); QToolBar* mainToolBar = new QToolBar("mainToolBar"); mainToolBar->setObjectName("mainToolBar"); mainToolBar->addAction(st->action(FILE_NEW)); mainToolBar->addAction(st->action(FILE_OPEN)); mainToolBar->addAction(st->action(FILE_SAVE)); mainToolBar->addSeparator(); mainToolBar->addAction(st->action(FILE_PRINT)); mainToolBar->addSeparator(); mainToolBar->addAction(st->action(EDIT_UNDO)); mainToolBar->addAction(st->action(EDIT_REDO)); mainToolBar->addSeparator(); mainToolBar->addAction(st->action(EDIT_CUT)); mainToolBar->addAction(st->action(EDIT_COPY)); mainToolBar->addAction(st->action(EDIT_PASTE)); mainToolBar->addSeparator(); mainToolBar->addAction(st->action(SEARCH_FIND)); mw_->addToolBar(mainToolBar); }
void DlgCustomToolbarsImp::addCustomToolbar(const QString& name) { QVariant data = workbenchBox->itemData(workbenchBox->currentIndex(), Qt::UserRole); Workbench* w = WorkbenchManager::instance()->active(); if (w && w->name() == std::string((const char*)data.toByteArray())) { QToolBar* bar = getMainWindow()->addToolBar(name); bar->setObjectName(name); } }
void MainWindow::createToolbar() { QToolBar* tb = new QToolBar(tr("Main Toolbar"), this); tb->setObjectName("main-toolbar"); addToolBar(Qt::TopToolBarArea, tb); tb->addAction(_newAction); tb->addSeparator(); }
/* * Создает toolbar */ void FormsManager::createToolBar() { QToolBar *pluginsBar = Core::KleverGui::instance().mainwindow()->addToolBar(tr("Плагины")); pluginsBar->setObjectName("Плагины"); pluginsBar->setIconSize(QSize(32,32)); if (Core::Plugins::instance().isPluginExist(tr("logger"))) { pluginsBar->addAction(getManagerAction_FromWAPair(tr("logger"), tr("(Logger)Watcher"))); } }
bool EditorManager::initWithApp(IApplication *app) { if (!IEditorManager::initWithApp(app)) { return false; } m_currentNavigationHistoryPosition = 0; m_widget = new QWidget; m_editorTabWidget = new LiteTabWidget; m_editorTabWidget->tabBar()->setTabsClosable(m_liteApp->settings()->value(LITEAPP_EDITTABSCLOSABLE,true).toBool()); //m_editorTabWidget->tabBar()->setIconSize(LiteApi::getToolBarIconSize()); // m_editorTabWidget->tabBar()->setStyleSheet("QTabBar::tab{border:1px solid} QTabBar::close-button {margin:0px; image: url(:/images/closetool.png); subcontrol-position: left;}" // ); QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->setMargin(1); mainLayout->setSpacing(1); QToolBar *toolBar = m_editorTabWidget->headerToolBar(); toolBar->setObjectName("toolbar/tabs"); m_liteApp->actionManager()->insertToolBar(toolBar); m_editorTabWidget->headerToolBar()->setAllowedAreas(Qt::TopToolBarArea|Qt::BottomToolBarArea); mainLayout->addWidget(m_editorTabWidget->stackedWidget()); m_widget->setLayout(mainLayout); connect(m_editorTabWidget,SIGNAL(currentChanged(int)),this,SLOT(editorTabChanged(int))); connect(m_editorTabWidget,SIGNAL(tabCloseRequested(int)),this,SLOT(editorTabCloseRequested(int))); connect(m_editorTabWidget,SIGNAL(tabAddRequest()),this,SIGNAL(tabAddRequest())); m_editorTabWidget->stackedWidget()->installEventFilter(this); m_editorTabWidget->tabBar()->installEventFilter(this); m_tabContextMenu = new QMenu; m_tabContextIndex = -1; QAction *closeAct = new QAction(tr("Close"),this); closeAct->setShortcut(QKeySequence("Ctrl+W")); QAction *closeOthersAct = new QAction(tr("Close Others"),this); QAction *closeAllAct = new QAction(tr("Close All"),this); QAction *moveToAct = new QAction(tr("Move To New Window"),this); m_tabContextMenu->addAction(closeAct); m_tabContextMenu->addAction(closeOthersAct); m_tabContextMenu->addAction(closeAllAct); m_tabContextMenu->addSeparator(); m_tabContextMenu->addAction(moveToAct); connect(closeAct,SIGNAL(triggered()),this,SLOT(tabContextClose())); connect(closeOthersAct,SIGNAL(triggered()),this,SLOT(tabContextCloseOthers())); connect(closeAllAct,SIGNAL(triggered()),this,SLOT(tabContextCloseAll())); connect(moveToAct,SIGNAL(triggered()),this,SLOT(moveToNewWindow())); return true; }
std::vector<QToolBar *> RegistrationHistoryGUIExtenderService::createToolBars() const { QToolBar* registrationHistoryToolBar = new QToolBar("Registration History"); registrationHistoryToolBar->setObjectName("RegistrationHistoryToolBar"); registrationHistoryToolBar->addWidget(new RegistrationHistoryWidget(mServices, registrationHistoryToolBar, true)); std::vector<QToolBar*> retval; retval.push_back(registrationHistoryToolBar); return retval; }
void ToolBoxManager::setup( ToolBarItem* toolBar ) const { if ( !toolBar || !_toolBox ) return; // empty tool bar int ct = _toolBox->count(); for ( int i=0; i<ct; i++ ) { // get always the first item widget QWidget* w = _toolBox->widget(0); _toolBox->removeItem(0); delete w; } CommandManager& mgr = Application::Instance->commandManager(); QList<ToolBarItem*> items = toolBar->getItems(); for ( QList<ToolBarItem*>::ConstIterator item = items.begin(); item != items.end(); ++item ) { QToolBar* bar = new QToolBar(); bar->setOrientation(Qt::Vertical); bar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); std::string toolbarName = (*item)->command(); bar->setObjectName(QString::fromLatin1((*item)->command().c_str())); bar->setWindowTitle(QObject::trUtf8(toolbarName.c_str())); // i18n _toolBox->addItem( bar, bar->windowTitle() ); QList<ToolBarItem*> subitems = (*item)->getItems(); for ( QList<ToolBarItem*>::ConstIterator subitem = subitems.begin(); subitem != subitems.end(); ++subitem ) { if ( (*subitem)->command() == "Separator" ) { //bar->addSeparator(); } else { mgr.addTo((*subitem)->command().c_str(), bar); } } // Now set the right size policy for each tool button QList<QToolButton*> tool = bar->findChildren<QToolButton*>(); for (QList<QToolButton*>::Iterator it = tool.begin(); it != tool.end(); ++it) { (*it)->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); // When setting the horizontal size policy but no icon is set we use the following trick // to make the button text left aligned. QIcon icon = (*it)->icon(); if (icon.isNull()) { // Create an icon filled with the button color int size = QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize); QPixmap p(size, size); p.fill(Qt::transparent); (*it)->setIcon(p); } } } }
QToolBar *TikzEditorView::toolBar() { QToolBar *editToolBar = new QToolBar(tr("Edit"), m_parentWidget); editToolBar->setObjectName("EditToolBar"); editToolBar->addAction(m_undoAction); editToolBar->addAction(m_redoAction); // editToolBar->addAction(m_cutAction); // editToolBar->addAction(m_copyAction); // editToolBar->addAction(m_pasteAction); return editToolBar; }
bool WinControl::callQTModule( const string &nm ) { vector<string> list; AutoHD<TModule> qt_mod = mod->owner().modAt(nm); QMainWindow *(TModule::*openWindow)( ); qt_mod.at().modFunc("QMainWindow *openWindow();",(void (TModule::**)()) &openWindow); QMainWindow *new_wnd = ((&qt_mod.at())->*openWindow)( ); if(!new_wnd) return false; //> Make Qt starter toolbar QToolBar *toolBar = NULL; QMenu *menu = NULL; if(!new_wnd->property("QTStarterToolDis").toBool()) { toolBar = new QToolBar("QTStarter",new_wnd); toolBar->setObjectName("QTStarterTool"); new_wnd->addToolBar(Qt::TopToolBarArea,toolBar); toolBar->setMovable(true); } if(!new_wnd->property("QTStarterMenuDis").toBool() && !new_wnd->menuBar()->actions().empty()) menu = new_wnd->menuBar()->addMenu("QTStarter"); mod->owner().modList(list); for(unsigned i_l = 0; i_l < list.size(); i_l++) if(mod->owner().modAt(list[i_l]).at().modInfo("SubType") == "QT" && mod->owner().modAt(list[i_l]).at().modFuncPresent("QMainWindow *openWindow();")) { AutoHD<TModule> qt_mod = mod->owner().modAt(list[i_l]); QIcon icon; if( mod->owner().modAt(list[i_l]).at().modFuncPresent("QIcon icon();") ) { QIcon(TModule::*iconGet)(); mod->owner().modAt(list[i_l]).at().modFunc("QIcon icon();",(void (TModule::**)()) &iconGet); icon = ((&mod->owner().modAt(list[i_l]).at())->*iconGet)( ); } else icon = QIcon(":/images/oscada_qt.png"); QAction *act_1 = new QAction(icon,qt_mod.at().modName().c_str(),new_wnd); act_1->setObjectName(list[i_l].c_str()); //act_1->setShortcut(Qt::CTRL+Qt::SHIFT+Qt::Key_1); act_1->setToolTip(qt_mod.at().modName().c_str()); act_1->setWhatsThis(qt_mod.at().modInfo("Description").c_str()); QObject::connect(act_1, SIGNAL(triggered()), this, SLOT(callQTModule())); if( toolBar ) toolBar->addAction(act_1); if( menu ) menu->addAction(act_1); } new_wnd->show(); return true; }
MainWindow::MainWindow() { // // Source code view // m_textViewers = new QTabWidget(this); m_textViewers->setObjectName("Editors"); m_textViewers->setElideMode(Qt::ElideLeft); setCentralWidget(m_textViewers); setGeometry(QRect(0, 0, 800, 600)); m_fileOpenAction = new QAction("Open", this); m_quitAction = new QAction("Quit", this); // // Menubar // QMenu *fileMenu = new QMenu(menuBar()); fileMenu->setTitle(tr("File")); fileMenu->addAction(m_fileOpenAction); fileMenu->addSeparator(); fileMenu->addAction(m_quitAction); menuBar()->addMenu(fileMenu); // // Toolbar // QToolBar *toolbar = new QToolBar(this); toolbar->setObjectName("ToolBar"); toolbar->addAction(m_fileOpenAction); toolbar->addAction(m_quitAction); addToolBar(Qt::TopToolBarArea, toolbar); // // Statusbar // QStatusBar *statusbar = new QStatusBar(this); statusbar->setObjectName("StatusBar"); setStatusBar(statusbar); show(); restoreState(settings().value("MainWindow/State").toByteArray()); setGeometry(settings().value("MainWindow/Geometry").toRect()); // // Connections // connect(m_fileOpenAction, SIGNAL(triggered()), this, SLOT(fileOpen())); connect(m_quitAction, SIGNAL(triggered()), this, SLOT(close())); }
/*! \internal \brief Creates tool box on the right side. */ void Ui::MainWindow::createToolBox() { // tool box of several tools QWidget *toolBoxContent = new QWidget; QGridLayout *layout = new QGridLayout(toolBoxContent); layout->setMargin(1); layout->setSpacing(2); toolBoxContent->setLayout(layout); QToolButton *selectToolButton = createToolButton(selectToolAction); layout->addWidget(selectToolButton, 0, 0, 1, 1); QToolButton *moveToolButton = createToolButton(moveToolAction); layout->addWidget(moveToolButton, 0, 1, 1, 1); QToolButton *paintCanToolButton = createToolButton(paintCanToolAction); layout->addWidget(paintCanToolButton, 1, 0, 1, 1); QToolButton *eraserToolButton = createToolButton(eraserToolAction); layout->addWidget(eraserToolButton, 1, 1, 1, 1); QToolButton *textToolButton = createToolButton(textToolAction); layout->addWidget(textToolButton, 2, 0, 1, 1); QToolButton *paintbrushToolButton = createToolButton(paintbrushToolAction); layout->addWidget(paintbrushToolButton, 3, 0, 1, 1); QToolButton *pencilToolButton = createToolButton(pencilToolAction); layout->addWidget(pencilToolButton, 3, 1, 1, 1); QToolButton *lineToolButton = createToolButton(lineToolAction); layout->addWidget(lineToolButton, 4, 0, 1, 1); QToolButton *curveToolButton = createToolButton(curveToolAction); layout->addWidget(curveToolButton, 4, 1, 1, 1); QToolButton *ellipseToolButton = createToolButton(ellipseToolAction); layout->addWidget(ellipseToolButton, 5, 0, 1, 1); QToolButton *rectangleToolButton = createToolButton(rectangleToolAction); layout->addWidget(rectangleToolButton, 5, 1, 1, 1); QToolButton *roundRectangleToolButton = createToolButton(roundRectangleToolAction); layout->addWidget(roundRectangleToolButton, 6, 0, 1, 1); QToolButton *polygonToolButton = createToolButton(polygonToolAction); layout->addWidget(polygonToolButton, 6, 1, 1, 1); ci = new ColorIndicator(toolBoxContent); layout->addWidget(ci, 7, 0, 2, 2, Qt::AlignCenter); QToolBar *toolBox = actionManager->toolBar(Core::ID::TOOL_BOX); toolBox->setObjectName("ToolBox"); toolBox->setOrientation(Qt::Vertical); toolBox->addWidget(toolBoxContent); toolBox->setAllowedAreas(Qt::LeftToolBarArea | Qt::RightToolBarArea); addToolBar(Qt::LeftToolBarArea, toolBox); }
void MainWindow::createToolbar() { // // Main toolbar // QToolBar* toolbar = new QToolBar("File Toolbar"); toolbar->addAction(QIcon(":/icons/new.png"), "New", this, SLOT(newFile())); toolbar->addAction(QIcon(":/icons/open.png"), "Open", this, SLOT(openFile())); mActionsRequiringFiles.append(toolbar->addAction(QIcon(":/icons/save.png"), "Save", this, SLOT(saveFile()))); toolbar->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); addToolBar(toolbar); registerContextMenuItem(toolbar); toolbar->setObjectName("File Toolbar"); QWidget* spacer = new QWidget(); spacer->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Expanding); toolbar->addWidget(spacer); toolbar->setStyleSheet("QToolBar { margin: 0px; padding: 0px; spacing: 3px; }"); toolbar->setStyleSheet("QToolButton { margin: 0px; padding: 0px; width:22px; height:22px }"); // // View toolbar // toolbar = new QToolBar("View Toolbar"); mActionsRequiringFiles.append(toolbar->addAction(QIcon(":/icons/verticalsplit.png"), "Split View Vertically", gWindowManager, SLOT(splitVertically()))); mActionsRequiringFiles.append(toolbar->addAction(QIcon(":/icons/horizontalsplit.png"), "Split View Horizontally", gWindowManager, SLOT(splitHorizontally()))); mActionsRequiringSplitViews.append(toolbar->addAction(QIcon(":/icons/removesplit.png"), "Remove Split", gWindowManager, SLOT(removeSplit()))); addToolBar(toolbar); registerContextMenuItem(toolbar); toolbar->setObjectName("View Toolbar"); toolbar->setStyleSheet("QToolBar { margin: 0px; padding: 0px; spacing: 3px; }"); toolbar->setStyleSheet("QToolButton { margin: 0px; padding: 0px; width:22px; height:22px }"); }
QToolBar *ActionManager::createToolBar(const QString &id) { if(m_toolBars.contains(id)) return m_toolBars.value(id); QToolBar *toolBar = new QToolBar(); toolBar->setObjectName(id); toolBar->setFloatable(false); m_mainWindow->addToolBar(toolBar); m_toolBars.insert(id, toolBar); return toolBar; }