void MainWindow::createToolBars() { webToolBar = addToolBar(tr("Web Tool Bar")); webToolBar->addAction(publishAct); editToolBar = addToolBar(tr("Edit Tool Bar")); editToolBar->addAction(undoAct); editToolBar->addAction(redoAct); QToolButton *editButton = new QToolButton(editToolBar); QMenu *editList = new QMenu(editButton); editList->addAction(cutAct); editList->addAction(copyAct); editList->addAction(pasteAct); editButton->setPopupMode(QToolButton::InstantPopup); editButton->setIcon(cutAct->icon()); editButton->setMenu(editList); editToolBar->addWidget(editButton); textToolBar = addToolBar(tr("Text Tool Bar")); secList = new HeadingComboBox(this); textToolBar->addWidget(secList); textToolBar->addAction(textBoldAct); textToolBar->addAction(textItalicAct); textToolBar->addAction(textUnderlineAct); textToolBar->addAction(textStrikeoutAct); textToolBar->addAction(textFontAct); textToolBar->addAction(textColorAct); textToolBar->addAction(textBackgroundColorAct); textToolBar->addSeparator(); if(QApplication::isLeftToRight()) { textToolBar->addAction(alignLeftAct); textToolBar->addAction(alignCenterAct); textToolBar->addAction(alignRightAct); } else { textToolBar->addAction(alignRightAct); textToolBar->addAction(alignCenterAct); textToolBar->addAction(alignLeftAct); } textToolBar->addAction(alignJustifyAct); textToolBar->addSeparator(); textToolBar->addAction(bulletListAct); textToolBar->addAction(numberedListAct); QToolButton *tableButton = new QToolButton(editToolBar); tableButton->setMenu(createTableMenu(tableButton)); tableButton->setPopupMode(QToolButton::InstantPopup); tableButton->setIcon(tableInsertAct->icon()); tableButton->setToolTip(tr("Table")); textToolBar->addWidget(tableButton); }
QWidget* KoSelectShapeAction::createWidget( QWidget* parent ) { QToolButton* toolButton = new QToolButton( parent ); toolButton->setPopupMode( QToolButton::InstantPopup ); toolButton->setMenu( createShapeMenu() ); return toolButton; }
QWidget* ToolAction::createWidget( QWidget *parent ) { QToolBar *toolBar = qobject_cast< QToolBar * >( parent ); if ( !toolBar ) return 0; QToolButton *button = new QToolButton( toolBar ); button->setAutoRaise( true ); button->setFocusPolicy( Qt::NoFocus ); button->setIconSize( toolBar->iconSize() ); button->setToolButtonStyle( toolBar->toolButtonStyle() ); button->setPopupMode( QToolButton::DelayedPopup ); button->setMenu( new QMenu( button ) ); button->setCheckable( true ); connect(toolBar, &QToolBar::iconSizeChanged, button, &QToolButton::setIconSize); connect(toolBar, &QToolBar::toolButtonStyleChanged, button, &QToolButton::setToolButtonStyle); connect(button, &QToolButton::triggered, toolBar, &QToolBar::actionTriggered); connect( button->menu(), &QMenu::triggered, this, &ToolAction::slotNewDefaultAction ); m_buttons.append( button ); if ( !m_actions.isEmpty() ) { button->setDefaultAction( m_actions.first() ); foreach ( QAction *action, m_actions ) { button->menu()->addAction( action ); if ( action->isChecked() ) button->setDefaultAction( action ); }
void BookmarksToolBar::build() { clear(); for (int i = 0; i < m_bookmarksModel->rowCount(m_root); ++i) { QModelIndex idx = m_bookmarksModel->index(i, 0, m_root); if (m_bookmarksModel->hasChildren(idx)) { QToolButton *button = new QToolButton(this); button->setPopupMode(QToolButton::InstantPopup); button->setArrowType(Qt::DownArrow); button->setText(idx.data().toString()); ModelMenu *menu = new ModelMenu(this); connect(menu, SIGNAL(activated(QModelIndex)), this, SLOT(activated(QModelIndex))); menu->setModel(m_bookmarksModel); menu->setRootIndex(idx); menu->addAction(new QAction(menu)); button->setMenu(menu); button->setToolButtonStyle(Qt::ToolButtonTextOnly); QAction *a = addWidget(button); a->setText(idx.data().toString()); } else { QAction *action = addAction(idx.data().toString()); action->setData(idx.data(BookmarksModel::UrlRole)); } } }
BottomPanelChooser::BottomPanelChooser( BottomPanel* bottomPanel, QWidget *parent) : QToolBar(parent) , _bottomPanel(bottomPanel) , _displayMenu(NULL) , _menuAction(NULL) , _openMap(new QSignalMapper(this)) , _displayMap(new QSignalMapper(this)) { this->setObjectName("DarkToolBar"); _bottomPanel->installEventFilter(this); _displayMenu = new QMenu; QToolButton* toolButton = new QToolButton; //toolButton->setIcon(QIcon()); toolButton->setMenu(_displayMenu); toolButton->setPopupMode(QToolButton::InstantPopup); _menuAction = this->QToolBar::addWidget(toolButton); _menuAction->setVisible(false); connect(_openMap, SIGNAL(mapped(QWidget*)), this, SLOT(xOnOpenTriggered(QWidget*))); connect(_displayMap, SIGNAL(mapped(QWidget*)), this, SLOT(xOnDisplayTriggered(QWidget*))); }
Core::NavigationView TestNavigationWidgetFactory::createWidget() { Core::NavigationView view; TestSelector *ptw = new TestSelector(); ptw->rescan(); view.widget = ptw; QToolButton *filter = new QToolButton; filter->setIcon(QIcon(Core::Constants::ICON_FILTER)); filter->setToolTip(tr("Filter tree")); filter->setPopupMode(QToolButton::InstantPopup); QMenu *filterMenu = new QMenu(filter); filterMenu->addAction(ptw->m_componentViewMode); filterMenu->addAction(ptw->m_showUnitTests); filterMenu->addAction(ptw->m_showIntegrationTests); filterMenu->addAction(ptw->m_showPerformanceTests); filterMenu->addAction(ptw->m_showSystemTests); filter->setMenu(filterMenu); QToolButton *newTest = new QToolButton; newTest->setIcon(QIcon(":/core/images/filenew.png")); newTest->setToolTip(tr("New test")); newTest->setPopupMode(QToolButton::InstantPopup); QObject::connect(newTest, SIGNAL(clicked()), ptw, SLOT(testInsertUnitOrSystemTest()), Qt::DirectConnection); view.dockToolBarWidgets << filter << newTest; return view; }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); // create TabListMenu QSint::TabListMenu *tabMenu = new QSint::TabListMenu(this); // assing ui->tabWidget to the tabMenu tabMenu->setTabs(ui->tabWidget); // create corner button QToolButton *tbTabsDropList = new QToolButton(this); tbTabsDropList->setArrowType(Qt::DownArrow); tbTabsDropList->setPopupMode(QToolButton::InstantPopup); ui->tabWidget->setCornerWidget(tbTabsDropList); // assing tabMenu to the tbTabsDropList tbTabsDropList->setMenu(tabMenu); // just for demo: connect cbUseIcons checkbox to the tabMenu's setAllowIcons() slot connect(ui->cbUseIcons, SIGNAL(toggled(bool)), tabMenu, SLOT(setAllowIcons(bool))); }
dspOrderActivityByProject::dspOrderActivityByProject(QWidget* parent, const char*, Qt::WindowFlags fl) : display(parent, "dspOrderActivityByProject", fl) { setupUi(optionsWidget()); setWindowTitle(tr("Order Activity by Project")); setListLabel(tr("Orders")); setReportName("OrderActivityByProject"); setMetaSQLOptions("orderActivityByProject", "detail"); setUseAltId(true); _run = false; list()->addColumn(tr("Name"), _itemColumn, Qt::AlignLeft, true, "name" ); list()->addColumn(tr("Status"), _orderColumn, Qt::AlignLeft, true, "status" ); list()->addColumn(tr("Item #"), _itemColumn, Qt::AlignLeft, true, "item" ); list()->addColumn(tr("Description"), -1 , Qt::AlignLeft, true, "descrip" ); list()->addColumn(tr("Account/Customer"), -1 , Qt::AlignLeft, true, "customer" ); list()->addColumn(tr("Contact"), -1 , Qt::AlignLeft, false, "contact" ); list()->addColumn(tr("City"), -1 , Qt::AlignLeft, false, "city" ); list()->addColumn(tr("State"), -1 , Qt::AlignLeft, false, "state" ); list()->addColumn(tr("Qty"), _qtyColumn, Qt::AlignRight, true, "qty" ); list()->addColumn(tr("UOM"), _uomColumn, Qt::AlignLeft, true, "uom" ); list()->addColumn(tr("Value"), _qtyColumn, Qt::AlignRight, true, "value" ); list()->addColumn(tr("Due Date"), _dateColumn, Qt::AlignRight, true, "due" ); list()->addColumn(tr("Assigned"), _dateColumn, Qt::AlignRight, true, "assigned" ); list()->addColumn(tr("Started"), _dateColumn, Qt::AlignRight, true, "started" ); list()->addColumn(tr("Completed"), _dateColumn, Qt::AlignRight, true, "completed" ); list()->addColumn(tr("Hrs. Budget"), _qtyColumn, Qt::AlignRight, true, "hrs_budget" ); list()->addColumn(tr("Hrs. Actual"), _qtyColumn, Qt::AlignRight, true, "hrs_actual" ); list()->addColumn(tr("Hrs. Balance"), _qtyColumn, Qt::AlignRight, true, "hrs_balance" ); list()->addColumn(tr("Exp. Budget"), _priceColumn, Qt::AlignRight, true, "exp_budget" ); list()->addColumn(tr("Exp. Actual"), _priceColumn, Qt::AlignRight, true, "exp_actual" ); list()->addColumn(tr("Exp. Balance"), _priceColumn, Qt::AlignRight, true, "exp_balance" ); list()->setPopulateLinear(true); disconnect(newAction(), SIGNAL(triggered()), this, SLOT(sNew())); connect(newAction(), SIGNAL(triggered()), this, SLOT(sNewProjectTask())); connect(_showSo, SIGNAL(checked()), this, SLOT(sFillList())); connect(_showPo, SIGNAL(checked()), this, SLOT(sFillList())); connect(_showWo, SIGNAL(checked()), this, SLOT(sFillList())); QToolButton * newBtn = (QToolButton*)toolBar()->widgetForAction(newAction()); newBtn->setPopupMode(QToolButton::MenuButtonPopup); QAction *menuItem; QMenu * newMenu = new QMenu; menuItem = newMenu->addAction(tr("Task"), this, SLOT(sNewProjectTask())); menuItem->setEnabled(_privileges->check("MaintainAllProjects")); newMenu->addSeparator(); menuItem = newMenu->addAction(tr("Sales Order"), this, SLOT(sNewSalesOrder())); menuItem->setEnabled(_privileges->check("MaintainSalesOrders")); menuItem = newMenu->addAction(tr("Purchase Order"), this, SLOT(sNewPurchaseOrder())); menuItem->setEnabled(_privileges->check("MaintainPurchaseOrders")); menuItem = newMenu->addAction(tr("Work Order"), this, SLOT(sNewWorkOrder())); menuItem->setEnabled(_privileges->check("MaintainWorkOrders")); newBtn->setMenu(newMenu); }
void ToolDockWidget::setToolMenu(QMenu *menu) { QToolButton *btn = new QToolButton; btn->setPopupMode(QToolButton::InstantPopup); btn->setMenu(menu); m_toolBar->insertWidget(m_closeAct,btn); }
ViewWindow::ViewWindow( Record::Server& server, QWidget* parent, Qt::WFlags flags ) : QMainWindow( parent, flags ) , server( server ) , pShow1x1( new QAction( QIcon( ":/icons/1x1.png" ), "1x1", this ) ) , pShow2x1( new QAction( QIcon( ":/icons/2x1.png" ), "2x1", this ) ) , pShow1x2( new QAction( QIcon( ":/icons/1x2.png" ), "1x2", this ) ) , pShow2x2( new QAction( QIcon( ":/icons/2x2.png" ), "2x2", this ) ) { QToolBar* toolbar = addToolBar( "View" ); toolbar->setMovable( false ); toolbar->addAction( pShow1x1 ); toolbar->addAction( pShow2x1 ); toolbar->addAction( pShow1x2 ); toolbar->addAction( pShow2x2 ); connect( pShow1x1, SIGNAL( triggered() ), this, SLOT( show1x1() ) ); connect( pShow2x1, SIGNAL( triggered() ), this, SLOT( show2x1() ) ); connect( pShow1x2, SIGNAL( triggered() ), this, SLOT( show1x2() ) ); connect( pShow2x2, SIGNAL( triggered() ), this, SLOT( show2x2() ) ); pShow1x1->setCheckable( true ); pShow2x1->setCheckable( true ); pShow1x2->setCheckable( true ); pShow2x2->setCheckable( true ); // ----------------------------------------------------------------- QToolButton* pAcquireButton = new QToolButton( toolbar ); QMenu* pAcquireMenu = new QMenu( pAcquireButton ); pAcquireButton->setMenu( pAcquireMenu ); pAcquireButton->setPopupMode( QToolButton::InstantPopup ); pAcquireButton->setText( "&Acquire" ); pAcquireButton->setMinimumHeight( 32 ); toolbar->setIconSize( QSize( 24, 24 ) ); toolbar->addSeparator(); toolbar->addWidget( pAcquireButton ); for( auto it = ComponentRegister::instance().factories.begin(); it != ComponentRegister::instance().factories.end(); ++it ) { ComponentLauncher* launcher = new ComponentLauncher( **it, *this, this ); pAcquireMenu->addAction( launcher->action ); } // ----------------------------------------------------------------- areaArray = new EmbedAreaArray(); this->setCentralWidget( areaArray ); // ----------------------------------------------------------------- componentWindowfactory.reset( new ViewWindowComponentWindowFactory( *this, *areaArray ) ); pShow1x1->trigger(); }
todoList::todoList(QWidget* parent, const char*, Qt::WFlags fl) : display(parent, "todoList", fl) { setupUi(optionsWidget()); setWindowTitle(tr("To-Do Items")); setReportName("TodoList"); setMetaSQLOptions("todolist", "detail"); setUseAltId(true); setParameterWidgetVisible(true); setNewVisible(true); setQueryOnStartEnabled(true); parameterWidget()->append(tr("Assigned"), "assigned_username", ParameterWidget::User, omfgThis->username()); parameterWidget()->append(tr("Assigned Pattern"), "assigned_usr_pattern", ParameterWidget::Text); parameterWidget()->append(tr("Owner"), "owner_username", ParameterWidget::User); parameterWidget()->append(tr("Owner Pattern"), "owner_usr_pattern", ParameterWidget::Text); parameterWidget()->append(tr("CRM Account"), "crmacct_id", ParameterWidget::Crmacct); parameterWidget()->append(tr("Start Date Before"), "startStartDate", ParameterWidget::Date); parameterWidget()->append(tr("Start Date After"), "startEndDate", ParameterWidget::Date); parameterWidget()->append(tr("Due Date Before"), "dueStartDate", ParameterWidget::Date); parameterWidget()->append(tr("Due Date After"), "dueEndDate", ParameterWidget::Date); parameterWidget()->applyDefaultFilterSet(); connect(_completed, SIGNAL(toggled(bool)), this, SLOT(sFillList())); connect(_todolist, SIGNAL(toggled(bool)), this, SLOT(sFillList())); connect(_incidents, SIGNAL(toggled(bool)), this, SLOT(sFillList())); connect(_projects, SIGNAL(toggled(bool)), this, SLOT(sFillList())); connect(list(), SIGNAL(itemSelected(int)), this, SLOT(sEdit())); list()->addColumn(tr("Type"), _userColumn, Qt::AlignCenter, true, "type"); list()->addColumn(tr("Seq"), _seqColumn, Qt::AlignRight, false, "seq"); list()->addColumn(tr("Priority"), _userColumn, Qt::AlignLeft, true, "priority"); list()->addColumn(tr("Assigned To"),_userColumn, Qt::AlignLeft, true, "usr"); list()->addColumn(tr("Name"), 100, Qt::AlignLeft, true, "name"); list()->addColumn(tr("Description"), -1, Qt::AlignLeft, true, "descrip"); list()->addColumn(tr("Status"), _statusColumn, Qt::AlignLeft, true, "status"); list()->addColumn(tr("Start Date"),_dateColumn, Qt::AlignLeft, false, "start"); list()->addColumn(tr("Due Date"), _dateColumn, Qt::AlignLeft, true, "due"); list()->addColumn(tr("Parent#"), _orderColumn, Qt::AlignLeft, true, "number"); list()->addColumn(tr("Customer#"),_orderColumn, Qt::AlignLeft, false, "cust"); list()->addColumn(tr("Account#"), _orderColumn, Qt::AlignLeft, false, "crmacct_number"); list()->addColumn(tr("Account Name"), 100, Qt::AlignLeft, true, "crmacct_name"); list()->addColumn(tr("Owner"), _userColumn, Qt::AlignLeft, false,"owner"); QToolButton * newBtn = (QToolButton*)toolBar()->widgetForAction(newAction()); newBtn->setPopupMode(QToolButton::MenuButtonPopup); QAction *menuItem; QMenu * todoMenu = new QMenu; menuItem = todoMenu->addAction(tr("Incident"), this, SLOT(sNewIncdt())); menuItem->setEnabled(_privileges->check("MaintainIncidents")); menuItem = todoMenu->addAction(tr("To-Do Item"), this, SLOT(sNew())); menuItem->setShortcut(QKeySequence::New); menuItem->setEnabled(_privileges->check("MaintainPersonalTodoList") || _privileges->check("MaintainOtherTodoLists")); newBtn->setMenu(todoMenu); }
QToolButton* AppearanceDialog::selectButton(int width, int height, QString toolTip) { QToolButton* button = new QToolButton(this); button->setToolTip(toolTip); button->setToolButtonStyle(Qt::ToolButtonTextOnly); button->setMenu(new QMenu(button)); button->setMinimumWidth(width); button->setMinimumHeight(height); return button; }
void QCastViewGL::getToolbars(CPtrVector<QToolBar>& toolbars) { if (! pView) return; CPtrVector<cogx::display::CDisplayCamera> cameras; pView->getCameras(cameras); if (cameras.size() < 1) return; // pBar->parent will be reset in QViewContainer QToolBar *pBar = new QToolBar(QString::fromStdString(pView->m_id), this); if (pBar) { unsigned int nc = cameras.size(); if (nc > 3) nc = 3; cogx::display::CDisplayCamera* pCamera; for (unsigned int i= 0; i < nc; i++) { QToolButton *pBut = new QToolButton(pBar); pCamera = cameras[i]; QString text = QString::fromStdString(pCamera->name); QAction* pAct = new QAction(QIcon(":/toolButton/camera-photo.png"), text, pBut); pAct->setToolTip("Select Camera: " + text); pAct->setData(qVariantFromValue((void*)pCamera)); pBut->setDefaultAction(pAct); pBar->addWidget(pBut); pBar->connect(pAct, SIGNAL(triggered()), this, SLOT(onCameraChangeAction())); // With more than 3 cameras things become complicated... if (i == 2 && cameras.size() > 2) { QAction *pPopAct; QMenu *pMenu = new QMenu(pBut); // parent MUST be button, see onCameraChangeAction pBut->setMenu(pMenu); pBut->setPopupMode(QToolButton::MenuButtonPopup); for (unsigned int j = 0; j < cameras.size(); j++) { if (i == j) { pMenu->addAction(pAct); pAct->setParent(pMenu); // parent MUST be menu, see onCameraChangeAction } else { pCamera = cameras[j]; text = QString::fromStdString(pCamera->name); pPopAct = pMenu->addAction(QIcon(":/toolButton/camera-photo.png"), text); pPopAct->setData(qVariantFromValue((void*)pCamera)); pPopAct->setToolTip("Select Camera: " + text); pBar->connect(pPopAct, SIGNAL(triggered()), this, SLOT(onCameraChangeAction())); } } if (0) { text = "TODO: Configure camera buttons..."; pPopAct = pMenu->addAction(QIcon(":/toolButton/camera-photo.png"), text); pBar->connect(pPopAct, SIGNAL(triggered()), this, SLOT(onActConfigureCameras())); } } } toolbars.push_back(pBar); } }
void FramelessDlg::InitTitleBar() { QVBoxLayout* layout = qobject_cast<QVBoxLayout*>(this->layout()); m_closeBtn = new QToolButton(this); QToolButton* minBtn = new QToolButton(this); QToolButton* menuBtn = new QToolButton(this); m_subTitle = new QLabel(this); m_subTitle->setAlignment(Qt::AlignRight | Qt::AlignVCenter); m_closeBtn->setObjectName("closeBtn"); minBtn->setObjectName("minBtn"); menuBtn->setObjectName("menuBtn"); m_subTitle->setObjectName("subTitle"); menuBtn->setPopupMode(QToolButton::InstantPopup); m_menu = new QMenu(this); menuBtn->setMenu(m_menu); m_closeBtn->setFixedSize(27, 22); minBtn->setFixedSize(27, 22); menuBtn->setFixedSize(27, 22); m_subTitle->setFixedSize(400, 25); connect(m_closeBtn, SIGNAL(clicked()), this, SLOT(reject())); connect(m_closeBtn, SIGNAL(clicked()), this, SLOT(close())); connect(minBtn, SIGNAL(clicked()), this, SLOT(showMinimized())); QFrame* tb = new QFrame(this); tb->setObjectName("titleBar"); QHBoxLayout* tbLayout = new QHBoxLayout; m_title = new QLabel(this); m_title->setObjectName("label_title"); m_title->setFixedSize(300, 25); tbLayout->addWidget(m_title); tbLayout->addSpacerItem(new QSpacerItem(20, 40, QSizePolicy::Expanding, QSizePolicy::Fixed)); if ( m_flag & SUB_TITLE ) tbLayout->addWidget(m_subTitle); if ( m_flag & MENU_BUTTON ) tbLayout->addWidget(menuBtn); if ( m_flag & MIN_BUTTON ) tbLayout->addWidget(minBtn); if ( m_flag & CLOSE_BUTTON ) tbLayout->addWidget(m_closeBtn); tb->setLayout(tbLayout); layout->addWidget(tb); }
void FileToolBar::rebuildRecentFileMenu() { QToolButton* tb = dynamic_cast<QToolButton*>(widgetForAction(parent->scrActions["fileOpen"])); QMenu *m=new QMenu(this); ScrAction *recentFileAction; foreach (recentFileAction, parent->scrRecentFileActions) m->addAction(recentFileAction); tb->setMenu(m); // tb->setPopupMode(QToolButton::MenuButtonPopup); tb->setPopupMode(QToolButton::DelayedPopup); }
void AudioLevelsWidget::setupMenus() { this->contextMenuAudioLevelsDropdown = new QMenu(this); this->contextMenuAudioLevelsDropdown->setTitle("Dropdown"); this->expandCollapseAction = this->contextMenuAudioLevelsDropdown->addAction(/*QIcon(":/Graphics/Images/Collapse.png"),*/ "Collapse", this, SLOT(toggleExpandCollapse())); QToolButton* toolButtonAudioLevelsDropdown = new QToolButton(this); toolButtonAudioLevelsDropdown->setObjectName("toolButtonAudioLevelsDropdown"); toolButtonAudioLevelsDropdown->setMenu(this->contextMenuAudioLevelsDropdown); toolButtonAudioLevelsDropdown->setPopupMode(QToolButton::InstantPopup); this->tabWidgetAudioLevels->setCornerWidget(toolButtonAudioLevelsDropdown); //this->tabWidgetPreview->setTabIcon(0, QIcon(":/Graphics/Images/TabSplitter.png")); }
void MainWindow::addMenu(QMenu *menu) { QToolButton *toolButton = new QToolButton(_toolBar); toolButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding); toolButton->setText(menu->title()); toolButton->setMenu(menu); toolButton->setPopupMode(QToolButton::InstantPopup); toolButton->setStyleSheet("QToolButton::menu-indicator { width: 0px; }"); _toolBar->insertWidget(_spacerAction, toolButton); connect(toolButton, SIGNAL(triggered(QAction*)), this, SIGNAL(signalActionTriggered(QAction*))); }
FileToolBar::FileToolBar(ScribusMainWindow* p) : ScToolBar( tr("File"), "File", p) { parent=p; addAction(p->scrActions["fileNew"]); addAction(p->scrActions["fileOpen"]); addAction(p->scrActions["fileSave"]); addAction(p->scrActions["fileClose"]); addAction(p->scrActions["filePrint"]); addAction(p->scrActions["toolsPreflightVerifier"]); addAction(p->scrActions["fileExportAsPDF"]); fileOpenButtonMenu = new QMenu(); QToolButton* tb = dynamic_cast<QToolButton*>(widgetForAction(parent->scrActions["fileOpen"])); tb->setMenu(fileOpenButtonMenu); tb->setPopupMode(QToolButton::DelayedPopup); }
Core::NavigationView FolderNavigationWidgetFactory::createWidget() { Core::NavigationView n; FolderNavigationWidget *fnw = new FolderNavigationWidget; n.widget = fnw; QToolButton *filter = new QToolButton; filter->setIcon(QIcon(QLatin1String(Core::Constants::ICON_FILTER))); filter->setToolTip(tr("Filter Files")); filter->setPopupMode(QToolButton::InstantPopup); filter->setProperty("noArrow", true); QMenu *filterMenu = new QMenu(filter); filterMenu->addAction(fnw->m_filterHiddenFilesAction); filter->setMenu(filterMenu); n.dockToolBarWidgets << filter << fnw->m_toggleSync; return n; }
QWidget * createWidget (QWidget * pParent) { QToolButton * pToolButton = new QToolButton(pParent); pToolButton->setToolButtonStyle(Qt::ToolButtonTextOnly); pToolButton->setPopupMode(QToolButton::InstantPopup); pToolButton->setMinimumHeight(TOOLBAR_MIN_HEIGHT); pToolButton->setMinimumWidth(100); QMenu * pMenu = new QMenu(pToolButton); pMenu->addMenu(tr("Textured")); pMenu->addMenu(tr("Wireframe")); pMenu->addMenu(tr("Tex-Wir")); pToolButton->setMenu(pMenu); return pToolButton; }
bool StatusBar::load(CoreI *core) { menuMapper = new QSignalMapper(this); connect(menuMapper, SIGNAL(mapped(QObject *)), this, SLOT(actionTriggered(QObject *))); core_i = core; if((main_win_i = (MainWindowI *)core_i->get_interface(INAME_MAINWINDOW)) == 0) return false; if((icons_i = (IconsI *)core_i->get_interface(INAME_ICONS)) == 0) return false; if((accounts_i = (AccountsI *)core_i->get_interface(INAME_ACCOUNTS)) == 0) return false; if((menus_i = (MenusI *)core_i->get_interface(INAME_MENUS)) == 0) return false; if((events_i = (EventsI *)core_i->get_interface(INAME_EVENTS)) == 0) return false; events_i->add_event_listener(this, UUID_ACCOUNT_CHANGED); status_bar = new QStatusBar(); main_win_i->set_status_bar(status_bar); toolbuttons = new QWidget(status_bar); toolbuttons->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding); toolButtonLayout = new QHBoxLayout(toolbuttons); toolButtonLayout->setSpacing(6); toolButtonLayout->setMargin(4); toolbuttons->setLayout(toolButtonLayout); status_bar->addWidget(toolbuttons); QToolButton *tb = new QToolButton(); tb->setIcon(icons_i->get_icon("generic")); tb->setToolTip("Global Status"); QMenu *menu = menus_i->get_menu("Global Status"); //connect(proto, SIGNAL(local_status_change(const QString &, const QString &, GlobalStatus)) , this, SLOT(local_status_change(const QString &, const QString &, GlobalStatus))); each_contact_status(gs) { QAction *a = menus_i->add_menu_action("Global Status", hr_status_name[gs], status_name[gs]); a->setData(gs); connect(a, SIGNAL(triggered()), menuMapper, SLOT(map())); menuMapper->setMapping(a, a); } menus_i->add_menu_action("Global Status", "Global Status", "generic"); menus_i->add_menu_separator("Global Status", menu->actions().at(1)); tb->setMenu(menu); tb->setPopupMode(QToolButton::InstantPopup); tb->hide(); status_bar->addPermanentWidget(tb); globalButton = tb; return true; }
void DarkSilkGUI::createToolBars() { QLabel* header = new QLabel(); header->setMinimumSize(48, 48); header->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); header->setPixmap(QPixmap(":/icons/darksilk")); header->setMaximumSize(48, 48); header->setScaledContents(true); toolbar = new QToolBar(tr("Tabs toolbar")); toolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); toolbar->setContextMenuPolicy(Qt::PreventContextMenu); toolbar->setObjectName("tabs"); toolbar->setStyleSheet("#tabs { background-color: qradialgradient(cx: -0.8, cy: 0, fx: -0.8, fy: 0, radius: 0.6, stop: 0 #000000, stop: 1 #000000); }"); toolbar->addWidget(header); QMenu *toolbarMenu = new QMenu(); toolbarMenu->addAction(overviewAction); toolbarMenu->addAction(receiveCoinsAction); toolbarMenu->addAction(sendCoinsAction); toolbarMenu->addAction(historyAction); toolbarMenu->addAction(addressBookAction); toolbarMenu->addAction(statisticsAction); toolbarMenu->addAction(blockAction); toolbarMenu->addAction(stormnodeManagerAction); QAction* menuAction = new QAction(QIcon(":/icons/overview"), tr("&Menu"), this); menuAction->setToolTip(tr("Access DarkSilk Wallet Tabs")); menuAction->setCheckable(false); QToolButton* menuToolButton = new QToolButton(); menuToolButton->setToolButtonStyle(Qt::ToolButtonIconOnly); menuToolButton->setMenu(toolbarMenu); menuToolButton->setPopupMode(QToolButton::InstantPopup); menuToolButton->setDefaultAction(menuAction); netLabel = new QLabel(); netLabel->setObjectName("netLabel"); netLabel->setStyleSheet("#netLabel { color: #ffffff; }"); toolbar->addWidget(menuToolButton); toolbar->addWidget(makeToolBarSpacer()); toolbar->addWidget(netLabel); toolbar->setOrientation(Qt::Horizontal); toolbar->setMovable(false); addToolBar(Qt::TopToolBarArea, toolbar); }
QWidget * createWidget (QWidget * pParent) { QToolButton * pToolButton = new QToolButton(pParent); pToolButton->setToolButtonStyle(Qt::ToolButtonTextOnly); pToolButton->setPopupMode(QToolButton::InstantPopup); pToolButton->setMinimumHeight(TOOLBAR_MIN_HEIGHT); pToolButton->setMinimumWidth(80); QMenu * pMenu = new QMenu(pToolButton); pMenu->addMenu(tr("RGB")); pMenu->addMenu(tr("Alpha")); pMenu->addMenu(tr("Overdraw")); pMenu->addMenu(tr("Mipmaps")); pToolButton->setMenu(pMenu); return pToolButton; }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow), conf(), dbm(this, &conf), m_shouldExit(false) { ui->setupUi(this); // Set size and position int dWidth = QApplication::desktop()->availableGeometry().width(); int dHeight = QApplication::desktop()->availableGeometry().height(); resize(dWidth * 75/100, dHeight * 75/100); QRect geom = geometry(); geom.moveCenter(QApplication::desktop()->availableGeometry().center()); this->setGeometry(geom); // Set additional UI sizes QList<int> hsizes, vsizes; hsizes << this->width() / 3 << this->width() * 2 / 3; ui->splitter->setSizes(hsizes); vsizes << this->height() * 2 / 3 << this->height() / 3; ui->splitterFT->setSizes(vsizes); // Add additional UI controls ui->action_importFirefoxBookmarks->setEnabled(false); //Not implemented yet. QMenu* menuFile = new QMenu(" &File "); menuFile->addAction(ui->actionImportUrlsAsBookmarks); menuFile->addSeparator(); menuFile->addAction(ui->action_importFirefoxBookmarks); menuFile->addAction(ui->actionImportFirefoxBookmarksJSONfile); menuFile->addSeparator(); menuFile->addAction(ui->actionSettings); QMenu* menuDebug = new QMenu(" &Debug "); menuDebug->addAction(ui->actionGetMHT); QList<QMenu*> menus = QList<QMenu*>() << menuFile << menuDebug; foreach (QMenu* menu, menus) { QToolButton* btn = new QToolButton(); btn->setText(menu->title()); btn->setMenu(menu); btn->setPopupMode(QToolButton::InstantPopup); //btn->setArrowType(Qt::LeftArrow); btn->setToolButtonStyle(Qt::ToolButtonTextOnly); ui->mainToolBar->addWidget(btn); }
void DlgCustomToolbarsImp::setActionGroup(QAction* action, const QList<QAction*>& group) { // See also ActionGroup::addTo() QList<QWidget*> widgets = action->associatedWidgets(); for (QList<QWidget*>::iterator it = widgets.begin(); it != widgets.end(); ++it) { QToolButton* tb = qobject_cast<QToolButton*>(*it); if (tb) { QMenu* menu = tb->menu(); if (!menu) { tb->setPopupMode(QToolButton::MenuButtonPopup); tb->setObjectName(QString::fromLatin1("qt_toolbutton_menubutton")); QMenu* menu = new QMenu(tb); menu->addActions(group); tb->setMenu(menu); } } } }
FilterWidget::FilterWidget(QWidget *parent) : QLineEdit(parent) , m_patternGroup(new QActionGroup(this)) { setClearButtonEnabled(true); connect(this, SIGNAL(textChanged(QString)), this, SIGNAL(filterChanged())); QMenu *menu = new QMenu(this); m_caseSensitivityAction = menu->addAction(tr("Case Sensitive")); m_caseSensitivityAction->setCheckable(true); connect(m_caseSensitivityAction, SIGNAL(toggled(bool)), this, SIGNAL(filterChanged())); menu->addSeparator(); m_patternGroup->setExclusive(true); QAction *patternAction = menu->addAction("Fixed String"); patternAction->setData(QVariant(int(QRegExp::FixedString))); patternAction->setCheckable(true); patternAction->setChecked(true); m_patternGroup->addAction(patternAction); patternAction = menu->addAction("Regular Expression"); patternAction->setCheckable(true); patternAction->setData(QVariant(int(QRegExp::RegExp2))); m_patternGroup->addAction(patternAction); patternAction = menu->addAction("Wildcard"); patternAction->setCheckable(true); patternAction->setData(QVariant(int(QRegExp::Wildcard))); m_patternGroup->addAction(patternAction); connect(m_patternGroup, SIGNAL(triggered(QAction*)), this, SIGNAL(filterChanged())); const QIcon icon = QIcon(QPixmap(":/images/find.png")); QToolButton *optionsButton = new QToolButton; #ifndef QT_NO_CURSOR optionsButton->setCursor(Qt::ArrowCursor); #endif optionsButton->setFocusPolicy(Qt::NoFocus); optionsButton->setStyleSheet("* { border: none; }"); optionsButton->setIcon(icon); optionsButton->setMenu(menu); optionsButton->setPopupMode(QToolButton::InstantPopup); QWidgetAction *optionsAction = new QWidgetAction(this); optionsAction->setDefaultWidget(optionsButton); addAction(optionsAction, QLineEdit::LeadingPosition); }
void ZLQtApplicationWindow::addToolbarItem(ZLToolbar::ItemPtr item) { QToolBar *tb = toolbar(type(*item)); QAction *action = 0; switch (item->type()) { case ZLToolbar::Item::PLAIN_BUTTON: case ZLToolbar::Item::TOGGLE_BUTTON: action = new ZLQtToolBarAction(this, (ZLToolbar::AbstractButtonItem&)*item); tb->addAction(action); break; case ZLToolbar::Item::MENU_BUTTON: { ZLToolbar::MenuButtonItem &buttonItem = (ZLToolbar::MenuButtonItem&)*item; QToolButton *button = new QToolButton(tb); button->setFocusPolicy(Qt::NoFocus); button->setDefaultAction(new ZLQtToolBarAction(this, buttonItem)); button->setMenu(new QMenu(button)); button->setPopupMode(QToolButton::MenuButtonPopup); action = tb->addWidget(button); myMenuButtons[&buttonItem] = button; shared_ptr<ZLPopupData> popupData = buttonItem.popupData(); myPopupIdMap[&buttonItem] = popupData.isNull() ? (size_t)-1 : (popupData->id() - 1); break; } case ZLToolbar::Item::TEXT_FIELD: case ZLToolbar::Item::SEARCH_FIELD: { ZLToolbar::ParameterItem &textFieldItem = (ZLToolbar::ParameterItem&)*item; LineEditParameter *para = new LineEditParameter(tb, *this, textFieldItem); addVisualParameter(textFieldItem.parameterId(), para); action = para->action(); break; } case ZLToolbar::Item::SEPARATOR: action = tb->addSeparator(); break; } if (action != 0) { myActions[&*item] = action; } }
void GTMainWindow::createToolBars(){ fileToolBar = addToolBar(tr("File")); fileToolBar->setFloatable(false); fileToolBar->setMovable(false); fileToolBar->setIconSize(QSize(25, 25)); fileMenu = new QMenu(); fileMenu->addAction(newAct); fileMenu->addAction(openAct); fileMenu->addAction(saveAct); fileMenu->addAction(closeAct); fileMenu->addSeparator(); fileMenu->addAction(exitAct); QToolButton* toolButton = new QToolButton(); toolButton->setIcon(QIcon(":/Resources/gt_icon.png")); toolButton->setMenu(fileMenu); toolButton->setPopupMode(QToolButton::InstantPopup); fileToolBar->addWidget(toolButton); fileToolBar->addSeparator(); fileToolBar->addAction(newAct); fileToolBar->addAction(openAct); fileToolBar->addAction(saveAct); fileToolBar->addAction(closeAct); fileToolBar->addSeparator(); //ui->gtStatusWidget->setParent(fileToolBar); //ui->gtStatusWidget->setVisible(false); //fileToolBar->addWidget(ui->gtStatusWidget); /*editToolBar = addToolBar(tr("Edit")); editToolBar->addAction(cutAct); editToolBar->addAction(copyAct); editToolBar->addAction(pasteAct);*/ }
void SideDockWidget::createMenu(Qt::DockWidgetArea /*area*/) { // QMenu *moveMenu = new QMenu(tr("Move To"),this); // QAction *act = new QAction(tr("OutputBar"),this); // act->setData(area); // moveMenu->addAction(act); // connect(act,SIGNAL(triggered()),this,SLOT(moveAction())); m_menu = new QMenu(this); QToolButton *btn = new QToolButton(m_toolBar); btn->setPopupMode(QToolButton::InstantPopup); btn->setIcon(QIcon("icon:images/movemenu.png")); btn->setMenu(m_menu); btn->setText(tr("SideBar")); btn->setToolTip(tr("Show SideBar")); btn->setStyleSheet("QToolButton::menu-indicator {image: none;}"); m_toolBar->insertWidget(m_closeAct,btn); }
GuiFindToolBar::GuiFindToolBar(GuiMainWindow *p) : QToolBar(p), mainWnd(p) { searchedText = new QLineEdit(); findTextFlag = false; currentRow = -1; currentCol = -1; pageStartPosition = 0; QToolButton *b; currentSearchedText = ""; addWidget(searchedText); searchedText->installEventFilter(this); b = new QToolButton(this); b->setText("Up"); connect(b, SIGNAL(clicked()), this, SLOT(on_findUp())); addWidget(b); b = new QToolButton(this); b->setText("Down"); connect(b, SIGNAL(clicked()), this, SLOT(on_findDown())); addWidget(b); b = new QToolButton(this); b->setIcon(QIcon(":/images/cog_alt_16x16.png")); b->setMenu(p->menuGetMenuById(MENU_FIND_OPTIONS)); b->setPopupMode(QToolButton::InstantPopup); addWidget(b); b = new QToolButton(this); b->setIcon(QIcon(":/images/x_14x14.png")); connect(b, SIGNAL(clicked()), this, SLOT(on_findClose())); addWidget(b); setIconSize(QSize(16, 16)); setMovable(false); setAutoFillBackground(true); adjustSize(); searchedText->setFocus(); }