void TupMainWindow::setupToolBar() { QToolBar * toolbar = new QToolBar(tr("Actions Bar"), this); toolbar->setIconSize(QSize(22,22)); addToolBar(Qt::TopToolBarArea, toolbar); toolbar->addAction(m_actionManager->find("newproject")); toolbar->addAction(m_actionManager->find("openproject")); toolbar->addAction(m_actionManager->find("opennetproject")); toolbar->addAction(m_actionManager->find("saveproject")); toolbar->addAction(m_actionManager->find("saveprojectas")); toolbar->addAction(m_actionManager->find("closeproject")); }
ScriptDock::ScriptDock(QWidget *parent) : QDockWidget(parent), mFileName(tr("untitled.lua")), mMapDocument(0) { setObjectName(QLatin1String("scriptViewDock")); mScriptArea = new ScriptEditor(this); mScriptArea->setLineWrapMode(QPlainTextEdit::NoWrap); connect(mScriptArea, SIGNAL(textChanged()), SLOT(scriptChanged())); mOutputArea = new QPlainTextEdit(this); mOutputArea->setReadOnly(true); highlighter = new ScriptHighlighter(mScriptArea->document()); QToolBar *buttonContainer = new QToolBar(this); buttonContainer->setFloatable(false); buttonContainer->setMovable(false); buttonContainer->setIconSize(QSize(16, 16)); QAction *runAction = new QAction(this); runAction->setShortcut(tr("Ctrl+Shift+R")); runAction->setIcon( QIcon(QLatin1String(":/images/16x16/script_run.png"))); buttonContainer->addAction(runAction); connect(runAction, SIGNAL(triggered()), SLOT(runScript())); QWidget *widget = new QWidget(this); QVBoxLayout *layout = new QVBoxLayout(widget); layout->setMargin(5); QSplitter *splitter = new QSplitter(Qt::Vertical, widget); splitter->addWidget(mScriptArea); splitter->addWidget(mOutputArea); layout->addWidget(splitter); layout->addWidget(buttonContainer); QList<int> sizeList; sizeList << 500 << 100; splitter->setSizes(sizeList); setWidget(widget); retranslateUi(); }
void lmcTransferWindow::createToolBar(void) { QToolBar* pToolBar = new QToolBar(ui.wgtToolBar); pToolBar->setIconSize(QSize(16, 16)); pToolBar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); ui.toolBarLayout->addWidget(pToolBar); pactCancel = pToolBar->addAction(QIcon(QPixmap(IDR_STOP, "PNG")), "Cancel", this, SLOT(btnCancel_clicked())); pToolBar->addSeparator(); pactShowFolder = pToolBar->addAction(QIcon(QPixmap(IDR_FOLDER, "PNG")), "Show In Folder", this, SLOT(btnShowFolder_clicked())); pactRemove = pToolBar->addAction(QIcon(QPixmap(IDR_DECLINE, "PNG")), "Remove From List", this, SLOT(btnRemove_clicked())); }
EditTools::EditTools(QWidget* parent) : QDockWidget(parent) { setObjectName("edit-tools"); setWindowTitle(tr("Edit Mode Tools")); setAllowedAreas(Qt::DockWidgetAreas(Qt::TopDockWidgetArea | Qt::BottomDockWidgetArea)); QToolBar* tb = new QToolBar(tr("Edit Mode Tools")); tb->setIconSize(QSize(preferences.iconWidth, preferences.iconHeight)); QToolButton* b = new QToolButton(this); QAction* a = getAction("hraster"); a->setCheckable(true); b->setDefaultAction(a); b->setContextMenuPolicy(Qt::ActionsContextMenu); b->addAction(getAction("config-raster")); tb->addWidget(b); b = new QToolButton(this); a = getAction("vraster"); a->setCheckable(true); b->setDefaultAction(a); b->setContextMenuPolicy(Qt::ActionsContextMenu); b->addAction(getAction("config-raster")); tb->addWidget(b); _editX = new QDoubleSpinBox(this); _editX->setSuffix(tr("sp")); _editX->setRange(-99999, 99999); _editX->setSingleStep(.1); _editY = new QDoubleSpinBox(this); _editY->setSuffix(tr("sp")); _editY->setRange(-99999, 99999); _editY->setSingleStep(.1); xLabel = new QLabel(tr("x:"), this); yLabel = new QLabel(tr("y:"), this); _localEdit = false; tb->addWidget(xLabel); tb->addWidget(_editX); tb->addWidget(yLabel); tb->addWidget(_editY); connect(_editX, SIGNAL(valueChanged(double)), SLOT(editXChanged(double))); connect(_editY, SIGNAL(valueChanged(double)), SLOT(editYChanged(double))); setWidget(tb); QWidget* w = new QWidget(this); setTitleBarWidget(w); titleBarWidget()->hide(); }
ServerWidget::ServerWidget(QWidget *parent, const QString &nodeName, int listenPort) : QMainWindow(parent) { m_contents = new QTextEdit(this); QFont font("Monospace"); font.setStyleHint(QFont::TypeWriter); m_contents->setFont(font); m_contents->setReadOnly(true); QPalette palette; palette.setColor(QPalette::Base, Qt::black); m_contents->setPalette(palette); setPalette(palette); QToolBar *toolBar = new QToolBar(this); toolBar->setMovable(false); toolBar->setAllowedAreas(Qt::TopToolBarArea); toolBar->setIconSize(QSize(32, 32)); toolBar->setToolButtonStyle(Qt::ToolButtonIconOnly); toolBar->setFloatable(false); QAction *actionClear = new QAction(this); QIcon clearIcon; clearIcon.addFile(QString::fromUtf8(":/resources/clear.png"), QSize(), QIcon::Normal, QIcon::Off); actionClear->setIcon(clearIcon); actionClear->setToolTip(tr("Clear")); actionClear->setText(tr("Clear")); connect(actionClear, SIGNAL(triggered()), m_contents, SLOT(clear())); toolBar->addAction(actionClear); #if defined(__OSX__) toolBar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); #endif addToolBar(Qt::TopToolBarArea, toolBar); setCentralWidget(m_contents); setUnifiedTitleAndToolBarOnMac(true); setMenuBar(NULL); setWindowTitle(tr("Server Log")); resize(QSize(1000, 500)); QConsoleAppender *consoleAppender = new QConsoleAppender(); m_logger = new Logger(Thread::getThread()->getLogger()->getLogLevel()); m_logger->addAppender(consoleAppender); m_logger->setFormatter(new DefaultFormatter()); connect(consoleAppender, SIGNAL(textMessage(ELogLevel, const QString &)), this, SLOT(onTextMessage(ELogLevel, const QString &)), Qt::QueuedConnection); m_thread = new ServerThread(m_logger, listenPort, nodeName.toStdString()); m_thread->start(); }
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 SurveyEditorGeneratorPage::setupUi() { QBoxLayout * vlayout = new QVBoxLayout(); QBoxLayout * infolayout = new QVBoxLayout(); QBoxLayout * hlayout = new QHBoxLayout(); QToolBar * toolbar = new QToolBar(this); toolbar->setIconSize( QSize(48,48) ); toolbar->addAction(QIcon(global::R.getValue("icon/scripteditorrun")), tr("Run Script"), this,SLOT(onActionRunScript())); Overlay * o =mScriptView->overlay(); o->setMovie( new QMovie( global::R.getValue("animation/loading") )); o->movie()->start(); o->hide(); mDescriptionEdit = new PlainTextEdit(this); mDescriptionEdit->overlay()->setText( tr("Description") ); mDescriptionEdit->setToolTip( mDescriptionEdit->overlay()->text() ); mDescriptionEdit->setReadOnly(true); mAuthorEdit = new LineEdit(this); mAuthorEdit->overlay()->setText( tr("Author") ); mAuthorEdit->setToolTip( mAuthorEdit->overlay()->text() ); mAuthorEdit->setReadOnly(true); mVersionEdit = new LineEdit(this); mVersionEdit->overlay()->setText( tr("Version") ); mVersionEdit->setToolTip( mVersionEdit->overlay()->text() ); mVersionEdit->setReadOnly(true); vlayout->addWidget(toolbar); hlayout->addWidget(mScriptView); infolayout->addWidget(mDescriptionEdit); infolayout->addWidget(mAuthorEdit); infolayout->addWidget(mVersionEdit); infolayout->addStretch(); hlayout->addLayout(infolayout); vlayout->addLayout(hlayout); setLayout(vlayout); updateScriptList(); }
notepad::notepad() : QWidget(NULL) { QVBoxLayout* top_layout = new QVBoxLayout(this); m_we = new QPlainTextEdit(this); QHBoxLayout* hbl = new QHBoxLayout; top_layout->addLayout(hbl); // m_save_button = new QPushButton(tr("Save")); QToolBar* toolbar = new QToolBar(); toolbar->setIconSize(QSize(16,16)); toolbar->setFloatable(true); m_action_save = toolbar->addAction(tr("Save"), this, SLOT(save())); top_layout->addWidget(toolbar); top_layout->addWidget(m_we); // hbl->addWidget(m_save_button); // hbl->setStretchFactor(m_save_button, 0); // hbl->addStretch(1); QIcon ico_cut(UI_ICON(FT_ICON16_EDIT_CUT)); QIcon ico_copy(UI_ICON(FT_ICON16_EDIT_COPY)); QIcon ico_paste(UI_ICON(FT_ICON16_EDIT_PASTE)); QIcon ico_undo(UI_ICON(FT_ICON16_UNDO)); QIcon ico_redo(UI_ICON(FT_ICON16_REDO)); toolbar->addSeparator(); toolbar->addAction(ico_cut, tr("Cut"), m_we, SLOT(cut())); toolbar->addAction(ico_copy, tr("Copy"), m_we, SLOT(copy())); toolbar->addAction(ico_paste, tr("Paste"), m_we, SLOT(paste())); toolbar->addAction(ico_undo, tr("Undo"), m_we, SLOT(undo())); toolbar->addAction(ico_redo, tr("Redo"), m_we, SLOT(redo())); // connect(m_save_button, SIGNAL(clicked()), this, SLOT(save())); load(); disable_save(); m_timer = new QTimer(this); connect(m_timer, SIGNAL(timeout()), this, SLOT(auto_save())); m_timer->start(60*1000); // auto-save every minute connect(m_we, SIGNAL(textChanged()), this, SLOT(enable_save())); setWindowTitle(tr("Global Notepad")); setWindowIcon(UI_ICON(ICON16_NOTEPAD)); resize(640, 400); }
QToolBar *FormEditorW::createEditorToolBar() const { QToolBar *editorToolBar = new QToolBar; const QList<Id>::const_iterator cend = m_toolActionIds.constEnd(); for (QList<Id>::const_iterator it = m_toolActionIds.constBegin(); it != cend; ++it) { Command *cmd = ActionManager::command(*it); QTC_ASSERT(cmd, continue); QAction *action = cmd->action(); if (!action->icon().isNull()) // Simplify grid has no action yet editorToolBar->addAction(action); } const int size = editorToolBar->style()->pixelMetric(QStyle::PM_SmallIconSize); editorToolBar->setIconSize(QSize(size, size)); editorToolBar->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); return editorToolBar; }
void CQTOpenGLLuaMainWindow::CreateCodeActions() { QIcon cCodeExecuteIcon; cCodeExecuteIcon.addPixmap(QPixmap(m_pcMainWindow->GetIconDir() + "/execute.png")); m_pcCodeExecuteAction = new QAction(cCodeExecuteIcon, tr("&Execute"), this); m_pcCodeExecuteAction->setToolTip(tr("Execute code")); m_pcCodeExecuteAction->setStatusTip(tr("Execute code")); m_pcCodeExecuteAction->setShortcut(tr("Ctrl+E")); connect(m_pcCodeExecuteAction, SIGNAL(triggered()), this, SLOT(Execute())); QMenu* pcMenu = menuBar()->addMenu(tr("&Code")); pcMenu->addAction(m_pcCodeExecuteAction); QToolBar* pcToolBar = addToolBar(tr("Code")); pcToolBar->setObjectName("CodeToolBar"); pcToolBar->setIconSize(QSize(32,32)); pcToolBar->addAction(m_pcCodeExecuteAction); }
QToolBar * DesignNetFormManager::createEditorToolBar() const { QToolBar *editorToolBar = new QToolBar; const QList<Core::Id>::const_iterator cend = d->m_toolActionIds.constEnd(); for (QList<Core::Id>::const_iterator it = d->m_toolActionIds.constBegin(); it != cend; ++it) { Core::Command *cmd = Core::ActionManager::instance()->command(*it); QAction *action = cmd->action(); if (!action->icon().isNull()) editorToolBar->addAction(action); } const int size = editorToolBar->style()->pixelMetric(QStyle::PM_SmallIconSize); editorToolBar->setIconSize(QSize(size, size)); editorToolBar->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); return editorToolBar; }
FiltersDialog::FiltersDialog(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f) { QToolBar *toolBar = new QToolBar(this); toolBar->setIconSize(QSize(16, 16)); toolBar->addAction(QIcon(":icons/filter_add"), "New Filter...", this, SLOT(onNewFilter())); toolBar->addAction(QIcon(":icons/filter_edit"), "Change Filter...", this, SLOT(onFilterEdit())); toolBar->addAction(QIcon(":icons/filter_delete"), "Delete", this, SLOT(onFilterDelete())); m_filtersTree = new QTreeWidget(this); m_filtersTree->setColumnCount(2); m_filtersTree->setRootIsDecorated(false); QStringList headerLabels; headerLabels << "Filter" << "Enable"; m_filtersTree->setHeaderLabels(headerLabels); m_filtersTree->header()->resizeSection(Name, 250); m_filtersTree->header()->setResizeMode(Enable, QHeaderView::Fixed); m_filtersTree->header()->setStretchLastSection(false); QVBoxLayout *tblWithBtns = new QVBoxLayout; tblWithBtns->addWidget(toolBar); tblWithBtns->addWidget(m_filtersTree); QPushButton *btnOk = new QPushButton(str::Ok, this); connect(btnOk, SIGNAL(clicked()), this, SLOT(accept())); btnOk->setDefault(true); QPushButton *btnCancel = new QPushButton(str::Cancel, this); connect(btnCancel, SIGNAL(clicked()), this, SLOT(reject())); QHBoxLayout *btnLayout = new QHBoxLayout; btnLayout->addStretch(); btnLayout->addWidget(btnOk); btnLayout->addWidget(btnCancel); QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->addLayout(tblWithBtns); mainLayout->addLayout(btnLayout); setLayout(mainLayout); setWindowTitle("Filters"); resize(400, 300); }
Viewport::Viewport(QWidget* parent) : QWidget(parent) { QVBoxLayout* layout = new QVBoxLayout(this); layout->setMargin(0); layout->setSpacing(0); m_gl_widget = MainWindow::instance().createGL<GLWidget>(this); layout->addWidget(m_gl_widget); QToolBar* tb = new QToolBar(this); tb->setFloatable(false); tb->setMovable(false); tb->setIconSize(QSize(16, 16)); layout->addWidget(tb); m_new_object = tb->addAction(QIcon(":/icons/new_object.png"), "New object", this, SLOT(newObject())); m_new_light = tb->addAction(QIcon(":/icons/new_light.png"), "New light", this, SLOT(newLight())); m_new_light->setEnabled(false); tb->addSeparator(); m_translate = tb->addAction(QIcon(":/icons/translate.png"), "Translate (W)", this, SLOT(translateGizmo())); m_translate->setCheckable(true); m_translate->setChecked(true); m_rotate = tb->addAction(QIcon(":/icons/rotate.png"), "Rotate (E)", this, SLOT(rotateGizmo())); m_rotate->setCheckable(true); m_rotate->setChecked(false); m_scale = tb->addAction(QIcon(":/icons/scale.png"), "Scale (R)", this, SLOT(scaleGizmo())); m_scale->setCheckable(true); m_scale->setChecked(false); m_scale->setEnabled(false); tb->addSeparator(); m_frame_selection = tb->addAction(QIcon(":/icons/frame.png"), "Frame selection (F)", this, SLOT(frameSelection())); m_frame_selection->setEnabled(false); m_frame_all = tb->addAction(QIcon(":/icons/frame_all.png"), "Frame all (A)", this, SLOT(frameAll())); m_frame_all->setEnabled(false); tb->addSeparator(); m_scene_mode = tb->addAction(QIcon(":/icons/blueprint.png"), "Blueprint mode (B)", this, SLOT(sceneMode())); m_scene_mode->setChecked(true); m_scene_mode->setEnabled(false); m_render_mode = tb->addAction(QIcon(":/icons/shader.png"), "Render mode (G)", this, SLOT(renderMode())); m_render_mode->setEnabled(false); tb->addSeparator(); m_delete_object = tb->addAction(QIcon(":/icons/delete.png"), "Delete object", this, SLOT(deleteObject())); translateGizmo(); }
StringListEditor::StringListEditor(const QString& title, QWidget* parent) : QGroupBox(title, parent) { // create layout _hLayout = new QVBoxLayout( this ); _hLayout->setMargin(5); _hLayout->setSpacing(3); // create toolbar QToolBar* tb = new QToolBar; tb->layout()->setMargin(0); tb->layout()->setSpacing(0); tb->setIconSize(QSize(16, 16)); _hLayout->addWidget(tb); // create listwidget _list = new QListWidget; _list->setMinimumHeight(40); _list->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); _hLayout->addWidget(_list); // create actions QAction* addAction = new QAction( QIcon( ":/listeditor/add.png" ), tr("Add Item"), tb); QAction* removeAction = new QAction( QIcon( ":/listeditor/remove.png" ), tr("Remove Item"), tb); QAction* clearAction = new QAction( QIcon( ":/listeditor/clear.png" ), tr("Clear Items"), tb); QAction* upAction = new QAction( QIcon( ":/listeditor/up.png" ), tr("Move Item Up"), tb); QAction* downAction = new QAction( QIcon( ":/listeditor/down.png" ), tr("Move Item Down"), tb); QAction* editAction = new QAction( QIcon( ":/listeditor/edit.png" ), tr("Edit Item"), tb); // add actions to toolbar tb->addAction(addAction); tb->addAction(removeAction); tb->addAction(clearAction); tb->addAction(upAction); tb->addAction(downAction); tb->addAction(editAction); // connections connect(addAction, SIGNAL(triggered()), this, SLOT(onAddItem())); connect(removeAction, SIGNAL(triggered()), this, SLOT(onRemoveItem())); connect(clearAction, SIGNAL(triggered()), this, SLOT(onClearItem())); connect(upAction, SIGNAL(triggered()), this, SLOT(onMoveUpItem())); connect(downAction, SIGNAL(triggered()), this, SLOT(onMoveDownItem())); connect(editAction, SIGNAL(triggered()), this, SLOT(onEditItem())); connect(_list, SIGNAL(itemChanged(QListWidgetItem*)), this, SIGNAL(edited())); connect( this, SIGNAL(edited()), this, SLOT(onEdited())); }
BookmarkList::BookmarkList( Okular::Document *document, QWidget *parent ) : QWidget( parent ), m_document( document ), m_currentDocumentItem( 0 ) { QVBoxLayout *mainlay = new QVBoxLayout( this ); mainlay->setMargin( 0 ); mainlay->setSpacing( 6 ); m_searchLine = new KTreeWidgetSearchLine( this ); mainlay->addWidget( m_searchLine ); m_tree = new QTreeWidget( this ); mainlay->addWidget( m_tree ); QStringList cols; cols.append( "Bookmarks" ); m_tree->setContextMenuPolicy( Qt::CustomContextMenu ); m_tree->setHeaderLabels( cols ); m_tree->setSortingEnabled( false ); m_tree->setRootIsDecorated( true ); m_tree->setAlternatingRowColors( true ); m_tree->setItemDelegate( new PageItemDelegate( m_tree ) ); m_tree->header()->hide(); m_tree->setSelectionBehavior( QAbstractItemView::SelectRows ); m_tree->setEditTriggers( QAbstractItemView::EditKeyPressed ); connect( m_tree, SIGNAL(itemActivated(QTreeWidgetItem*,int)), this, SLOT(slotExecuted(QTreeWidgetItem*)) ); connect( m_tree, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(slotContextMenu(QPoint)) ); m_searchLine->addTreeWidget( m_tree ); QToolBar * bookmarkController = new QToolBar( this ); mainlay->addWidget( bookmarkController ); bookmarkController->setObjectName( QLatin1String( "BookmarkControlBar" ) ); // change toolbar appearance bookmarkController->setIconSize( QSize( 16, 16 ) ); bookmarkController->setMovable( false ); QSizePolicy sp = bookmarkController->sizePolicy(); sp.setVerticalPolicy( QSizePolicy::Minimum ); bookmarkController->setSizePolicy( sp ); // insert a togglebutton [show only bookmarks in the current document] m_showBoomarkOnlyAction = bookmarkController->addAction( KIcon( "bookmarks" ), i18n( "Current document only" ) ); m_showBoomarkOnlyAction->setCheckable( true ); connect( m_showBoomarkOnlyAction, SIGNAL(toggled(bool)), this, SLOT(slotFilterBookmarks(bool)) ); connect( m_document->bookmarkManager(), SIGNAL(bookmarksChanged(KUrl)), this, SLOT(slotBookmarksChanged(KUrl)) ); rebuildTree( m_showBoomarkOnlyAction->isChecked() ); }
LogWidget::LogWidget(QWidget *parent) : QMainWindow(parent) { m_contents = new QTextEdit(this); QFont font("Monospace"); font.setStyleHint(QFont::TypeWriter); m_contents->setFont(font); m_contents->setReadOnly(true); QPalette palette; palette.setColor(QPalette::Base, Qt::black); m_contents->setPalette(palette); setPalette(palette); QToolBar *toolBar = new QToolBar(this); toolBar->setMovable(false); toolBar->setAllowedAreas(Qt::TopToolBarArea); toolBar->setIconSize(QSize(32, 32)); toolBar->setToolButtonStyle(Qt::ToolButtonIconOnly); toolBar->setFloatable(false); QAction *actionShowStats = new QAction(this); QIcon showStatsIcon; showStatsIcon.addFile(QString::fromUtf8(":/resources/showStats.png"), QSize(), QIcon::Normal, QIcon::Off); actionShowStats->setIcon(showStatsIcon); actionShowStats->setToolTip(tr("Show statistics")); actionShowStats->setText(tr("Show Statistics")); connect(actionShowStats, SIGNAL(triggered()), this, SLOT(onShowStats())); toolBar->addAction(actionShowStats); QAction *actionClear = new QAction(this); QIcon clearIcon; clearIcon.addFile(QString::fromUtf8(":/resources/clear.png"), QSize(), QIcon::Normal, QIcon::Off); actionClear->setIcon(clearIcon); actionClear->setToolTip(tr("Clear")); actionClear->setText(tr("Clear")); connect(actionClear, SIGNAL(triggered()), m_contents, SLOT(clear())); toolBar->addAction(actionClear); #if defined(__OSX__) toolBar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); #endif addToolBar(Qt::TopToolBarArea, toolBar); setCentralWidget(m_contents); setUnifiedTitleAndToolBarOnMac(true); setWindowTitle(tr("Log")); resize(QSize(1000, 500)); }
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; }"); }
DownloadManager::DownloadManager(QWidget *parent) : QWidget(parent) { listWidget_ = new QListWidget(); listWidget_->setFrameStyle(QFrame::NoFrame); listClaerAct_ = new QAction(QIcon(":/images/list_clear"), tr("Clear"), this); QToolBar *toolBar = new QToolBar(this); toolBar->setObjectName("newsToolBar"); toolBar->setStyleSheet("QToolBar { border: none; padding: 0px; }"); toolBar->setIconSize(QSize(18, 18)); toolBar->addAction(listClaerAct_); QHBoxLayout *buttonLayout = new QHBoxLayout(); buttonLayout->setMargin(2); buttonLayout->addWidget(toolBar); QWidget *buttonPanelWidget = new QWidget(this); buttonPanelWidget->setObjectName("buttonPanelWidget"); buttonPanelWidget->setStyleSheet( QString("#buttonPanelWidget {border-bottom: 1px solid %1;}"). arg(qApp->palette().color(QPalette::Dark).name())); buttonPanelWidget->setLayout(buttonLayout); QVBoxLayout *mainLayout = new QVBoxLayout(); mainLayout->setMargin(0); mainLayout->setSpacing(0); mainLayout->addWidget(buttonPanelWidget); mainLayout->addWidget(listWidget_); setLayout(mainLayout); connect(listClaerAct_, SIGNAL(triggered()), this, SLOT(clearList())); connect(this, SIGNAL(signalItemCreated(QListWidgetItem*,DownloadItem*)), this, SLOT(itemCreated(QListWidgetItem*,DownloadItem*))); connect(&updateInfoTimer_, SIGNAL(timeout()), this, SLOT(updateInfo())); updateInfoTimer_.start(2000); hide(); }
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())); }
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())); }
WebKitBrowser::WebKitBrowser(LiteApi::IApplication *app, QWidget *parent) : QWidget(parent), m_liteApp(app) { QNetworkProxyFactory::setUseSystemConfiguration(true); m_view = new QWebView; m_view->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks); m_locationEdit = new QLineEdit(this); m_locationEdit->setSizePolicy(QSizePolicy::Expanding, m_locationEdit->sizePolicy().verticalPolicy()); connect(m_locationEdit, SIGNAL(returnPressed()), this,SLOT(changeLocation())); connect(m_view, SIGNAL(loadFinished(bool)), this, SLOT(loadFinished(bool))); connect(m_view, SIGNAL(linkClicked(QUrl)),this, SLOT(linkClicked(QUrl))); connect(m_view->page(), SIGNAL(linkHovered(QString,QString,QString)),this,SLOT(linkHovered(QString,QString,QString))); connect(m_view,SIGNAL(statusBarMessage(QString)),this,SLOT(statusBarMessage(QString))); connect(m_view,SIGNAL(loadStarted()),this,SLOT(loadStarted())); connect(m_view,SIGNAL(loadProgress(int)),this,SLOT(loadProgress(int))); QToolBar *toolBar = new QToolBar(tr("Navigation")); toolBar->setIconSize(QSize(16,16)); toolBar->addAction(m_view->pageAction(QWebPage::Back)); toolBar->addAction(m_view->pageAction(QWebPage::Forward)); toolBar->addAction(m_view->pageAction(QWebPage::Reload)); toolBar->addAction(m_view->pageAction(QWebPage::Stop)); toolBar->addWidget(m_locationEdit); m_progressBar = new QProgressBar; m_progressBar->hide(); m_progressBar->setRange(0,100); QVBoxLayout *layout = new QVBoxLayout; layout->setMargin(0); layout->setSpacing(0); layout->addWidget(toolBar); layout->addWidget(m_view); layout->addWidget(m_progressBar); this->setLayout(layout); }
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; }"); }
QToolBar *toAllocBar(QWidget *parent, const QString &str) { QString db; try { db = toConnection::currentConnection(parent).description(false); } catch (QString const& e) { TLOG(1, toDecorator, __HERE__) << " Ignored exception: " << e << std::endl; } catch (...) { TLOG(1, toDecorator, __HERE__) << " Ignored exception." << std::endl; } QString name = str; if (!db.isEmpty() && toConfigurationNewSingle::Instance().option(ToConfiguration::Global::IncludeDbCaptionBool).toBool()) { name += QString::fromLatin1(" "); name += db; } QToolBar *tool; QMainWindow *main = dynamic_cast<QMainWindow *>(parent); if (main) tool = toMainWindow::lookup()->addToolBar(name); else tool = new QToolBar(parent); // Enforce smaller toolbars on mac tool->setIconSize(QSize(16, 16)); tool->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed)); tool->setFocusPolicy(Qt::NoFocus); return tool; }
/*! \internal \brief Creates tool bar used in application. */ void Ui::MainWindow::createToolBar() { QToolBar *toolBar = actionManager->toolBar(Core::ID::TOOL_BAR); toolBar->setObjectName("ToolBar"); addToolBar(toolBar); toolBar->addAction(newAction); toolBar->addAction(newAction); toolBar->addAction(openAction); toolBar->addAction(saveAction); toolBar->addSeparator(); toolBar->addAction(undoAction); toolBar->addAction(redoAction); toolBar->addSeparator(); toolBar->addAction(cutAction); toolBar->addAction(copyAction); toolBar->addAction(pasteAction); toolBar->addSeparator(); toolBar->addAction(preferencesAction); toolBar->setIconSize(QSize(16, 16)); addToolBarBreak(); }
server::server(QWidget *parent) : QWidget(parent), ui(new Ui::server) { setAttribute(Qt::WA_DeleteOnClose); //关闭窗口后调用析构函数 ui->setupUi(this); //添加工具栏 QToolBar *toolbar = new QToolBar(this); //变量还必须在堆中 toolbar->setIconSize(QSize(16,16)); toolbar->addAction(QString("主页")); toolbar->addAction(QString("传输文件")); toolbar->addAction(QString("传输中")); toolbar->addAction(QString("传输历史")); toolbar->addAction(QString("二维码")); connect(toolbar,SIGNAL(actionTriggered(QAction*)),this,SLOT(toolbar_actiontriggered(QAction*))); //处理工具栏点击 ui->tool->layout()->addWidget(toolbar); ui->tool->layout()->setAlignment(Qt::AlignTop); ui->transfering->hide(); ui->qrcode->hide(); ui->verticalLayout_3->setAlignment(Qt::AlignTop); ui->tableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers); //表格禁止编辑 connect(ui->tableWidget,SIGNAL(cellClicked(int,int)),this,SLOT(tablewidget_clicked(int,int))); lastpoint.setX(0); lastpoint.setY(0); endpoint.setX(0); endpoint.setY(0); udpbro = NULL; //udp广播 socketinit(); //初始化udp广播、tcp监听 //初始化http_server http_server = new httpserver(this); http_server->listen(QHostAddress::Any,80); }
QToolBar *ActionManager::insertToolBar(const QString &id, const QString &title, const QString &idBefore) { QToolBar *toolBar = m_idToolBarMap.value(id); if (toolBar) { return toolBar; } toolBar = new QToolBar(title, m_liteApp->mainWindow()); toolBar->setObjectName(id); toolBar->setIconSize(LiteApi::getToolBarIconSize(m_liteApp)); QToolBar *m = 0; if (!idBefore.isEmpty()) { m = m_idToolBarMap.value(idBefore); } if (m) { m_liteApp->mainWindow()->insertToolBar(m,toolBar); } else { m_liteApp->mainWindow()->addToolBar(toolBar); } m_idToolBarMap.insert(id,toolBar); return toolBar; }
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); }