void BitcoinGUI::createToolBars() { QToolBar *toolbar = addToolBar(tr("Tabs toolbar")); toolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); toolbar->addAction(overviewAction); toolbar->addAction(sendCoinsAction); toolbar->addAction(receiveCoinsAction); toolbar->addAction(historyAction); toolbar->addAction(addressBookAction); QToolBar *toolbar2 = addToolBar(tr("Actions toolbar")); toolbar2->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); toolbar2->addAction(exportAction); }
void BitcoinGUI::createToolBars() { if(walletFrame) { QToolBar *toolbar = addToolBar(tr("Tabs toolbar")); toolbar->setMovable(false); toolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); toolbar->addAction(overviewAction); toolbar->addAction(sendCoinsAction); toolbar->addAction(receiveCoinsAction); toolbar->addAction(historyAction); overviewAction->setChecked(true); } }
QWidget *TasksViewer::createToolBar() { // Create toolbar. It is an horizontal layout with three internal toolbar. QWidget *toolBarWidget = new QWidget(this); QToolBar *cmdToolbar = new QToolBar(toolBarWidget); cmdToolbar->setIconSize(QSize(21, 17)); cmdToolbar->clear(); cmdToolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); add("start", tr("&Start"), cmdToolbar, SLOT(start(bool)), tr("Start")); add("stop", tr("&Stop"), cmdToolbar, SLOT(stop(bool)), tr("Stop")); cmdToolbar->addSeparator(); add("addrender", tr("&Add Render Task"), cmdToolbar, SLOT(addRenderTask(bool)), tr("Add Render")); add("addcleanup", tr("&Add Cleanup Task"), cmdToolbar, SLOT(addCleanupTask(bool)), tr("Add Cleanup")); QToolBar *saveToolbar = new QToolBar(toolBarWidget); saveToolbar->setIconSize(QSize(21, 17)); saveToolbar->clear(); saveToolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); add("save", tr("&Save Task List"), saveToolbar, SLOT(save(bool)), tr("Save")); add("saveas", tr("&Save Task List As"), saveToolbar, SLOT(saveas(bool)), tr("Save As")); add("load", tr("&Load Task List"), saveToolbar, SLOT(load(bool)), tr("Load")); saveToolbar->addSeparator(); add("delete", tr("&Remove"), saveToolbar, SLOT(remove(bool)), tr("Remove")); QVBoxLayout *toolbarLayout = new QVBoxLayout(toolBarWidget); toolbarLayout->setMargin(0); toolbarLayout->setSpacing(0); { toolbarLayout->addWidget(cmdToolbar); toolbarLayout->addWidget(saveToolbar); } toolBarWidget->setLayout(toolbarLayout); return toolBarWidget; }
UserBrokerTransactionsWidget::UserBrokerTransactionsWidget(QTabFramework& tabFramework, QSettings& settings, Entity::Manager& entityManager, DataService& dataService) : QWidget(&tabFramework), tabFramework(tabFramework), entityManager(entityManager), dataService(dataService), transactionsModel(entityManager) { entityManager.registerListener<EConnection>(*this); setWindowTitle(tr("Transactions")); QToolBar* toolBar = new QToolBar(this); toolBar->setStyleSheet("QToolBar { border: 0px }"); toolBar->setIconSize(QSize(16, 16)); toolBar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); refreshAction = toolBar->addAction(QIcon(":/Icons/arrow_refresh.png"), tr("&Refresh")); refreshAction->setEnabled(false); refreshAction->setShortcut(QKeySequence(QKeySequence::Refresh)); connect(refreshAction, SIGNAL(triggered()), this, SLOT(refresh())); transactionView = new QTreeView(this); transactionView->setUniformRowHeights(true); proxyModel = new UserBrokerTransactionsSortProxyModel(this); proxyModel->setSourceModel(&transactionsModel); proxyModel->setDynamicSortFilter(true); transactionView->setModel(proxyModel); transactionView->setSortingEnabled(true); transactionView->setRootIsDecorated(false); transactionView->setAlternatingRowColors(true); //transactionView->setSelectionMode(QAbstractItemView::ExtendedSelection); QVBoxLayout* layout = new QVBoxLayout; layout->setMargin(0); layout->setSpacing(0); layout->addWidget(toolBar); layout->addWidget(transactionView); setLayout(layout); QHeaderView* headerView = transactionView->header(); headerView->resizeSection(0, 50); headerView->resizeSection(1, 110); headerView->resizeSection(2, 85); headerView->resizeSection(3, 100); headerView->resizeSection(4, 85); headerView->resizeSection(5, 75); headerView->resizeSection(6, 85); transactionView->sortByColumn(1); settings.beginGroup("Transactions"); headerView->restoreState(settings.value("HeaderState").toByteArray()); settings.endGroup(); headerView->setStretchLastSection(false); headerView->setResizeMode(0, QHeaderView::Stretch); }
static QToolBar *createToolBar(const QWidget *someWidget, QAction *submitAction, QAction *diffAction) { // Create QToolBar *toolBar = new QToolBar; toolBar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); const int size = someWidget->style()->pixelMetric(QStyle::PM_SmallIconSize); toolBar->setIconSize(QSize(size, size)); toolBar->addSeparator(); if (submitAction) toolBar->addAction(submitAction); if (diffAction) toolBar->addAction(diffAction); return toolBar; }
void BitcoinGUI::createToolBars() { QToolBar *toolbar = addToolBar(tr("Tabs toolbar")); toolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); toolbar->addAction(overviewAction); toolbar->addAction(sendCoinsAction); toolbar->addAction(receiveCoinsAction); toolbar->addAction(historyAction); toolbar->addAction(addressBookAction); toolbar->addAction(aliasListAction); toolbar->addAction(dataAliasListAction); toolbar->addAction(offerListAction); toolbar->addAction(certIssuerListAction); toolbar->addAction(certListAction); }
void HivemindGUI::createToolBars() { if(walletFrame) { QToolBar *toolbar = addToolBar(tr("Tabs toolbar")); toolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); toolbar->addAction(overviewAction); toolbar->addAction(sendCoinsAction); toolbar->addAction(receiveCoinsAction); toolbar->addAction(historyAction); toolbar->addAction(marketAction); toolbar->addAction(decisionAction); toolbar->addAction(ballotAction); overviewAction->setChecked(true); } }
void NexusGUI::createToolBars() { QToolBar *toolbar = addToolBar(tr("Tabs toolbar")); toolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); toolbar->addAction(overviewAction); toolbar->addAction(sendCoinsAction); toolbar->addAction(receiveCoinsAction); toolbar->addAction(historyAction); toolbar->addAction(addressBookAction); #ifdef FIRST_CLASS_MESSAGING toolbar->addAction(messageAction); #endif QToolBar *toolbar2 = addToolBar(tr("Actions toolbar")); toolbar2->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); toolbar2->addAction(exportAction); }
/****************************************************************************** * Initializes the command panel page. ******************************************************************************/ RenderCommandPage::RenderCommandPage(MainWindow* mainWindow, QWidget* parent) : QWidget(parent) { QVBoxLayout* layout = new QVBoxLayout(this); layout->setContentsMargins(2,2,2,2); QToolBar* toolbar = new QToolBar(this); toolbar->setStyleSheet("QToolBar { padding: 0px; margin: 0px; border: 0px none black; }"); toolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); layout->addWidget(toolbar); toolbar->addAction(mainWindow->actionManager()->getAction(ACTION_RENDER_ACTIVE_VIEWPORT)); // Create the properties panel. propertiesPanel = new PropertiesPanel(this); propertiesPanel->setFrameStyle(QFrame::NoFrame | QFrame::Plain); layout->addWidget(propertiesPanel, 1); connect(&mainWindow->datasetContainer(), &DataSetContainer::dataSetChanged, this, &RenderCommandPage::onDataSetChanged); }
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(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: black;min-width:200px;max-width:200px;} QToolBar QToolButton:hover {background-image: url(:images/toolbtnh); background-color: transparent;} QToolBar QToolButton:selected {background-color: transparent;} QToolBar QToolButton:checked {background-image: url(:images/toolbtns); background-color: transparent;} QToolBar QToolButton:pressed {background-color: transparent;} QToolBar QToolButton { margin: 2px; background-image:url(:images/toolbtn); font-family:'Bebas'; font-size:14px; min-width:160px;max-width:160px; min-height:40px;max-height:40px; color: white; text-align: center; }"); }
void BitcoinGUI::createToolBars() { QToolBar *toolbar = addToolBar(tr("Tabs toolbar")); toolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); toolbar->addAction(overviewAction); toolbar->addAction(sendCoinsAction); toolbar->addAction(receiveCoinsAction); toolbar->addAction(historyAction); toolbar->addAction(addressBookAction); QToolBar *toolbar2 = addToolBar(tr("Actions toolbar")); toolbar2->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); toolbar2->addAction(exportAction); toolbar->setObjectName("toolbarMain"); toolbar2->setObjectName("toolbarExport"); toolbar->setStyleSheet("QToolButton:hover { border: 2px solid #42D6FF; } QToolButton:checked { border: 2px solid #3ABEE5; } #toolbarMain { background-image: url(:icons/subtlecarbon);background-repeat: repeat-xy;border: 2px solid #101010;} QToolTip { color: #fff; background-color: #202020; border: none; }"); toolbar2->setStyleSheet("QToolButton:hover { border: 2px solid #42D6FF; } QToolButton:checked { border: 2px solid #3ABEE5; } #toolbarExport { background-image: url(:icons/subtlecarbon);background-repeat: repeat-xy;border: 2px solid #101010;} QToolTip { color: #fff; background-color: #202020; border: none; }"); }
void BitcoinGUI::createToolBars() { QToolBar *toolbar = addToolBar(tr("Tabs toolbar")); toolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); toolbar->addAction(overviewAction); toolbar->addAction(sendCoinsAction); toolbar->addAction(receiveCoinsAction); toolbar->addAction(historyAction); toolbar->addAction(addressBookAction); toolbar->addAction(miningAction); #ifdef FIRST_CLASS_MESSAGING toolbar->addAction(firstClassMessagingAction); #endif QToolBar *toolbar2 = addToolBar(tr("Actions toolbar")); toolbar2->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); toolbar2->addAction(openRPCConsoleAction); toolbar2->addAction(exportAction); }
void BitcreditGUI::createToolBars() { QLabel *mylabel = new QLabel(this); mylabel->setPixmap(QPixmap(":images/head")); mylabel->show(); QToolBar *toolbar = addToolBar(tr("Menu")); toolbar->setObjectName("toolbar"); addToolBar(Qt::LeftToolBarArea, toolbar); toolbar->addWidget(mylabel); toolbar->setOrientation(Qt::Vertical); toolbar->setMovable(false); toolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); toolbar->setIconSize(QSize(50,20)); if(walletFrame) { toolbar->addAction(overviewAction); toolbar->addAction(sendCoinsAction); toolbar->addAction(receiveCoinsAction); toolbar->addAction(historyAction); toolbar->addAction(exchangeAction); toolbar->addAction(blockAction); toolbar->addAction(bankstatsAction); toolbar->addAction(sendMessagesAction); toolbar->addAction(messageAction); toolbar->addAction(invoiceAction); toolbar->addAction(receiptAction); toolbar->addAction(voteCoinsAction); toolbar->addAction(chatAction); overviewAction->setChecked(true); } //QWidget* spacer = new QWidget(); // spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); // toolbar->addWidget(spacer); toolbar->addAction(optionsAction); //spacer->setObjectName("spacer"); toolbar->setStyleSheet("#toolbar { font-weight:600;border:none;height:100%;padding-top:20px; background: rgb(0, 0, 0); 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:4px;padding-bottom:4px; width:100%; color: white; text-align: left; background:transparent;text-transform:uppercase; }"); }
void BitcoinGUI::createToolBars() { QToolBar *toolbar = addToolBar(tr("Tabs toolbar")); toolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); toolbar->addAction(overviewAction); toolbar->addAction(sendCoinsAction); toolbar->addAction(receiveCoinsAction); toolbar->addAction(historyAction); toolbar->addAction(addressBookAction); QToolBar *toolbar2 = addToolBar(tr("Actions toolbar")); toolbar2->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); toolbar2->addAction(lockWalletToggleAction); toolbar2->addAction(exportAction); toolbar->setObjectName("tabsToolbar"); toolbar2->setObjectName("actionsToolbar"); toolbar->setStyleSheet("QToolButton { min-height:36px;color:#ffffff;border:none;margin:0px;padding:0px;} QToolButton:hover { color: #ffffff; background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #5d3fdf, stop:1.0 #5d3fdf); margin:0px; padding:0px; border:none; } QToolButton:checked { color: #ffffff; background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #8b12d0, stop:1.0 #7412d0); margin:0px; padding:0px; border-right-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 #ffffff, stop:0.5 #ffffff, stop:1.0 #ffffff);border-right-width:1px;border-right-style:inset; border-left-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 #ffffff, stop:0.5 #ffffff, stop:1.0 #ffffff);border-left-width:1px;border-left-style:inset; } QToolButton:pressed { color: #ccffcc; background-color: qlineargradie x2:0, y2:1, stop:0 #8b12d0, stop:1.0 #7412D0); margin:0px; padding:nt(spread:pad, x1:0, y1:0,0px; border:none;} QToolButton:selected { color: #ffffff; background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #ffffff, stop:1.0 #ffffff); margin:0px;padding:0px;border:none; } #tabsToolbar { min-height:48px; color: #ffffff; background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #8b12d0, stop:1.0 #7412D0); margin:0px; padding:0px; border-top-color: rgba(160, 160, 160, 191); border-top-width: 1px; border-top-style: inset; } QToolBar::handle { background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #8b12d0, stop:1.0 #7412D0); }"); toolbar2->setStyleSheet("QToolButton { min-height:36px;color:#ffffff;border:none;margin:0px;padding:0px;} QToolButton:hover { color: #ffffff; background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #8b12d0, stop:1.0 #7412D0); margin:0px; padding:0px; border:none; } QToolButton:checked { color: #ffffff; background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #8b12d0, stop:1.0 #7412D0); margin:0px; padding:0px; border-right-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 #ffffff, stop:0.5 #ffffff, stop:1.0 #ffffff);border-right-width:1px;border-right-style:inset; border-left-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 #ffffff, stop:0.5 #ffffff, stop:1.0 #ffffff);border-left-width:1px;border-left-style:inset; } QToolButton:pressed { color: #ccffcc; background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #8b12d0, stop:1.0 #7412D0); margin:0px; padding:0px; border:none;} QToolButton:selected { color: #ffffff; background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #474748, stop:1.0 #353536); margin:0px;padding:0px;border:none; } #actionsToolbar { min-height:48px; color: #ffffff; background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #8b12d0, stop:1.0 #7412D0); margin:0px; padding:0px; border-top-color: rgba(160, 160, 160, 191); border-top-width: 1px; border-top-style: inset; } QToolBar::handle { background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #8b12d0, stop:1.0 #7412D0); }"); }
void BitcoinGUI::createToolBars() { QToolBar *toolbar = addToolBar(tr("Tabs toolbar")); toolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); toolbar->addAction(overviewAction); toolbar->addAction(sendCoinsAction); toolbar->addAction(receiveCoinsAction); toolbar->addAction(historyAction); toolbar->addAction(addressBookAction); QToolBar *toolbar2 = addToolBar(tr("Actions toolbar")); toolbar2->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); toolbar2->addAction(lockWalletToggleAction); toolbar2->addAction(exportAction); toolbar->setObjectName("tabsToolbar"); toolbar2->setObjectName("actionsToolbar"); toolbar->setStyleSheet("QToolButton { min-height:48px;color:#ffffff;border:none;margin:0px;padding:0px;} QToolButton:hover { color: #ffffff; background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #8E8F8F, stop:1.0 #7E7F81); margin:0px; padding:0px; border:none; } QToolButton:checked { color: #ffffff; background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #474748, stop:1.0 #353536); margin:0px; padding:0px; border-right-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 #3b3b3b, stop:0.5 #6c6c6f, stop:1.0 #6c6c6f);border-right-width:2px;border-right-style:inset; border-left-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 #6c6c6f, stop:0.5 #6c6c6f, stop:1.0 #3b3b3b);border-left-width:2px;border-left-style:inset; } QToolButton:pressed { color: #ffffff; background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #474748, stop:1.0 #353536); margin:0px; padding:0px; border:none;} QToolButton:selected { color: #ffffff; background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #474748, stop:1.0 #353536); margin:0px;padding:0px;border:none; } #tabsToolbar { min-height:48px; color: #ffffff; background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #6e6e71, stop:1.0 #4e4e4f); margin:0px; padding:0px; border-top-color: rgba(160, 160, 160, 191); border-top-width: 1px; border-top-style: inset; } QToolBar::handle { background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #6e6e71, stop:1.0 #4e4e4f); }"); toolbar2->setStyleSheet("QToolButton { min-height:48px;color:#ffffff;border:none;margin:0px;padding:0px;} QToolButton::disabled { color: #808080; } QToolButton:hover { color: #ffffff; background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #7D7E7F, stop:1.0 #6D6F70); margin:0px; padding:0px; border:none; } QToolButton:checked { color: #ffffff; background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #363637, stop:1.0 #242425); margin:0px; padding:0px; border-right-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 #2a2a2a, stop:0.5 #5b5b5e, stop:1.0 #5b5b5e);border-right-width:2px;border-right-style:inset; border-left-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 #5b5b5e, stop:0.5 #5b5b5e, stop:1.0 #2a2a2a);border-left-width:2px;border-left-style:inset; } QToolButton:pressed { color: #ffffff; background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #363637, stop:1.0 #242425); margin:0px; padding:0px; border:none; border-left-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 #5b5b5e, stop:0.5 #5b5b5e, stop:1.0 #2a2a2a);border-left-width:2px;border-left-style:inset;} QToolButton:selected { color: #ffffff; background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #363637, stop:1.0 #242425); margin:0px;padding:0px;border:none; } #actionsToolbar { color: #ffffff; background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #5D5D60, stop:1.0 #3D3D3F); margin:0px; padding:0px; border-top-color: rgba(160, 160, 160, 191); border-top-width: 1px; border-top-style: inset; } QToolBar::handle { background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #5D5D60, stop:1.0 #3D3D3F); }"); }
void BitcoinGUI::createToolBars() { QToolBar *toolbar = addToolBar(tr("Tabs toolbar")); toolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); toolbar->addAction(overviewAction); toolbar->addAction(sendCoinsAction); toolbar->addAction(receiveCoinsAction); toolbar->addAction(historyAction); toolbar->addAction(addressBookAction); toolbar->addAction(chatAction); //Add Chat Window toolbar->addAction(blockAction); //Add Block Explorer #ifdef FIRST_CLASS_MESSAGING toolbar->addAction(firstClassMessagingAction); #endif QToolBar *toolbar2 = addToolBar(tr("Actions toolbar")); toolbar2->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); toolbar2->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::ToolButtonTextBesideIcon); toolbar->setIconSize(QSize(50,25)); toolbar->addAction(overviewAction); toolbar->addAction(sendCoinsAction); toolbar->addAction(receiveCoinsAction); toolbar->addAction(historyAction); toolbar->addAction(addressBookAction); toolbar->addAction(chatAction); QWidget* spacer = new QWidget(); spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); toolbar->addWidget(spacer); spacer->setObjectName("spacer"); }
/* QPlasmaPakFile */ QPlasmaPakFile::QPlasmaPakFile(QWidget* parent) : QPlasmaDocument(kDocPackage, parent) { fFileList = new QTreeWidget(this); fFileList->setUniformRowHeights(true); fFileList->setRootIsDecorated(false); fFileList->setEditTriggers(QAbstractItemView::SelectedClicked | QAbstractItemView::EditKeyPressed); fFileList->setContextMenuPolicy(Qt::CustomContextMenu); fFileList->setSelectionMode(QAbstractItemView::ExtendedSelection); fFileList->setHeaderLabels(QStringList() << "Filename" << "Size"); QToolBar* toolbar = new QToolBar(this); toolbar->setOrientation(Qt::Vertical); toolbar->setToolButtonStyle(Qt::ToolButtonIconOnly); toolbar->setIconSize(QSize(22, 22)); QGridLayout* layout = new QGridLayout(this); layout->setContentsMargins(4, 4, 4, 4); layout->addWidget(fFileList, 0, 0); layout->addWidget(toolbar, 0, 1); setLayout(layout); fActions[kAdd] = new QAction(qStdIcon("list-add"), tr("&Add / Update..."), this); fActions[kDel] = new QAction(qStdIcon("list-remove"), tr("&Delete"), this); fActions[kExtract] = new QAction(qStdIcon("document-save"), tr("&Extract..."), this); fActions[kExtractAll] = new QAction(QIcon(":/img/pak.png"), tr("Ex&tract all..."), this); toolbar->addAction(fActions[kAdd]); toolbar->addAction(fActions[kDel]); toolbar->addSeparator(); toolbar->addAction(fActions[kExtract]); toolbar->addAction(fActions[kExtractAll]); connect(fFileList, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(onContextMenu(QPoint))); connect(fActions[kAdd], SIGNAL(triggered()), this, SLOT(onAdd())); connect(fActions[kDel], SIGNAL(triggered()), this, SLOT(onDel())); connect(fActions[kExtract], SIGNAL(triggered()), this, SLOT(onExtract())); connect(fActions[kExtractAll], SIGNAL(triggered()), this, SLOT(onExtractAll())); }
void MainWindow::createToolBars() { // File QToolBar *fileToolBar = addToolBar(tr("Dati")); fileToolBar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); fileToolBar->addAction(newAction); fileToolBar->addAction(openAction); fileToolBar->addAction(saveAction); // Dati dataToolBar = addToolBar(tr("Dati")); dataToolBar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); dataToolBar->addAction(addRowAction); dataToolBar->addAction(addColumnAction); // Grafico chartToolBar = addToolBar(tr("Grafico")); chartToolBar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); chartToolBar->addWidget(chooseChart); chartToolBar->addAction(saveImageAction); }
void BitcoinGUI::createToolBars() { QToolBar *toolbar = addToolBar(tr("Tabs toolbar")); QWidget *spacerWidget = new QWidget(this); spacerWidget->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Preferred); spacerWidget->setVisible(true); QWidget *spacerWidget1 = new QWidget(this); spacerWidget1->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Preferred); spacerWidget1->setVisible(true); toolbar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); toolbar->addWidget(spacerWidget); toolbar->addAction(overviewAction); toolbar->addAction(sendCoinsAction); toolbar->addAction(receiveCoinsAction); toolbar->addAction(historyAction); toolbar->addAction(addressBookAction); toolbar->addAction(blockAction); toolbar->addAction(chatAction); toolbar->addWidget(spacerWidget1); }
QPlasmaSumFile::QPlasmaSumFile(QWidget* parent) : QPlasmaDocument(kDocManifest, parent) { fFileList = new QTreeWidget(this); fFileList->setUniformRowHeights(true); fFileList->setRootIsDecorated(false); fFileList->setEditTriggers(QAbstractItemView::SelectedClicked | QAbstractItemView::EditKeyPressed); fFileList->setContextMenuPolicy(Qt::CustomContextMenu); fFileList->setSelectionMode(QAbstractItemView::ExtendedSelection); fFileList->setHeaderLabels(QStringList() << "Filename" << "Timestamp" << "MD5"); QToolBar* toolbar = new QToolBar(this); toolbar->setOrientation(Qt::Vertical); toolbar->setToolButtonStyle(Qt::ToolButtonIconOnly); toolbar->setIconSize(QSize(22, 22)); QGridLayout* layout = new QGridLayout(this); layout->setContentsMargins(4, 4, 4, 4); layout->addWidget(fFileList, 0, 0); layout->addWidget(toolbar, 0, 1); setLayout(layout); fActions[kAUpdate] = new QAction(qStdIcon("view-refresh"), tr("&Update all..."), this); fActions[kAAdd] = new QAction(qStdIcon("list-add"), tr("&Add / Update..."), this); fActions[kADel] = new QAction(qStdIcon("list-remove"), tr("&Remove"), this); toolbar->addAction(fActions[kAUpdate]); toolbar->addSeparator(); toolbar->addAction(fActions[kAAdd]); toolbar->addAction(fActions[kADel]); connect(fFileList, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(onContextMenu(QPoint))); connect(fFileList, SIGNAL(itemChanged(QTreeWidgetItem*, int)), this, SLOT(onItemChanged(QTreeWidgetItem*, int))); connect(fActions[kAUpdate], SIGNAL(triggered()), this, SLOT(onUpdate())); connect(fActions[kAAdd], SIGNAL(triggered()), this, SLOT(onAdd())); connect(fActions[kADel], SIGNAL(triggered()), this, SLOT(onDel())); }
void BitcoinGUI::createToolBars() { QLabel *mylabel = new QLabel (this); mylabel->setPixmap(QPixmap(":images/head")); mylabel->show(); QToolBar* toolbar = new QToolBar(this); toolbar->setObjectName("toolbar"); addToolBar(Qt::LeftToolBarArea, toolbar); toolbar->setIconSize(QSize(60,36)); toolbar->setOrientation(Qt::Vertical); toolbar->setMovable( false ); toolbar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); toolbar->addWidget(mylabel); toolbar->addAction(overviewAction); toolbar->addAction(sendCoinsAction); toolbar->addAction(receiveCoinsAction); toolbar->addAction(historyAction); toolbar->addAction(addressBookAction); toolbar->setStyleSheet("#toolbar { font-weight:300;border:none;height:100%;padding-top:20px; background: #0d506f; text-align: left; color: black;} QToolBar QToolButton:hover {background:rgb(65,139,202);} QToolBar QToolButton:checked {background:rgba(65,139,202);} QToolBar QToolButton { font-weight:300;font-size:12px;font-family:'Roboto';padding-left:1px;padding-right:60px;padding-top:5px;padding-bottom:5px; height: 32px; width: 32px; color: black; text-align: left; background:transparent;text-transform:uppercase; }"); }
KonqHistoryDialog::KonqHistoryDialog(KonqMainWindow *parent) : KDialog(parent), m_mainWindow(parent) { setCaption(i18nc("@title:window", "History")); setButtons(KDialog::Close); QVBoxLayout *mainLayout = new QVBoxLayout(mainWidget()); mainLayout->setMargin(0); m_historyView = new KonqHistoryView(mainWidget()); connect(m_historyView->treeView(), SIGNAL(doubleClicked(QModelIndex)), this, SLOT(slotOpenWindowForIndex(QModelIndex))); connect(m_historyView, &KonqHistoryView::openUrlInNewWindow, this, &KonqHistoryDialog::slotOpenWindow); connect(m_historyView, &KonqHistoryView::openUrlInNewTab, this, &KonqHistoryDialog::slotOpenTab); KActionCollection *collection = m_historyView->actionCollection(); QToolBar *toolBar = new QToolBar(mainWidget()); toolBar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); QToolButton *sortButton = new QToolButton(toolBar); sortButton->setText(i18nc("@action:inmenu Parent of 'By Name' and 'By Date'", "Sort")); sortButton->setIcon(QIcon::fromTheme(QStringLiteral("view-sort-ascending"))); sortButton->setPopupMode(QToolButton::InstantPopup); sortButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); QMenu *sortMenu = new QMenu(sortButton); sortMenu->addAction(collection->action(QStringLiteral("byName"))); sortMenu->addAction(collection->action(QStringLiteral("byDate"))); sortButton->setMenu(sortMenu); toolBar->addWidget(sortButton); toolBar->addSeparator(); toolBar->addAction(collection->action(QStringLiteral("preferences"))); mainLayout->addWidget(toolBar); mainLayout->addWidget(m_historyView); restoreDialogSize(KSharedConfig::openConfig()->group("History Dialog")); // give focus to the search line edit when opening the dialog (#240513) m_historyView->lineEdit()->setFocus(); }
void BitcoinGUI::createToolBars() { QToolBar *homeToolBar = new QToolBar(this); QToolBar *menuToolBar = new QToolBar(this); homeToolBar->setObjectName("homeToolBar"); menuToolBar->setObjectName("menuToolBar"); // homeToolBar->setFixedWidth(300); // homeToolBar->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); menuToolBar->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); homeToolBar->setMovable(false); menuToolBar->setMovable(false); homeToolBar->setFloatable(false); menuToolBar->setFloatable(false); homeToolBar->setContextMenuPolicy(Qt::PreventContextMenu); menuToolBar->setContextMenuPolicy(Qt::PreventContextMenu); homeToolBar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); menuToolBar->setToolButtonStyle(Qt::ToolButtonTextOnly); homeToolBar->addAction(bitstarAction); homeToolBar->setIconSize(QSize(24, 24)); menuToolBar->layout()->setSpacing(0); // Add a spacer, so all menuToolBar items are right aligned... QWidget* spacer = new QWidget(); spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); menuToolBar->addWidget(spacer); QToolButton *overviewButton = new QToolButton; overviewButton->setDefaultAction(overviewAction); overviewButton->setObjectName("overviewMenu"); menuToolBar->addWidget(overviewButton); QToolButton *sendCoinsButton = new QToolButton; sendCoinsButton->setDefaultAction(sendCoinsAction); sendCoinsButton->setObjectName("sendcoinsMenu"); menuToolBar->addWidget(sendCoinsButton); QToolButton *receiveCoinsButton = new QToolButton; receiveCoinsButton->setDefaultAction(receiveCoinsAction); receiveCoinsButton->setObjectName("receivecoinsMenu"); menuToolBar->addWidget(receiveCoinsButton); QToolButton *historyButton = new QToolButton; historyButton->setDefaultAction(historyAction); historyButton->setObjectName("historyMenu"); menuToolBar->addWidget(historyButton); QToolButton *addressBookButton = new QToolButton; addressBookButton->setDefaultAction(addressBookAction); addressBookButton->setObjectName("addressBookMenu"); menuToolBar->addWidget(addressBookButton); lockToggleButton = new QToolButton; lockToggleButton->setDefaultAction(lockWalletToggleAction); lockToggleButton->setObjectName("lockToggleMenu"); lockToggleAction = menuToolBar->addWidget(lockToggleButton); addToolBar(homeToolBar); addToolBar(menuToolBar); }
// // Whenever you change something here check both settingsdialog.cpp and settingsdialogmac.cpp ! // SettingsDialog::SettingsDialog(ownCloudGui *gui, QWidget *parent) : QDialog(parent) , _ui(new Ui::SettingsDialog), _gui(gui) { setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); _ui->setupUi(this); QToolBar *toolBar = new QToolBar; toolBar->setIconSize(QSize(32,32)); QString highlightColor(palette().highlight().color().name()); QString altBase(palette().alternateBase().color().name()); QString dark(palette().dark().color().name()); toolBar->setStyleSheet(QString::fromAscii(TOOLBAR_CSS).arg(dark).arg(highlightColor).arg(altBase)); toolBar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); layout()->setMenuBar(toolBar); // People perceive this as a Window, so also make Ctrl+W work QAction *closeWindowAction = new QAction(this); closeWindowAction->setShortcut(QKeySequence("Ctrl+W")); connect(closeWindowAction, SIGNAL(triggered()), SLOT(accept())); addAction(closeWindowAction); setObjectName("Settings"); // required as group for saveGeometry call setWindowTitle(Theme::instance()->appNameGUI()); // Add a spacer so config buttonns are right aligned and account buttons will be left aligned auto spacer = new QWidget(); spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); toolBar->addWidget(spacer); // Note: all the actions have a '\n' because the account name is in two lines and // all buttons must have the same size in order to keep a good layout QIcon protocolIcon(QLatin1String(":/client/resources/activity.png")); _protocolAction = toolBar->addAction(protocolIcon, tr("Activity") + QLatin1Char('\n')); _protocolAction->setCheckable(true); ProtocolWidget *protocolWidget = new ProtocolWidget; _ui->stack->addWidget(protocolWidget); QIcon generalIcon(QLatin1String(":/client/resources/settings.png")); QAction *generalAction = toolBar->addAction(generalIcon, tr("General") + QLatin1Char('\n')); generalAction->setCheckable(true); GeneralSettings *generalSettings = new GeneralSettings; _ui->stack->addWidget(generalSettings); QIcon networkIcon(QLatin1String(":/client/resources/network.png")); QAction *networkAction = toolBar->addAction(networkIcon, tr("Network") + QLatin1Char('\n')); networkAction->setCheckable(true); NetworkSettings *networkSettings = new NetworkSettings; _ui->stack->addWidget(networkSettings); _actions.insert(_protocolAction, protocolWidget); _actions.insert(generalAction, generalSettings); _actions.insert(networkAction, networkSettings); QActionGroup *group = new QActionGroup(this); group->addAction(_protocolAction); group->addAction(generalAction); group->addAction(networkAction); group->setExclusive(true); connect(group, SIGNAL(triggered(QAction*)), SLOT(slotSwitchPage(QAction*))); connect(AccountManager::instance(), SIGNAL(accountAdded(AccountState*)), this, SLOT(accountAdded(AccountState*))); connect(AccountManager::instance(), SIGNAL(accountRemoved(AccountState*)), this, SLOT(accountRemoved(AccountState*))); foreach (auto ai , AccountManager::instance()->accounts()) { accountAdded(ai.data()); }
/** * When all dependent plugins are initialized, start the second initialization: * - setup ui * - start update checker * - read settings */ void MainWindow::extensionsInitialized() { // Creating MainWindow UI ui = new Internal::Ui::MainWindow(); ui->setupUi(this); if (layout()) layout()->setMargin(0); QWidget *header = new QWidget(this); _headerWidget = new Internal::Ui::HeaderWidget(); _headerWidget->setupUi(header); _headerWidget->edrcVersion->setText(edrcCore().currentDatabaseVersion()); _headerWidget->patientName->setPlaceholderText(tkTr(Trans::Constants::PATIENT_NAME)); ui->crListViewer->addHeaderWidget(header); // Creating ToolBar QToolBar *bar = new QToolBar(this); bar->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); bar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); bar->setIconSize(QSize(32, 32)); QStringList uids; uids << Core::Constants::A_FILE_OPEN << Core::Constants::A_FILE_SAVE << Core::Constants::A_FILE_SAVEAS << "--" << Core::Constants::A_FILE_PRINT << "->" << eDRC::Constants::A_SHOW_DBINFO << eDRC::Constants::A_ABOUT_SFMG ; foreach(const QString &uid, uids) { if (uid=="--") { bar->addSeparator(); continue; } else if (uid=="->") { QWidget *w = new QWidget(bar); w->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); w->setLayout(new QHBoxLayout(w)); w->layout()->addItem(new QSpacerItem(10,10, QSizePolicy::Expanding, QSizePolicy::Expanding)); bar->addWidget(w); continue; } else { Core::Command *cmd = actionManager()->command(Core::Id(uid)); if (cmd) bar->addAction(cmd->action()); } } bar->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); setUnifiedTitleAndToolBarOnMac(true); addToolBar(bar); // Create models _crTreeModel = new CrTreeModel(this); ui->crListViewer->setConsultResultTreeModel(_crTreeModel); // Disable some actions when starting as medintux plugin // if (commandLine()->value(Core::Constants::CL_MedinTux).toBool()) { // this->aNew->setEnabled(false); // this->aSave->setEnabled(false); // this->aMedinTux->setEnabled(false); // } // If needed read exchange out file // const QString &exfile = commandLine()->value(Core::Constants::CL_ExchangeOutFile).toString(); // if (!exfile.isEmpty()) { // messageSplash(tr("Reading exchange file...")); // if (commandLine()->value(Core::Internal::CommandLine::CL_MedinTux).toBool()) { // Utils::Log::addMessage(this, tr("Reading a MedinTux exchange file.")); // QString tmp = Utils::readTextFile(exfile, Utils::DontWarnUser); // Utils::Log::addMessage(this, "Content of the exchange file : " + tmp); // if (tmp.contains(DrugsDB::Constants::ENCODEDHTML_FREEDIAMSTAG)) { // int begin = tmp.indexOf(DrugsDB::Constants::ENCODEDHTML_FREEDIAMSTAG) + QString(DrugsDB::Constants::ENCODEDHTML_FREEDIAMSTAG).length(); // int end = tmp.indexOf("\"", begin); // QString encoded = tmp.mid( begin, end - begin ); // DrugsDB::DrugsIO::instance()->prescriptionFromXml(drugModel(), QByteArray::fromBase64(encoded.toAscii())); // } else if (tmp.contains("DrugsInteractionsEncodedPrescription:")) { // // TODO: Manage wrong file encoding */ // int begin = tmp.indexOf("DrugsInteractionsEncodedPrescription:") + QString("DrugsInteractionsEncodedPrescription:").length(); // int end = tmp.indexOf("\"", begin); // QString encoded = tmp.mid( begin, end - begin ); // DrugsDB::DrugsIO::instance()->prescriptionFromXml(drugModel(), QByteArray::fromBase64(encoded.toAscii())); // } // } else { // QString extras; // DrugsDB::DrugsIO::loadPrescription(drugModel(), exfile, extras); // patient()->fromXml(extras); // } // } // Start the update checker if (updateChecker()->needsUpdateChecking(settings()->getQSettings())) { settings()->setPath(Core::ISettings::UpdateUrl, Utils::Constants::FREEDRC_UPDATE_URL); if (checkUpdate()) settings()->setValue(Utils::Constants::S_LAST_CHECKUPDATE, QDate::currentDate()); } createDockWindows(); setWindowTitle(QString("%1 %2 - (c) %3").arg(qApp->applicationName()).arg(qApp->applicationVersion()).arg(tkTr(Trans::Constants::THE_FREEMEDFORMS_COMMUNITY))); setWindowIcon(theme()->icon(Core::Constants::ICONFREEDRC)); connect(Core::ICore::instance(), SIGNAL(coreOpened()), this, SLOT(postCoreOpened())); }
WndDeckEditor::WndDeckEditor(QWidget *parent) : QMainWindow(parent) { aSearch = new QAction(tr("&Search..."), this); aSearch->setIcon(QIcon(":/resources/icon_search.svg")); connect(aSearch, SIGNAL(triggered()), this, SLOT(actSearch())); aClearSearch = new QAction(tr("&Clear search"), this); aClearSearch->setIcon(QIcon(":/resources/icon_clearsearch.svg")); connect(aClearSearch, SIGNAL(triggered()), this, SLOT(actClearSearch())); QLabel *searchLabel = new QLabel(tr("&Search for:")); searchEdit = new SearchLineEdit; searchLabel->setBuddy(searchEdit); connect(searchEdit, SIGNAL(textChanged(const QString &)), this, SLOT(updateSearch(const QString &))); connect(searchEdit, SIGNAL(returnPressed()), this, SLOT(actAddCard())); QToolButton *searchButton = new QToolButton; searchButton->setDefaultAction(aSearch); QToolButton *clearSearchButton = new QToolButton; clearSearchButton->setDefaultAction(aClearSearch); QHBoxLayout *searchLayout = new QHBoxLayout; searchLayout->addWidget(searchLabel); searchLayout->addWidget(searchEdit); searchLayout->addWidget(searchButton); searchLayout->addWidget(clearSearchButton); databaseModel = new CardDatabaseModel(db, this); databaseDisplayModel = new CardDatabaseDisplayModel(this); databaseDisplayModel->setSourceModel(databaseModel); databaseDisplayModel->setFilterKeyColumn(0); databaseDisplayModel->sort(0, Qt::AscendingOrder); databaseView = new QTreeView(); databaseView->setModel(databaseDisplayModel); databaseView->setUniformRowHeights(true); databaseView->setAlternatingRowColors(true); databaseView->setSortingEnabled(true); databaseView->sortByColumn(0, Qt::AscendingOrder); databaseView->resizeColumnToContents(0); connect(databaseView->selectionModel(), SIGNAL(currentRowChanged(const QModelIndex &, const QModelIndex &)), this, SLOT(updateCardInfoLeft(const QModelIndex &, const QModelIndex &))); connect(databaseView, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(actAddCard())); searchEdit->setTreeView(databaseView); QVBoxLayout *leftFrame = new QVBoxLayout; leftFrame->addLayout(searchLayout); leftFrame->addWidget(databaseView); cardInfo = new CardInfoWidget(CardInfoWidget::ModeDeckEditor); cardInfo->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding); QToolBar *verticalToolBar = new QToolBar; verticalToolBar->setOrientation(Qt::Vertical); verticalToolBar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); verticalToolBar->setIconSize(QSize(24, 24)); QHBoxLayout *verticalToolBarLayout = new QHBoxLayout; verticalToolBarLayout->addStretch(); verticalToolBarLayout->addWidget(verticalToolBar); verticalToolBarLayout->addStretch(); QVBoxLayout *middleFrame = new QVBoxLayout; middleFrame->addWidget(cardInfo, 10); middleFrame->addLayout(verticalToolBarLayout); deckModel = new DeckListModel(this); deckView = new QTreeView(); deckView->setModel(deckModel); deckView->setUniformRowHeights(true); deckView->header()->setResizeMode(QHeaderView::ResizeToContents); connect(deckView->selectionModel(), SIGNAL(currentRowChanged(const QModelIndex &, const QModelIndex &)), this, SLOT(updateCardInfoRight(const QModelIndex &, const QModelIndex &))); QLabel *nameLabel = new QLabel(tr("Deck &name:")); nameEdit = new QLineEdit; nameLabel->setBuddy(nameEdit); connect(nameEdit, SIGNAL(textChanged(const QString &)), this, SLOT(updateName(const QString &))); QLabel *commentsLabel = new QLabel(tr("&Comments:")); commentsEdit = new QTextEdit; commentsEdit->setMaximumHeight(70); commentsLabel->setBuddy(commentsEdit); connect(commentsEdit, SIGNAL(textChanged()), this, SLOT(updateComments())); QGridLayout *grid = new QGridLayout; grid->addWidget(nameLabel, 0, 0); grid->addWidget(nameEdit, 0, 1); grid->addWidget(commentsLabel, 1, 0); grid->addWidget(commentsEdit, 1, 1); QVBoxLayout *rightFrame = new QVBoxLayout; rightFrame->addLayout(grid); rightFrame->addWidget(deckView); QSplitter *mainSplitter = new QSplitter; QWidget *leftFrameWidget = new QWidget; leftFrameWidget->setLayout(leftFrame); mainSplitter->addWidget(leftFrameWidget); QWidget *middleFrameWidget = new QWidget; middleFrameWidget->setLayout(middleFrame); mainSplitter->addWidget(middleFrameWidget); QWidget *rightFrameWidget = new QWidget; rightFrameWidget->setLayout(rightFrame); mainSplitter->addWidget(rightFrameWidget); setCentralWidget(mainSplitter); setWindowTitle(tr("Deck editor [*]")); aNewDeck = new QAction(tr("&New deck"), this); aNewDeck->setShortcuts(QKeySequence::New); connect(aNewDeck, SIGNAL(triggered()), this, SLOT(actNewDeck())); aLoadDeck = new QAction(tr("&Load deck..."), this); aLoadDeck->setShortcuts(QKeySequence::Open); connect(aLoadDeck, SIGNAL(triggered()), this, SLOT(actLoadDeck())); aSaveDeck = new QAction(tr("&Save deck"), this); aSaveDeck->setShortcuts(QKeySequence::Save); connect(aSaveDeck, SIGNAL(triggered()), this, SLOT(actSaveDeck())); aSaveDeckAs = new QAction(tr("Save deck &as..."), this); // aSaveDeckAs->setShortcuts(QKeySequence::SaveAs); connect(aSaveDeckAs, SIGNAL(triggered()), this, SLOT(actSaveDeckAs())); aLoadDeckFromClipboard = new QAction(tr("Load deck from cl&ipboard..."), this); connect(aLoadDeckFromClipboard, SIGNAL(triggered()), this, SLOT(actLoadDeckFromClipboard())); aLoadDeckFromClipboard->setShortcuts(QKeySequence::Paste); aSaveDeckToClipboard = new QAction(tr("Save deck to clip&board"), this); connect(aSaveDeckToClipboard, SIGNAL(triggered()), this, SLOT(actSaveDeckToClipboard())); aSaveDeckToClipboard->setShortcuts(QKeySequence::Copy); aPrintDeck = new QAction(tr("&Print deck..."), this); aPrintDeck->setShortcuts(QKeySequence::Print); connect(aPrintDeck, SIGNAL(triggered()), this, SLOT(actPrintDeck())); aClose = new QAction(tr("&Close"), this); aClose->setShortcut(tr("Ctrl+Q")); connect(aClose, SIGNAL(triggered()), this, SLOT(close())); aEditSets = new QAction(tr("&Edit sets..."), this); connect(aEditSets, SIGNAL(triggered()), this, SLOT(actEditSets())); deckMenu = menuBar()->addMenu(tr("&Deck")); deckMenu->addAction(aNewDeck); deckMenu->addAction(aLoadDeck); deckMenu->addAction(aSaveDeck); deckMenu->addAction(aSaveDeckAs); deckMenu->addSeparator(); deckMenu->addAction(aLoadDeckFromClipboard); deckMenu->addAction(aSaveDeckToClipboard); deckMenu->addSeparator(); deckMenu->addAction(aPrintDeck); deckMenu->addSeparator(); deckMenu->addAction(aClose); dbMenu = menuBar()->addMenu(tr("&Card database")); dbMenu->addAction(aEditSets); dbMenu->addSeparator(); dbMenu->addAction(aSearch); dbMenu->addAction(aClearSearch); aAddCard = new QAction(tr("Add card to &maindeck"), this); aAddCard->setShortcuts(QList<QKeySequence>() << QKeySequence(tr("Return")) << QKeySequence(tr("Enter"))); aAddCard->setIcon(QIcon(":/resources/arrow_right_green.svg")); connect(aAddCard, SIGNAL(triggered()), this, SLOT(actAddCard())); aAddCardToSideboard = new QAction(tr("Add card to &sideboard"), this); aAddCardToSideboard->setIcon(QIcon(":/resources/add_to_sideboard.svg")); aAddCardToSideboard->setShortcuts(QList<QKeySequence>() << QKeySequence(tr("Ctrl+Return")) << QKeySequence(tr("Ctrl+Enter"))); connect(aAddCardToSideboard, SIGNAL(triggered()), this, SLOT(actAddCardToSideboard())); aRemoveCard = new QAction(tr("&Remove row"), this); aRemoveCard->setShortcut(tr("Del")); aRemoveCard->setIcon(QIcon(":/resources/remove_row.svg")); connect(aRemoveCard, SIGNAL(triggered()), this, SLOT(actRemoveCard())); aIncrement = new QAction(tr("&Increment number"), this); aIncrement->setShortcut(tr("+")); aIncrement->setIcon(QIcon(":/resources/increment.svg")); connect(aIncrement, SIGNAL(triggered()), this, SLOT(actIncrement())); aDecrement = new QAction(tr("&Decrement number"), this); aDecrement->setIcon(QIcon(":/resources/decrement.svg")); aDecrement->setShortcut(tr("-")); connect(aDecrement, SIGNAL(triggered()), this, SLOT(actDecrement())); verticalToolBar->addAction(aAddCard); verticalToolBar->addAction(aAddCardToSideboard); verticalToolBar->addAction(aRemoveCard); verticalToolBar->addAction(aIncrement); verticalToolBar->addAction(aDecrement); dlgCardSearch = new DlgCardSearch(this); resize(950, 700); }
int Dialog::showDialog(const QString& view, QObject* viewModel, int type) { QDialog* dialog = NULL; QMainWindow* mainWindow = NULL; QWidget* windowWidget = NULL; QWidget* layoutWidget = NULL; switch (type) { case Dialog::MainWindow: mainWindow = new QMainWindow(); windowWidget = mainWindow; layoutWidget = new QWidget(windowWidget); mainWindow->setCentralWidget(layoutWidget); break; case Dialog::ModalDialog: dialog = new QDialog(QApplication::activeWindow()); windowWidget = dialog; layoutWidget = dialog; break; default: dialog = new QDialog(); windowWidget = dialog; layoutWidget = dialog; break; } QGridLayout* layout = new QGridLayout(layoutWidget); // Create view QDeclarativeView* v = new QDeclarativeView(layoutWidget); if (viewModel) { int count = viewModel->metaObject()->propertyCount(); for (int i = 0; i < count; ++i) { QMetaProperty p = viewModel->metaObject()->property(i); if (p.isReadable() && p.typeName() == QString("QDeclarativeImageProvider*")) { QString name = p.name(); QDeclarativeImageProvider* value = p.read(viewModel).value<QDeclarativeImageProvider*>(); v->engine()->addImageProvider(name.toLatin1(), new ProxyImageProvider(value)); } } v->rootContext()->setContextProperty("dataContext", viewModel); } QString path; foreach (path, importPaths) v->engine()->addImportPath(path); foreach (path, pluginPaths) v->engine()->addPluginPath(path); v->setSource(QUrl(view)); v->setResizeMode(QDeclarativeView::SizeRootObjectToView); // Initialize dialog QGraphicsObject* root = v->rootObject(); QVariant property = root->property("dialogTitle"); if (property.isValid()) windowWidget->setWindowTitle(property.toString()); property = root->property("dialogMinWidth"); if (property.isValid()) layoutWidget->setMinimumWidth(property.toInt()); property = root->property("dialogMinHeight"); if (property.isValid()) layoutWidget->setMinimumHeight(property.toInt()); property = root->property("dialogMaxWidth"); if (property.isValid()) layoutWidget->setMaximumWidth(property.toInt()); property = root->property("dialogMaxHeight"); if (property.isValid()) layoutWidget->setMaximumHeight(property.toInt()); property = root->property("dialogResizable"); if (property.isValid() && !property.toBool()) layout->setSizeConstraint(QLayout::SetFixedSize); Qt::WindowStates states = windowWidget->windowState(); Qt::WindowFlags flags = windowWidget->windowFlags(); property = root->property("dialogMinimizeButton"); if (property.isValid()) flags = property.toBool() ? flags | Qt::WindowMinimizeButtonHint : flags & ~Qt::WindowMinimizeButtonHint; property = root->property("dialogMaximizeButton"); if (property.isValid()) flags = property.toBool() ? flags | Qt::WindowMaximizeButtonHint : flags & ~Qt::WindowMaximizeButtonHint; property = root->property("dialogCloseButton"); if (property.isValid()) flags = property.toBool() ? flags | Qt::WindowCloseButtonHint : flags & ~Qt::WindowCloseButtonHint; property = root->property("dialogFullScreen"); if (property.isValid()) states = property.toBool() ? states | Qt::WindowFullScreen : states & ~Qt::WindowFullScreen; flags = flags & ~Qt::WindowContextHelpButtonHint; windowWidget->setWindowFlags(flags); windowWidget->setWindowState(states); property = root->property("dialogToolBar"); if (type == Dialog::MainWindow && property.isValid() && property.typeName() == QString("QDeclarativeListProperty<QDeclarativeItem>")) { QToolBar* toolbar = new QToolBar(mainWindow); toolbar->setMovable(false); toolbar->setFloatable(false); toolbar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); toolbar->setAllowedAreas(Qt::TopToolBarArea); QDeclarativeListProperty<QDeclarativeItem> btnList = property.value< QDeclarativeListProperty<QDeclarativeItem> >(); int btnCount = btnList.count(&btnList); for (int i = 0; i < btnCount; ++i) { QDeclarativeItem* item = btnList.at(&btnList, i); if (!item->property("text").isValid()) continue; QString itemText = item->property("text").toString(); QString itemTooltip = item->property("tooltip").isValid() ? item->property("tooltip").toString() : ""; QString itemIconSource = item->property("iconSource").isValid() ? item->property("iconSource").toString() : ""; int itemIconSize = item->property("iconSize").isValid() ? item->property("iconSize").toInt() : -1; if (itemText == "|") { toolbar->addSeparator(); } else if (itemText == "-") { QWidget* spacer = new QWidget(); spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum); toolbar->addWidget(spacer); } else { QAction* action = new QAction(mainWindow); action->setText(itemText); action->setToolTip(itemTooltip); action->setIcon(QIcon(itemIconSource)); QObject::connect(action, SIGNAL(triggered()), item, SLOT(trigger())); if (item->property("enabled").isValid()) new PropertyBinding(action, "enabled", item, "enabled", PropertyBinding::OneWay, NULL, this); if (item->property("visible").isValid()) new PropertyBinding(action, "visible", item, "visible", PropertyBinding::OneWay, NULL, this); toolbar->addAction(action); } if (itemIconSize != -1) toolbar->setIconSize(QSize(itemIconSize, itemIconSize)); } mainWindow->setUnifiedTitleAndToolBarOnMac(true); mainWindow->addToolBar(toolbar); } property = root->property("dialogMenu"); if (type == Dialog::MainWindow && property.isValid() && property.typeName() == QString("QDeclarativeListProperty<QDeclarativeItem>")) { QDeclarativeListProperty<QDeclarativeItem> list = property.value< QDeclarativeListProperty<QDeclarativeItem> >(); int count = list.count(&list); for (int i = 0; i < count; ++i) { QDeclarativeItem* item = list.at(&list, i); if (!item->property("text").isValid()) continue; QString itemText = item->property("text").toString(); QMenu * menuItem = mainWindow->menuBar()->addMenu(itemText); if (!item->property("submenu").isValid() || item->property("submenu").typeName() != QString("QDeclarativeListProperty<QDeclarativeItem>")) continue; QDeclarativeListProperty<QDeclarativeItem> innerList = item->property("submenu").value< QDeclarativeListProperty<QDeclarativeItem> >(); int innerCount = innerList.count(&innerList); for (int j = 0; j < innerCount; ++j) { QDeclarativeItem* innerItem = innerList.at(&innerList, j); if (!innerItem->property("text").isValid()) continue; QString innerItemText = innerItem->property("text").toString(); QString innerItemShortcut = innerItem->property("shortcut").isValid() ? innerItem->property("shortcut").toString() : ""; QString innerItemIconSource = innerItem->property("iconSource").isValid() ? innerItem->property("iconSource").toString() : ""; if (innerItemText == "-") { menuItem->addSeparator(); } else { QAction * action = menuItem->addAction(QIcon(innerItemIconSource), innerItemText); action->setShortcut(QKeySequence(innerItemShortcut)); QObject::connect(action, SIGNAL(triggered()), innerItem, SLOT(trigger())); if (innerItem->property("enabled").isValid()) new PropertyBinding(action, "enabled", innerItem, "enabled", PropertyBinding::OneWay, NULL, this); if (innerItem->property("visible").isValid()) new PropertyBinding(action, "visible", innerItem, "visible", PropertyBinding::OneWay, NULL, this); } } } } new DialogCallbacks(windowWidget, v, root); // Initialize layout layout->setMargin(0); layout->addWidget(v, 0, 0); // Execute switch (type) { case Dialog::ModalDialog: dialog->exec(); break; case Dialog::MainWindow: { if (mainWindowGeometry.isEmpty()) { mainWindow->adjustSize(); mainWindow->move(QApplication::desktop()->screen()->rect().center() - mainWindow->rect().center()); } else mainWindow->restoreGeometry(mainWindowGeometry); } default: windowWidget->setAttribute(Qt::WA_DeleteOnClose); windowWidget->show(); break; } int result = 0; property = root->property("dialogResult"); if (property.isValid()) result = property.toInt(); if (type == Dialog::ModalDialog) delete dialog; return result; }
TabDeckEditor::TabDeckEditor(TabSupervisor *_tabSupervisor, QWidget *parent) : Tab(_tabSupervisor, parent), modified(false) { aClearFilterAll = new QAction(QString(), this); aClearFilterAll->setIcon(QIcon(":/resources/icon_clearsearch.svg")); connect(aClearFilterAll, SIGNAL(triggered()), this, SLOT(actClearFilterAll())); aClearFilterOne = new QAction(QString(), this); aClearFilterOne->setIcon(QIcon(":/resources/decrement.svg")); connect(aClearFilterOne, SIGNAL(triggered()), this, SLOT(actClearFilterOne())); searchEdit = new SearchLineEdit; #if QT_VERSION >= 0x050300 searchEdit->addAction(QIcon(":/resources/icon_search_black.svg"), QLineEdit::LeadingPosition); #endif searchEdit->setObjectName("searchEdit"); setFocusProxy(searchEdit); setFocusPolicy(Qt::ClickFocus); searchEdit->installEventFilter(&searchKeySignals); connect(searchEdit, SIGNAL(textChanged(const QString &)), this, SLOT(updateSearch(const QString &))); connect(&searchKeySignals, SIGNAL(onEnter()), this, SLOT(actAddCard())); connect(&searchKeySignals, SIGNAL(onCtrlAltEqual()), this, SLOT(actAddCard())); connect(&searchKeySignals, SIGNAL(onCtrlAltRBracket()), this, SLOT(actAddCardToSideboard())); connect(&searchKeySignals, SIGNAL(onCtrlAltMinus()), this, SLOT(actDecrementCard())); connect(&searchKeySignals, SIGNAL(onCtrlAltLBracket()), this, SLOT(actDecrementCardFromSideboard())); connect(&searchKeySignals, SIGNAL(onCtrlAltEnter()), this, SLOT(actAddCardToSideboard())); connect(&searchKeySignals, SIGNAL(onCtrlEnter()), this, SLOT(actAddCardToSideboard())); QToolBar *deckEditToolBar = new QToolBar; deckEditToolBar->setOrientation(Qt::Horizontal); deckEditToolBar->setIconSize(QSize(24, 24)); QHBoxLayout *searchLayout = new QHBoxLayout; searchLayout->addWidget(deckEditToolBar); searchLayout->addWidget(searchEdit); databaseModel = new CardDatabaseModel(db, this); databaseDisplayModel = new CardDatabaseDisplayModel(this); databaseDisplayModel->setSourceModel(databaseModel); databaseDisplayModel->setFilterKeyColumn(0); databaseDisplayModel->sort(0, Qt::AscendingOrder); databaseView = new QTreeView(); databaseView->setFocusProxy(searchEdit); databaseView->setModel(databaseDisplayModel); databaseView->setUniformRowHeights(true); databaseView->setRootIsDecorated(false); databaseView->setAlternatingRowColors(true); databaseView->setSortingEnabled(true); databaseView->sortByColumn(0, Qt::AscendingOrder); databaseView->resizeColumnToContents(0); connect(databaseView->selectionModel(), SIGNAL(currentRowChanged(const QModelIndex &, const QModelIndex &)), this, SLOT(updateCardInfoLeft(const QModelIndex &, const QModelIndex &))); connect(databaseView, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(actAddCard())); searchEdit->setTreeView(databaseView); QVBoxLayout *leftFrame = new QVBoxLayout; leftFrame->addLayout(searchLayout); leftFrame->addWidget(databaseView); cardInfo = new CardFrame(250, 372); filterModel = new FilterTreeModel(); databaseDisplayModel->setFilterTree(filterModel->filterTree()); filterView = new QTreeView; filterView->setModel(filterModel); filterView->setMaximumWidth(250); filterView->setUniformRowHeights(true); filterView->setHeaderHidden(true); filterView->setContextMenuPolicy(Qt::CustomContextMenu); connect(filterModel, SIGNAL(layoutChanged()), filterView, SLOT(expandAll())); connect(filterView, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(filterViewCustomContextMenu(const QPoint &))); FilterBuilder *filterBuilder = new FilterBuilder; connect(filterBuilder, SIGNAL(add(const CardFilter *)), filterModel, SLOT(addFilter(const CardFilter *))); QToolButton *filterDelOne = new QToolButton(); filterDelOne->setDefaultAction(aClearFilterOne); filterDelOne->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); QToolButton *filterDelAll = new QToolButton(); filterDelAll->setDefaultAction(aClearFilterAll); filterDelAll->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); QGridLayout *filterLayout = new QGridLayout; filterLayout->addWidget(filterBuilder, 0, 0, 1, 2); filterLayout->addWidget(filterView, 1, 0, 1, 2); filterLayout->addWidget(filterDelOne, 2, 0); filterLayout->addWidget(filterDelAll, 2, 1); filterBox = new QGroupBox(); filterBox->setMaximumWidth(250); filterBox->setLayout(filterLayout); QVBoxLayout *middleFrame = new QVBoxLayout; middleFrame->addWidget(cardInfo, 1, Qt::AlignTop); middleFrame->addWidget(filterBox, 0); deckModel = new DeckListModel(this); connect(deckModel, SIGNAL(deckHashChanged()), this, SLOT(updateHash())); deckView = new QTreeView(); deckView->setModel(deckModel); deckView->setUniformRowHeights(true); deckView->setSortingEnabled(true); deckView->sortByColumn(1, Qt::AscendingOrder); #if QT_VERSION < 0x050000 deckView->header()->setResizeMode(QHeaderView::ResizeToContents); #else deckView->header()->setSectionResizeMode(QHeaderView::ResizeToContents); #endif deckView->installEventFilter(&deckViewKeySignals); connect(deckView->selectionModel(), SIGNAL(currentRowChanged(const QModelIndex &, const QModelIndex &)), this, SLOT(updateCardInfoRight(const QModelIndex &, const QModelIndex &))); connect(deckView, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(actSwapCard())); connect(&deckViewKeySignals, SIGNAL(onS()), this, SLOT(actSwapCard())); connect(&deckViewKeySignals, SIGNAL(onEnter()), this, SLOT(actIncrement())); connect(&deckViewKeySignals, SIGNAL(onCtrlAltEqual()), this, SLOT(actIncrement())); connect(&deckViewKeySignals, SIGNAL(onCtrlAltMinus()), this, SLOT(actDecrement())); connect(&deckViewKeySignals, SIGNAL(onRight()), this, SLOT(actIncrement())); connect(&deckViewKeySignals, SIGNAL(onLeft()), this, SLOT(actDecrement())); connect(&deckViewKeySignals, SIGNAL(onDelete()), this, SLOT(actRemoveCard())); nameLabel = new QLabel(); nameEdit = new QLineEdit; nameLabel->setBuddy(nameEdit); connect(nameEdit, SIGNAL(textChanged(const QString &)), this, SLOT(updateName(const QString &))); commentsLabel = new QLabel(); commentsEdit = new QTextEdit; commentsEdit->setMaximumHeight(70); commentsLabel->setBuddy(commentsEdit); connect(commentsEdit, SIGNAL(textChanged()), this, SLOT(updateComments())); hashLabel1 = new QLabel(); hashLabel = new QLabel; QGridLayout *grid = new QGridLayout; grid->addWidget(nameLabel, 0, 0); grid->addWidget(nameEdit, 0, 1); grid->addWidget(commentsLabel, 1, 0); grid->addWidget(commentsEdit, 1, 1); grid->addWidget(hashLabel1, 2, 0); grid->addWidget(hashLabel, 2, 1); /* Update price aUpdatePrices = new QAction(QString(), this); aUpdatePrices->setIcon(QIcon(":/resources/icon_update.png")); connect(aUpdatePrices, SIGNAL(triggered()), this, SLOT(actUpdatePrices())); if (!settingsCache->getPriceTagFeature()) aUpdatePrices->setVisible(false); connect(settingsCache, SIGNAL(priceTagFeatureChanged(int)), this, SLOT(setPriceTagFeatureEnabled(int))); */ QToolBar *deckToolBar = new QToolBar; deckToolBar->setOrientation(Qt::Vertical); deckToolBar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); deckToolBar->setIconSize(QSize(24, 24)); //deckToolBar->addAction(aUpdatePrices); QHBoxLayout *deckToolbarLayout = new QHBoxLayout; deckToolbarLayout->addStretch(); deckToolbarLayout->addWidget(deckToolBar); deckToolbarLayout->addStretch(); QVBoxLayout *rightFrame = new QVBoxLayout; rightFrame->addLayout(grid); rightFrame->addWidget(deckView, 10); rightFrame->addLayout(deckToolbarLayout); QHBoxLayout *mainLayout = new QHBoxLayout; mainLayout->addLayout(leftFrame, 10); mainLayout->addLayout(middleFrame); mainLayout->addLayout(rightFrame); setLayout(mainLayout); aNewDeck = new QAction(QString(), this); aNewDeck->setShortcuts(QKeySequence::New); connect(aNewDeck, SIGNAL(triggered()), this, SLOT(actNewDeck())); aLoadDeck = new QAction(QString(), this); aLoadDeck->setShortcuts(QKeySequence::Open); connect(aLoadDeck, SIGNAL(triggered()), this, SLOT(actLoadDeck())); aSaveDeck = new QAction(QString(), this); aSaveDeck->setShortcuts(QKeySequence::Save); connect(aSaveDeck, SIGNAL(triggered()), this, SLOT(actSaveDeck())); aSaveDeckAs = new QAction(QString(), this); // aSaveDeckAs->setShortcuts(QKeySequence::SaveAs); connect(aSaveDeckAs, SIGNAL(triggered()), this, SLOT(actSaveDeckAs())); aLoadDeckFromClipboard = new QAction(QString(), this); connect(aLoadDeckFromClipboard, SIGNAL(triggered()), this, SLOT(actLoadDeckFromClipboard())); aLoadDeckFromClipboard->setShortcuts(QKeySequence::Paste); aSaveDeckToClipboard = new QAction(QString(), this); connect(aSaveDeckToClipboard, SIGNAL(triggered()), this, SLOT(actSaveDeckToClipboard())); aSaveDeckToClipboard->setShortcuts(QKeySequence::Copy); aPrintDeck = new QAction(QString(), this); aPrintDeck->setShortcuts(QKeySequence::Print); connect(aPrintDeck, SIGNAL(triggered()), this, SLOT(actPrintDeck())); aAnalyzeDeck = new QAction(QString(), this); connect(aAnalyzeDeck, SIGNAL(triggered()), this, SLOT(actAnalyzeDeck())); aClose = new QAction(QString(), this); connect(aClose, SIGNAL(triggered()), this, SLOT(closeRequest())); aOpenCustomFolder = new QAction(QString(), this); connect(aOpenCustomFolder, SIGNAL(triggered()), this, SLOT(actOpenCustomFolder())); aEditSets = new QAction(QString(), this); connect(aEditSets, SIGNAL(triggered()), this, SLOT(actEditSets())); aEditTokens = new QAction(QString(), this); connect(aEditTokens, SIGNAL(triggered()), this, SLOT(actEditTokens())); deckMenu = new QMenu(this); deckMenu->addAction(aNewDeck); deckMenu->addAction(aLoadDeck); deckMenu->addAction(aSaveDeck); deckMenu->addAction(aSaveDeckAs); deckMenu->addSeparator(); deckMenu->addAction(aLoadDeckFromClipboard); deckMenu->addAction(aSaveDeckToClipboard); deckMenu->addSeparator(); deckMenu->addAction(aPrintDeck); deckMenu->addSeparator(); deckMenu->addAction(aAnalyzeDeck); deckMenu->addSeparator(); deckMenu->addAction(aClose); addTabMenu(deckMenu); dbMenu = new QMenu(this); dbMenu->addAction(aEditSets); dbMenu->addAction(aEditTokens); dbMenu->addSeparator(); dbMenu->addAction(aClearFilterAll); #if defined(Q_OS_WIN) || defined(Q_OS_MAC) dbMenu->addSeparator(); dbMenu->addAction(aOpenCustomFolder); #endif addTabMenu(dbMenu); aAddCard = new QAction(QString(), this); aAddCard->setIcon(QIcon(":/resources/arrow_right_green.svg")); connect(aAddCard, SIGNAL(triggered()), this, SLOT(actAddCard())); aAddCardToSideboard = new QAction(QString(), this); aAddCardToSideboard->setIcon(QIcon(":/resources/add_to_sideboard.svg")); connect(aAddCardToSideboard, SIGNAL(triggered()), this, SLOT(actAddCardToSideboard())); aRemoveCard = new QAction(QString(), this); aRemoveCard->setIcon(QIcon(":/resources/remove_row.svg")); connect(aRemoveCard, SIGNAL(triggered()), this, SLOT(actRemoveCard())); aIncrement = new QAction(QString(), this); aIncrement->setIcon(QIcon(":/resources/increment.svg")); connect(aIncrement, SIGNAL(triggered()), this, SLOT(actIncrement())); aDecrement = new QAction(QString(), this); aDecrement->setIcon(QIcon(":/resources/decrement.svg")); connect(aDecrement, SIGNAL(triggered()), this, SLOT(actDecrement())); deckEditToolBar->addAction(aAddCard); deckEditToolBar->addAction(aAddCardToSideboard); deckEditToolBar->addAction(aRemoveCard); deckEditToolBar->addAction(aDecrement); deckEditToolBar->addAction(aIncrement); deckEditToolBar->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); retranslateUi(); resize(950, 700); QTimer::singleShot(0, this, SLOT(checkFirstRunDetected())); }
void tst_QToolBar::toolButtonStyle() { { QToolBar tb; QSignalSpy spy(&tb, SIGNAL(toolButtonStyleChanged(Qt::ToolButtonStyle))); // no-op QCOMPARE(tb.toolButtonStyle(), Qt::ToolButtonIconOnly); tb.setToolButtonStyle(Qt::ToolButtonIconOnly); QCOMPARE(tb.toolButtonStyle(), Qt::ToolButtonIconOnly); QCOMPARE(spy.count(), 0); tb.setToolButtonStyle(Qt::ToolButtonTextOnly); QCOMPARE(tb.toolButtonStyle(), Qt::ToolButtonTextOnly); QCOMPARE(spy.count(), 1); spy.clear(); // no-op tb.setToolButtonStyle(Qt::ToolButtonTextOnly); QCOMPARE(tb.toolButtonStyle(), Qt::ToolButtonTextOnly); QCOMPARE(spy.count(), 0); tb.setToolButtonStyle(Qt::ToolButtonIconOnly); QCOMPARE(tb.toolButtonStyle(), Qt::ToolButtonIconOnly); QCOMPARE(spy.count(), 1); spy.clear(); // no-op tb.setToolButtonStyle(Qt::ToolButtonIconOnly); QCOMPARE(tb.toolButtonStyle(), Qt::ToolButtonIconOnly); QCOMPARE(spy.count(), 0); tb.setToolButtonStyle(Qt::ToolButtonTextBesideIcon); QCOMPARE(tb.toolButtonStyle(), Qt::ToolButtonTextBesideIcon); QCOMPARE(spy.count(), 1); spy.clear(); // no-op tb.setToolButtonStyle(Qt::ToolButtonTextBesideIcon); QCOMPARE(tb.toolButtonStyle(), Qt::ToolButtonTextBesideIcon); QCOMPARE(spy.count(), 0); tb.setToolButtonStyle(Qt::ToolButtonTextUnderIcon); QCOMPARE(tb.toolButtonStyle(), Qt::ToolButtonTextUnderIcon); QCOMPARE(spy.count(), 1); spy.clear(); // no-op tb.setToolButtonStyle(Qt::ToolButtonTextUnderIcon); QCOMPARE(tb.toolButtonStyle(), Qt::ToolButtonTextUnderIcon); QCOMPARE(spy.count(), 0); tb.setToolButtonStyle(Qt::ToolButtonFollowStyle); QCOMPARE(tb.toolButtonStyle(), Qt::ToolButtonFollowStyle); QCOMPARE(spy.count(), 1); } { QMainWindow mw; QToolBar tb; QSignalSpy mwSpy(&mw, SIGNAL(toolButtonStyleChanged(Qt::ToolButtonStyle))); QSignalSpy tbSpy(&tb, SIGNAL(toolButtonStyleChanged(Qt::ToolButtonStyle))); mw.setToolButtonStyle(Qt::ToolButtonTextBesideIcon); // explicitly set the tb to the default tb.setToolButtonStyle(Qt::ToolButtonIconOnly); QCOMPARE(tb.toolButtonStyle(), Qt::ToolButtonIconOnly); QCOMPARE(tbSpy.count(), 0); mw.addToolBar(&tb); // tb icon size should not change since it has been explicitly set QCOMPARE(tb.toolButtonStyle(), Qt::ToolButtonIconOnly); QCOMPARE(tbSpy.count(), 0); mw.setToolButtonStyle(Qt::ToolButtonIconOnly); QCOMPARE(tb.toolButtonStyle(), Qt::ToolButtonIconOnly); QCOMPARE(tbSpy.count(), 0); mw.setToolButtonStyle(Qt::ToolButtonTextOnly); QCOMPARE(tb.toolButtonStyle(), Qt::ToolButtonIconOnly); QCOMPARE(tbSpy.count(), 0); mw.setToolButtonStyle(Qt::ToolButtonTextUnderIcon); QCOMPARE(tb.toolButtonStyle(), Qt::ToolButtonIconOnly); QCOMPARE(tbSpy.count(), 0); // note: there is no way to clear the explicitly set tool // button style... once you explicitly set it, the toolbar // will never follow the mainwindow again } }