QWidget* CarManagePage::CreateStructureWidget() { QGroupBox* structureWidget = new QGroupBox(); QHBoxLayout* hBox = new QHBoxLayout(); QToolButton* add = new QToolButton(); add->setText("+"); QToolButton* remove = new QToolButton(); remove->setText( "-" ); hBox->addWidget( add ); hBox->addWidget( remove ); hBox->addStretch( 1 ); QTreeWidget* tree = new QTreeWidget(); tree->setColumnCount( 1 ); QTreeWidgetItem* root = new QTreeWidgetItem( QStringList( tr( "DaQing GPS Center") ) ); QTreeWidgetItem* child1 = new QTreeWidgetItem( QStringList( tr( "test1" ) ) ); QTreeWidgetItem* child2 = new QTreeWidgetItem( QStringList( tr( "test2" ) ) ); root->addChild( child1 ); root->addChild( child2 ); root->setCheckState( 0, Qt::Unchecked ); child1->setCheckState( 0, Qt::Unchecked ); child2->setCheckState( 0, Qt::Unchecked ); tree->addTopLevelItem( root ); tree->expandAll(); QVBoxLayout* vBox = new QVBoxLayout(); vBox->addLayout( hBox ); vBox->addWidget( tree ); structureWidget->setLayout( vBox ); return structureWidget; }
CaptureConfigPage::CaptureConfigPage(QWidget *parent) : ConfigPageBase(parent) { QFormLayout *formLayout = new QFormLayout(); setLayout(formLayout); QHBoxLayout *hb = new QHBoxLayout(); mpDir = new QLineEdit(); hb->addWidget(mpDir); QToolButton *bt = new QToolButton(); bt->setText("..."); hb->addWidget(bt); connect(bt, SIGNAL(clicked()), SLOT(selectSaveDir())); bt = new QToolButton(); bt->setText(tr("Browse")); hb->addWidget(bt); connect(bt, SIGNAL(clicked()), SLOT(browseCaptureDir())); formLayout->addRow(tr("Save dir"), hb); mpDir->setEnabled(false); mpDir->setText(Config::instance().captureDir()); mpFormat = new QComboBox(); formLayout->addRow(tr("Save format"), mpFormat); QList<QByteArray> formats; formats << "YUV" << QImageWriter::supportedImageFormats(); foreach (QByteArray fmt, formats) { mpFormat->addItem(fmt); }
LyXFileDialog::LyXFileDialog(QString const & title, QString const & path, QStringList const & filters, FileDialog::Button const & b1, FileDialog::Button const & b2) // FIXME replace that with guiApp->currentView() : QFileDialog(qApp->focusWidget(), title, path) { setNameFilters(filters); setWindowTitle(title); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); setOption(QFileDialog::DontUseNativeDialog); QList<QHBoxLayout *> layout = findChildren<QHBoxLayout *>(); if (!b1.first.isEmpty()) { b1_dir_ = b1.second; QToolButton * tb = new QToolButton(this); connect(tb, SIGNAL(clicked()), this, SLOT(button1Clicked())); tb->setText(b1.first); layout.at(0)->addWidget(tb); } if (!b2.first.isEmpty()) { b2_dir_ = b2.second; QToolButton * tb = new QToolButton(this); connect(tb, SIGNAL(clicked()), this, SLOT(button2Clicked())); tb->setText(b2.first); layout.at(0)->addWidget(tb); } }
/** * Creates and brings up the dialog box which allows the user to * re-label the plot various labes. * */ void ScatterPlotWindow::reLabel() { QDialog *dialog = new QDialog(p_scatterPlotWindow); dialog->setWindowTitle("Name Plot Labels"); QWidget *buttons = new QWidget (dialog); QWidget *textAreas = new QWidget (dialog); QWidget *labels = new QWidget (dialog); QWidget *main = new QWidget (dialog); QVBoxLayout *layout = new QVBoxLayout(); layout->addWidget(main,0); layout->addWidget(buttons,0); dialog->setLayout(layout); QToolButton *okButton = new QToolButton(dialog); connect(okButton,SIGNAL(released()),this,SLOT(setLabels())); connect(okButton,SIGNAL(released()),dialog,SLOT(hide())); okButton->setShortcut(Qt::Key_Enter); okButton->setText("Ok"); QToolButton *cancelButton = new QToolButton(dialog); connect(cancelButton,SIGNAL(released()),dialog,SLOT(hide())); cancelButton->setText("Cancel"); QLabel *plotLabel = new QLabel("Plot Title: "); QLabel *xAxisLabel = new QLabel("X-Axis Label: "); QLabel *yAxisLabel = new QLabel("Y-Axis Label: "); QVBoxLayout *vlayout = new QVBoxLayout(); vlayout->addWidget(plotLabel); vlayout->addWidget(xAxisLabel); vlayout->addWidget(yAxisLabel); labels->setLayout(vlayout); p_plotTitleText = new QLineEdit(p_plot->title().text(),dialog); p_xAxisText = new QLineEdit(p_plot->axisTitle(QwtPlot::xBottom).text(),dialog); p_yAxisText = new QLineEdit(p_plot->axisTitle(QwtPlot::yLeft).text(),dialog); QVBoxLayout *v2layout = new QVBoxLayout(); v2layout->addWidget(p_plotTitleText); v2layout->addWidget(p_xAxisText); v2layout->addWidget(p_yAxisText); textAreas->setLayout(v2layout); QHBoxLayout *mainLayout = new QHBoxLayout(); mainLayout->addWidget(labels); mainLayout->addWidget(textAreas); main->setLayout(mainLayout); QHBoxLayout *hlayout = new QHBoxLayout(); hlayout->addWidget(okButton); hlayout->addWidget(cancelButton); buttons->setLayout(hlayout); dialog->setFixedSize(400,190); dialog->show(); }
void Painter::createToolBar() { QToolBar *toolBar = addToolBar("Tool"); QLabel *label_1 = new QLabel(tr("style:")); styleComboBox = new QComboBox; //复选框 styleComboBox->addItem("SolidLine", Qt::SolidLine); styleComboBox->addItem("DashLine", Qt::DashLine); styleComboBox->addItem("DotLine", Qt::DotLine); styleComboBox->addItem("DashDotLine", Qt::DashDotLine); styleComboBox->addItem("DashDotDotLine", Qt::DashDotDotLine); toolBar->addWidget(label_1); //添加到bar上 toolBar->addWidget(styleComboBox); toolBar->addSeparator(); //添加分割线 connect(styleComboBox, SIGNAL(activated(int)), this, SLOT(slotStyle())); //将选项和设置风格联系起来 QLabel *label_2 = new QLabel(tr("width")); //画笔宽度 -- widthSpinBox = new QSpinBox; widthSpinBox->setRange(0, 10); //范围 toolBar->addWidget(label_2); toolBar->addWidget(widthSpinBox); toolBar->addSeparator(); connect(widthSpinBox, SIGNAL(valueChanged(int)), widget, SLOT(setWidth(int))); //将设置的值和画笔宽度联系起来 // colorBtn = new QToolButton; //颜色 // QPixmap pixmap(20, 20); // pixmap.fill(Qt::black); // colorBtn->setIcon(QIcon(pixmap)); // toolBar->addWidget(colorBtn); // toolBar->addSeparator(); // connect(colorBtn, SIGNAL(clicked()), this, SLOT(slotColor())); QToolButton *clearBtn = new QToolButton; clearBtn->setText(tr("clear")); toolBar->addWidget(clearBtn); toolBar->addSeparator(); connect(clearBtn, SIGNAL(clicked()), widget, SLOT(clear())); QToolButton *prevBtn = new QToolButton; prevBtn->setText(tr("prev")); toolBar->addWidget(prevBtn); toolBar->addSeparator(); connect(prevBtn, SIGNAL(clicked()), widget, SLOT(prev())); QToolButton *nextBtn = new QToolButton; nextBtn->setText(tr("next")); toolBar->addWidget(nextBtn); connect(nextBtn, SIGNAL(clicked()), widget, SLOT(next())); }
QgsBrowserDockWidget::QgsBrowserDockWidget( QWidget * parent ) : QDockWidget( parent ), mModel( NULL ) { setWindowTitle( tr( "Browser" ) ); mBrowserView = new QgsBrowserTreeView( this ); QToolButton* refreshButton = new QToolButton( this ); refreshButton->setIcon( QgsApplication::getThemeIcon( "mActionDraw.png" ) ); // remove this to save space refreshButton->setToolButtonStyle( Qt::ToolButtonTextBesideIcon ); refreshButton->setText( tr( "Refresh" ) ); refreshButton->setToolTip( tr( "Refresh" ) ); refreshButton->setAutoRaise( true ); connect( refreshButton, SIGNAL( clicked() ), this, SLOT( refresh() ) ); QToolButton* addLayersButton = new QToolButton( this ); addLayersButton->setIcon( QgsApplication::getThemeIcon( "mActionAddLayer.png" ) ); // remove this to save space addLayersButton->setToolButtonStyle( Qt::ToolButtonTextBesideIcon ); addLayersButton->setText( tr( "Add Selection" ) ); addLayersButton->setToolTip( tr( "Add Selected Layers" ) ); addLayersButton->setAutoRaise( true ); connect( addLayersButton, SIGNAL( clicked() ), this, SLOT( addSelectedLayers() ) ); QToolButton* collapseButton = new QToolButton( this ); collapseButton->setIcon( QgsApplication::getThemeIcon( "mActionCollapseTree.png" ) ); collapseButton->setToolTip( tr( "Collapse All" ) ); collapseButton->setAutoRaise( true ); connect( collapseButton, SIGNAL( clicked() ), mBrowserView, SLOT( collapseAll() ) ); QVBoxLayout* layout = new QVBoxLayout(); QHBoxLayout* hlayout = new QHBoxLayout(); layout->setContentsMargins( 0, 0, 0, 0 ); layout->setSpacing( 0 ); hlayout->setContentsMargins( 0, 0, 0, 0 ); hlayout->setSpacing( 5 ); hlayout->setAlignment( Qt::AlignLeft ); hlayout->addSpacing( 5 ); hlayout->addWidget( refreshButton ); hlayout->addSpacing( 5 ); hlayout->addWidget( addLayersButton ); hlayout->addStretch( ); hlayout->addWidget( collapseButton ); layout->addLayout( hlayout ); layout->addWidget( mBrowserView ); QWidget* innerWidget = new QWidget( this ); innerWidget->setLayout( layout ); setWidget( innerWidget ); connect( mBrowserView, SIGNAL( customContextMenuRequested( const QPoint & ) ), this, SLOT( showContextMenu( const QPoint & ) ) ); connect( mBrowserView, SIGNAL( doubleClicked( const QModelIndex& ) ), this, SLOT( addLayerAtIndex( const QModelIndex& ) ) ); }
void SensorWidget::createUI() { if(m_pSensorModel) { // Sensor Selection QButtonGroup *qBGSensorSelection = new QButtonGroup; qBGSensorSelection->setExclusive(true); QVBoxLayout *VBoxSensorSelection = new QVBoxLayout; for(qint32 i = 0; i < m_pSensorModel->getSensorGroups().size(); ++i) { QToolButton *sensorSelectionButton = new QToolButton; sensorSelectionButton->setText(m_pSensorModel->getSensorGroups()[i].getGroupName()); qBGSensorSelection->addButton(sensorSelectionButton,i); VBoxSensorSelection->addWidget(sensorSelectionButton); } connect(qBGSensorSelection, static_cast<void (QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked), m_pSensorModel, &SensorModel::applySensorGroup); // Layout Selection QButtonGroup *qBGLayout = new QButtonGroup; qBGLayout->setExclusive(true); QHBoxLayout *HBoxButtonGroupLayout = new QHBoxLayout; for(qint32 i = 0; i < m_pSensorModel->getNumLayouts(); ++i) { QToolButton *buttonLayout = new QToolButton; buttonLayout->setText(m_pSensorModel->getSensorLayouts()[i].getName()); buttonLayout->setCheckable(true); if(i == 0) buttonLayout->setChecked(true); else buttonLayout->setChecked(false); qBGLayout->addButton(buttonLayout, i); HBoxButtonGroupLayout->addWidget(buttonLayout); } connect(qBGLayout, static_cast<void (QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked), m_pSensorModel, &SensorModel::setCurrentLayout); QGridLayout *topLayout = new QGridLayout; topLayout->addWidget(m_pGraphicsView, 0, 0); topLayout->addLayout(VBoxSensorSelection, 0, 1); topLayout->addLayout(HBoxButtonGroupLayout, 1, 0); setLayout(topLayout); } }
void retranslateUi(QDialog *MVPPlayerRemoteDialog) { MVPPlayerRemoteDialog->setWindowTitle(QApplication::translate("MVPPlayerRemoteDialog", "MVPPlayer - Remote", 0)); lblVol->setText(QString()); btnServer->setText(QApplication::translate("MVPPlayerRemoteDialog", "C", 0)); cbMute->setText(QApplication::translate("MVPPlayerRemoteDialog", "Mute", 0)); label->setText(QApplication::translate("MVPPlayerRemoteDialog", "Current track:", 0)); lblCurrentTrack->setText(QString()); lblTrackLength->setText(QString()); btnClearPlaylist->setText(QApplication::translate("MVPPlayerRemoteDialog", "x", 0)); lblPlaylist->setText(QApplication::translate("MVPPlayerRemoteDialog", "Playlist:", 0)); } // retranslateUi
ListLayoutRow::ListLayoutRow(QWidget *widget, QWidget *parent, const bool &moveEnabled) : QFrame(parent) { m_widget = widget; m_upButton = m_downButton = 0; setMidLineWidth(0); setLineWidth(1); setFrameStyle(QFrame::Box); setFrameShadow(QFrame::Sunken); setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); QToolButton *removeButton = new QToolButton(this); removeButton->setIcon(KIcon("list-remove")); removeButton->setText(i18n("Remove")); removeButton->setToolTip(i18n("Remove")); connect(removeButton, SIGNAL(clicked()), this, SLOT(removeClicked())); KSeparator *separator = new KSeparator(Qt::Vertical); QHBoxLayout *layout = new QHBoxLayout; if (moveEnabled) { QToolButton *upButton = new QToolButton(this); upButton->setIcon(KIcon("go-up")); upButton->setText(i18n("Move up")); upButton->setToolTip(i18n("Move up")); QToolButton *downButton = new QToolButton(this); downButton->setIcon(KIcon("go-down")); downButton->setText(i18n("Move down")); downButton->setToolTip(i18n("Move down")); connect(upButton, SIGNAL(clicked()), this, SLOT(upClicked())); connect(downButton, SIGNAL(clicked()), this, SLOT(downClicked())); layout->addWidget(upButton); layout->addWidget(downButton); m_upButton = upButton; m_downButton = downButton; } layout->addWidget(removeButton); layout->addWidget(separator); layout->addWidget(m_widget); setLayout(layout); }
VESPERSBeamSelectorView::VESPERSBeamSelectorView(QWidget *parent) : QWidget(parent) { currentBeam_ = 0; beams_ = new QButtonGroup; QToolButton *temp = new QToolButton; temp->setText("Pink"); temp->setFixedSize(35, 22); temp->setCheckable(true); beams_->addButton(temp, 0); temp = new QToolButton; temp->setText("10%"); temp->setFixedSize(35, 22); temp->setCheckable(true); beams_->addButton(temp, 1); temp = new QToolButton; temp->setText("1.6%"); temp->setFixedSize(35, 22); temp->setCheckable(true); beams_->addButton(temp, 2); temp = new QToolButton; temp->setText("Si"); temp->setFixedSize(35, 22); temp->setCheckable(true); beams_->addButton(temp, 3); connect(beams_, SIGNAL(buttonClicked(int)), this, SLOT(changeBeam(int))); connect(VESPERSBeamline::vespers(), SIGNAL(currentBeamChanged(VESPERS::Beam)), this, SLOT(onCurrentBeamChanged(VESPERS::Beam))); progressBar_ = new QProgressBar; progressBar_->hide(); progressBar_->setRange(0, 100); QHBoxLayout *buttonsLayout = new QHBoxLayout; buttonsLayout->addWidget(beams_->button(0)); buttonsLayout->addWidget(beams_->button(1)); buttonsLayout->addWidget(beams_->button(2)); buttonsLayout->addWidget(beams_->button(3)); QVBoxLayout *beamSelectorLayout = new QVBoxLayout; beamSelectorLayout->addLayout(buttonsLayout); beamSelectorLayout->addWidget(progressBar_); setLayout(beamSelectorLayout); }
Ecg2Ch::Ecg2Ch(QWidget *parent) : QWidget(parent) { QVBoxLayout *mainLayout = new QVBoxLayout; QToolBar *toolBar = new QToolBar(this); QToolButton *toolButton = new QToolButton(toolBar); toolButton->setText("test()"); toolBar->addWidget(toolButton); mainLayout->addWidget(toolBar); QWidget *plotsWidget = new QWidget(this); QVBoxLayout *plotsLayout = new QVBoxLayout(plotsWidget); EcgCh *plot1 = new EcgCh(plotsWidget); EcgCh *plot2 = new EcgCh(plotsWidget); plotsLayout->addWidget(plot1); plotsLayout->addWidget(plot2); plotsWidget->setLayout(plotsLayout); mainLayout->addWidget(plotsWidget); setLayout(mainLayout); ch1 = plot1; ch2 = plot2; connect(toolButton, SIGNAL(clicked()), SLOT(test())); }
MyWidget::MyWidget(QWidget *parent) : QWidget(parent) { // QPushButton *quit = new QPushButton(tr("Quit")); QToolButton *quit = new QToolButton(); quit->setText(tr("Quit")); quit->setFont(QFont("Times", 18, QFont::Bold)); quit->setMinimumSize(150, 50); QLCDNumber *lcd = new QLCDNumber(2); lcd->setSegmentStyle(QLCDNumber::Filled); lcd->setMinimumSize(150, 150); QSlider *slider = new QSlider(Qt::Horizontal); slider->setRange(0, 99); slider->setValue(0); connect(quit, SIGNAL(clicked()), qApp, SLOT(quit())); connect(slider, SIGNAL(valueChanged(int)), lcd, SLOT(display(int))); QVBoxLayout *layout = new QVBoxLayout; layout->addWidget(lcd); layout->addWidget(slider); layout->addWidget(quit); setLayout(layout); }
QToolBar* MainWindow::createFormatToolBar() { QToolBar *pFormatBar = new QToolBar(); pFormatBar->setWindowTitle( "Format Bar" ); m_pCmbFont = new QFontComboBox; m_pCmbFont->setEditable( false ); m_pCmbFont->setFocusPolicy( Qt::NoFocus ); m_pCmbFontPointSize = new QComboBox; updateFontPointSize( m_pCmbFont->currentText() ); m_pCmbFontPointSize->setFocusPolicy( Qt::NoFocus ); QToolButton *pBtnMoreOptions = new QToolButton; pBtnMoreOptions->setText( "More..." ); pBtnMoreOptions->setStyleSheet( "border: 1px solid #000000" ); pBtnMoreOptions->setFixedHeight( 20 ); pBtnMoreOptions->setFocusPolicy( Qt::NoFocus ); pFormatBar->addWidget( m_pCmbFont ); pFormatBar->addWidget( m_pCmbFontPointSize ); pFormatBar->addWidget( pBtnMoreOptions ); connect( m_pCmbFont, SIGNAL(currentIndexChanged(int)), this, SLOT(onFontFamilyChanged()) ); connect( m_pCmbFontPointSize, SIGNAL(currentIndexChanged(int)), this, SLOT(onFontPointSizeChanged()) ); connect( pBtnMoreOptions, SIGNAL(clicked()), this, SLOT(onFormatMoreBtnClicked()) ); return pFormatBar; }
RackWidget::RackWidget(ConstraintInspectorWidget* parent) : QWidget {parent}, m_model {parent->model() }, m_parent {parent} { QGridLayout* lay = new QGridLayout{this}; lay->setContentsMargins(1, 1, 0, 0); this->setLayout(lay); // Button QToolButton* addButton = new QToolButton{this}; addButton->setText("+"); connect(addButton, &QToolButton::pressed, [ = ]() { parent->createRack(); }); // Text auto addText = new QLabel{"Add Rack", this}; addText->setStyleSheet(QString{"text-align : left;"}); // For each view model, a rack chooser. viewModelsChanged(); // Layout setup lay->addWidget(addButton, 0, 0); lay->addWidget(addText, 0, 1); //lay->addWidget(m_rackList, 1, 0, 1, 2); }
void EFFEditorScenePanel::drawModeMenuPressed(QAction * action) { QToolButton * drawMode = qobject_cast<QToolButton *>(action->parentWidget()->parentWidget()); drawMode->setText(action->text()); if ( action->text() == tr("Wireframe") ) { static bool firstTime = true; static EFFNetClient * client = NULL; if ( firstTime ) { client = new EFFNetClient(); client->Init(); client->Connect(_effT("tcp://localhost:5555")); firstTime = false; } EFFObjectManager * objectManager = EFFGetObjectManager(EFF3DObject::GetThisClass()); EFF3DObject * gameObject = (EFF3DObject *)objectManager->GetObject(1); EFFComponent * component = gameObject->GetComponent(0); client->Send(gameObject, effString(_effT("Name"))); //client->Shutdown(); } }
QAbstractButton *DialogButtonBox::addButton(const QString &trContext, const QString &unTrText, const QIcon &icon, ButtonRole role) { QToolButton *but = new QToolButton(this); but->setText(QCoreApplication::translate(trContext.toUtf8(), unTrText.toUtf8())); but->setIcon(icon); return but; }
void CollocationsDialogController::sl_addName() { QString name = ((QAction*)sender())->text(); assert(allNames.contains(name)); assert(!usedNames.contains(name)); bool remove = false; //UGENE-2318 inserting and removed unused item because of QT bug if(annotationsTree->topLevelItemCount() == 1) remove = true; usedNames.insert(name); AnnotationSettingsRegistry* asr = AppContext::getAnnotationsSettingsRegistry(); QColor c = asr->getAnnotationSettings(name)->color; QTreeWidgetItem* item = new QTreeWidgetItem(); item->setText(0, name); item->setIcon(0, GUIUtils::createSquareIcon(c, 10)); QToolButton* minusButton = new QToolButton(annotationsTree); minusButton->setMinimumSize(plusButton->size()); minusButton->setText("-"); minusButton->setObjectName(name); annotationsTree->insertTopLevelItem(annotationsTree->topLevelItemCount()-1, item); annotationsTree->setItemWidget(item, 1, minusButton); //UGENE-2318 if(remove){ QTreeWidgetItem* ii = new QTreeWidgetItem(); int index = annotationsTree->topLevelItemCount()-1; annotationsTree->insertTopLevelItem(index, ii); annotationsTree->takeTopLevelItem(index); delete ii; } connect(minusButton, SIGNAL(clicked()), SLOT(sl_minusClicked())); updateState(); }
Plot3D::Plot3D(QWidget *parent, Data *dat) : QMainWindow(parent) { // pointers data = dat; // create 3D surface setData(); // design widget QToolBar *toolBar = new QToolBar(this); QToolButton *btnSpectrogram = new QToolButton(toolBar); QToolButton *btnContour = new QToolButton(toolBar); QToolButton *btnPrint = new QToolButton(toolBar); btnPrint->setText("Print"); btnPrint->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); toolBar->addWidget(btnPrint); addToolBar(toolBar); connect(btnPrint, SIGNAL(clicked()), this, SLOT(printPlot())); btnSpectrogram->setChecked(true); btnContour->setChecked(false); }
FileEdit::FileEdit(QWidget *parent) : QWidget(parent) , mErrorTextColor(Qt::red) { QHBoxLayout *layout = new QHBoxLayout(this); layout->setMargin(0); layout->setSpacing(0); mLineEdit = new QLineEdit(this); mLineEdit->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred)); mOkTextColor = mLineEdit->palette().color(QPalette::Active, QPalette::Text); QToolButton *button = new QToolButton(this); button->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred)); button->setFixedWidth(20); button->setText(QLatin1String("...")); layout->addWidget(mLineEdit); layout->addWidget(button); setFocusProxy(mLineEdit); setFocusPolicy(Qt::StrongFocus); setAttribute(Qt::WA_InputMethodEnabled); connect(mLineEdit, &QLineEdit::textEdited, this, &FileEdit::textEdited); connect(mLineEdit, &QLineEdit::textChanged, this, &FileEdit::validate); connect(button, &QAbstractButton::clicked, this, &FileEdit::buttonClicked); }
void FileRenamerDlgImpl::createButtons() { QBoxLayout* pLayout (dynamic_cast<QBoxLayout*>(m_pButtonsW->layout())); CB_ASSERT (0 != pLayout); /*int nPos (pLayout->indexOf(pOldBtn)); pLayout->insertWidget(nPos, this);*/ QObjectList l (m_pButtonsW->children()); //qDebug("cnt: %d", l.size()); for (int i = 1, n = l.size(); i < n; ++i) // l[0] is m_pButtonsW's layout (note that m_pAlbumTypeL is in m_pBtnPanelW) { delete l[i]; } for (int i = 0, n = cSize(m_vstrPatterns); i < n; ++i) { QToolButton* p (new QToolButton(m_pButtonsW)); p->setText(toNativeSeparators(convStr(m_vstrPatterns[i]))); p->setCheckable(true); m_pButtonGroup->addButton(p, m_nBtnId++); //p->setAutoExclusive(true); connect(p, SIGNAL(clicked()), this, SLOT(onPatternClicked())); pLayout->insertWidget(i, p); } }
EmptyServiceCallInterfaceAction::EmptyServiceCallInterfaceAction( QWidget* parent ) : rviz::Panel( parent ) { parseROSParameters(); QHBoxLayout* h_layout = new QHBoxLayout; h_layout->setAlignment(Qt::AlignLeft); layout = new QVBoxLayout(); signal_mapper = new QSignalMapper(this); for(size_t i = 0; i < service_call_button_infos_.size();i++){ ServiceCallButtonInfo target_button = service_call_button_infos_[i]; QToolButton* tbutton = new QToolButton(this); tbutton->setText(target_button.text.c_str()); tbutton->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); tbutton->setIconSize(QSize(100, 100)); tbutton->setIcon(QIcon(QPixmap(QString(target_button.icon_file_path.c_str())))); connect(tbutton, SIGNAL(clicked()), signal_mapper, SLOT(map())); signal_mapper->setMapping(tbutton, i); h_layout->addWidget(tbutton); }; connect(signal_mapper, SIGNAL(mapped(int)), this, SLOT(callRequestEmptyCommand(int))); layout->addLayout(h_layout); setLayout( layout ); }
HelpQuery::HelpQuery(QWidget* parent) : QWidgetAction(parent) { mapper = new QSignalMapper(this); w = new QWidget(parent); QHBoxLayout* layout = new QHBoxLayout; QLabel* label = new QLabel; label->setText(tr("Search for: ")); layout->addWidget(label); entry = new QLineEdit; layout->addWidget(entry); QToolButton* button = new QToolButton; button->setText("x"); layout->addWidget(button); w->setLayout(layout); setDefaultWidget(w); emptyState = true; connect(button, SIGNAL(clicked()), entry, SLOT(clear())); connect(entry, SIGNAL(textChanged(const QString&)), SLOT(textChanged(const QString&))); connect(entry, SIGNAL(returnPressed()), SLOT(returnPressed())); connect(mapper, SIGNAL(mapped(QObject*)), SLOT(actionTriggered(QObject*))); }
QgsFilterAlgorithmConfigurationWidget::QgsFilterAlgorithmConfigurationWidget( QWidget *parent ) : QgsProcessingAlgorithmConfigurationWidget( parent ) { setContentsMargins( 0, 0, 0, 0 ); mOutputExpressionWidget = new QTableWidget(); mOutputExpressionWidget->setColumnCount( 3 ); mOutputExpressionWidget->setHorizontalHeaderItem( 0, new QTableWidgetItem( tr( "Output Name" ) ) ); mOutputExpressionWidget->setHorizontalHeaderItem( 1, new QTableWidgetItem( tr( "Filter Expression" ) ) ); mOutputExpressionWidget->setHorizontalHeaderItem( 2, new QTableWidgetItem( tr( "Final Output" ) ) ); mOutputExpressionWidget->horizontalHeader()->setResizeMode( 1, QHeaderView::Stretch ); QGridLayout *layout = new QGridLayout(); setLayout( layout ); layout->addWidget( new QLabel( tr( "Outputs and filters" ) ), 0, 0, 1, 2 ); layout->addWidget( mOutputExpressionWidget, 1, 0, 4, 1 ); QToolButton *addOutputButton = new QToolButton(); addOutputButton->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionAddLayer.svg" ) ) ); addOutputButton->setText( tr( "Add Output" ) ); QToolButton *removeOutputButton = new QToolButton(); removeOutputButton->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionRemoveLayer.svg" ) ) ); removeOutputButton->setToolTip( tr( "Remove Selected Outputs" ) ); layout->addWidget( addOutputButton, 2, 1, 1, 1 ); layout->addWidget( removeOutputButton, 3, 1, 1, 1 ); connect( addOutputButton, &QToolButton::clicked, this, &QgsFilterAlgorithmConfigurationWidget::addOutput ); connect( removeOutputButton, &QToolButton::clicked, this, &QgsFilterAlgorithmConfigurationWidget::removeSelectedOutputs ); connect( mOutputExpressionWidget->selectionModel(), &QItemSelectionModel::selectionChanged, this, [removeOutputButton, this] { removeOutputButton->setEnabled( !mOutputExpressionWidget->selectionModel()->selectedIndexes().isEmpty() ); } ); }
void MainWindow::createStatusBar() { QColor windowColor = palette().window().color(); QColor buttonBgColor = windowColor.lighter(105); QColor buttonBorderBgColor = windowColor.darker(120); QColor buttonPressedColor = windowColor.darker(102); QToolButton *log = new QToolButton(this); log->setText("Logs"); log->setCheckable(true); log->setDefaultAction(_logDock->toggleViewAction()); log->setStyleSheet(QString( "QToolButton {" " background-color: %1;" " border-style: outset;" " border-width: 1px;" " border-radius: 3px;" " border-color: %2;" " padding: 1px 20px 1px 20px;" "} \n" "" "QToolButton:checked, QToolButton:pressed {" " background-color: %3;" " border-style: inset;" "}") .arg(buttonBgColor.name()) .arg(buttonBorderBgColor.name()) .arg(buttonPressedColor.name())); statusBar()->insertWidget(0, log); statusBar()->setStyleSheet("QStatusBar::item { border: 0px solid black };"); }
ActivitySelector::ActivitySelector(QWidget *parent) : QWidget(parent), m_plugin(ClearCasePlugin::instance()), m_changed(false) { QTC_ASSERT(m_plugin->isUcm(), return); QHBoxLayout *hboxLayout = new QHBoxLayout(this); hboxLayout->setContentsMargins(0, 0, 0, 0); QLabel *lblActivity = new QLabel(tr("Select &activity:")); lblActivity->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred); hboxLayout->addWidget(lblActivity); m_cmbActivity = new QComboBox(this); m_cmbActivity->setMinimumSize(QSize(350, 0)); hboxLayout->addWidget(m_cmbActivity); QString addText = tr("Add"); if (!m_plugin->settings().autoAssignActivityName) addText.append(QLatin1String("...")); QToolButton *btnAdd = new QToolButton; btnAdd->setText(addText); hboxLayout->addWidget(btnAdd); #ifndef QT_NO_SHORTCUT lblActivity->setBuddy(m_cmbActivity); #endif // QT_NO_SHORTCUT connect(btnAdd, SIGNAL(clicked()), this, SLOT(newActivity())); refresh(); connect(m_cmbActivity, SIGNAL(currentIndexChanged(int)), this, SLOT(userChanged())); }
Widget::Widget( QWidget *pParent ) : QWidget( pParent ), d( new Private( this ) ) { Manager::registerWidget( this ); connect( Manager::instance(), SIGNAL(aggregationsChanged()), this, SLOT(aggregationsChanged() ) ); connect( Manager::instance(), SIGNAL(themesChanged()), this, SLOT(themesChanged() ) ); setAutoFillBackground( true ); setObjectName( QLatin1String( "messagelistwidget" ) ); QGridLayout * g = new QGridLayout( this ); g->setMargin( 2 ); // use a smaller default g->setSpacing( 2 ); d->mSearchEdit = new KLineEdit( this ); d->mSearchEdit->setClickMessage( i18nc( "Search for messages.", "Search" ) ); d->mSearchEdit->setObjectName( QLatin1String( "quicksearch" ) ); d->mSearchEdit->setClearButtonShown( true ); connect( d->mSearchEdit, SIGNAL( textEdited( const QString & ) ), SLOT( searchEditTextEdited( const QString & ) ) ); connect( d->mSearchEdit, SIGNAL( clearButtonClicked() ), SLOT( searchEditClearButtonClicked() ) ); g->addWidget( d->mSearchEdit, 0, 0 ); // The status filter button. Will be populated later, as populateStatusFilterCombo() is virtual d->mStatusFilterCombo = new KComboBox( this ) ; g->addWidget( d->mStatusFilterCombo, 0, 1 ); // The "Open Full Search" button QToolButton * tb = new QToolButton( this ); tb->setIcon( KIcon( QLatin1String( "edit-find-mail" ) ) ); tb->setText( i18n( "Open Full Search" ) ); tb->setToolTip( tb->text() ); g->addWidget( tb, 0, 2 ); connect( tb, SIGNAL( clicked() ), this, SIGNAL( fullSearchRequest() ) ); d->mView = new View( this ); d->mView->setSortOrder( &d->mSortOrder ); d->mView->setObjectName( QLatin1String( "messagealistview" ) ); g->addWidget( d->mView, 1, 0, 1, 6 ); connect( d->mView->header(), SIGNAL( sectionClicked( int ) ), SLOT( slotViewHeaderSectionClicked( int ) ) ); g->setRowStretch( 1, 1 ); g->setColumnStretch( 0, 1 ); d->mSearchEdit->setEnabled( false ); d->mStatusFilterCombo->setEnabled( false ); d->mSearchTimer = 0; }
void BookmarksToolBar::build() { clear(); for (int i = 0; i < m_bookmarksModel->rowCount(m_root); ++i) { QModelIndex idx = m_bookmarksModel->index(i, 0, m_root); if (m_bookmarksModel->hasChildren(idx)) { QToolButton *button = new QToolButton(this); button->setPopupMode(QToolButton::InstantPopup); button->setArrowType(Qt::DownArrow); button->setText(idx.data().toString()); ModelMenu *menu = new ModelMenu(this); connect(menu, SIGNAL(activated(QModelIndex)), this, SLOT(activated(QModelIndex))); menu->setModel(m_bookmarksModel); menu->setRootIndex(idx); menu->addAction(new QAction(menu)); button->setMenu(menu); button->setToolButtonStyle(Qt::ToolButtonTextOnly); QAction *a = addWidget(button); a->setText(idx.data().toString()); } else { QAction *action = addAction(idx.data().toString()); action->setData(idx.data(BookmarksModel::UrlRole)); } } }
void CSSEdit::colorSelectClicked() { QToolButton *colorButton; QString propertyName; if (sender() == m_colorButton) { colorButton = m_colorButton; propertyName = "color"; } else if (sender() == m_backgroundButton) { colorButton = m_backgroundButton; propertyName = "background-color"; } else return; if (! m_elements.contains(m_currentElement)) return; Element *element = &m_elements[m_currentElement]; Element parentElement = getParentElement(m_currentElement); QColor color = QColorDialog::getColor(QColor(colorButton->text()), this); if (color.isValid()) { colorButton->setText(color.name()); QPalette palette = colorButton->palette(); palette.setColor(QPalette::Normal, QPalette::ButtonText, color); colorButton->setPalette(palette); if (parentElement[propertyName] == color.name()) element->remove(propertyName); else element->insert(propertyName, color.name()); updatePreview(); } }
void MainWindow::about() { QLabel *label = new QLabel; QLabel *pix = new QLabel; label->setText(tr("<p><b>关于</b></p> " "<p>版本: 1.0</p>" "<p>库: Qt 4.8.1</p>" "<p>数据库: Sqlite</p>" "<p>作者: 唐昊</p> " "<p>Email:thddaniel92gmail.com</p>")); pix->setPixmap(QPixmap("images/money.png")); QToolButton *btn = new QToolButton; btn->setMinimumSize(60,40); btn->setText(tr("关闭")); QHBoxLayout *layout = new QHBoxLayout; layout->addWidget(pix); layout->addWidget(label); QHBoxLayout *layout2 = new QHBoxLayout; //layout2->addStretch(12); layout2->addWidget(btn,Qt::AlignHCenter); //layout2->addStretch(12); QVBoxLayout *layout3 = new QVBoxLayout; layout3->addLayout(layout); layout3->addLayout(layout2); QDialog *dlg = new QDialog; connect(btn,SIGNAL(clicked()),dlg,SLOT(close())); dlg->setWindowTitle(tr("关于")); dlg->setAttribute(Qt::WA_DeleteOnClose); dlg->setLayout(layout3); dlg->exec(); }
MainWindow::MainWindow( QWidget *parent ): QMainWindow( parent ) { d_plot = new Plot( this ); setCentralWidget( d_plot ); QToolBar *toolBar = new QToolBar( this ); QComboBox *typeBox = new QComboBox( toolBar ); typeBox->addItem( "Bars" ); typeBox->addItem( "CandleSticks" ); typeBox->setCurrentIndex( 1 ); typeBox->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); QToolButton *btnExport = new QToolButton( toolBar ); btnExport->setText( "Export" ); btnExport->setToolButtonStyle( Qt::ToolButtonTextUnderIcon ); connect( btnExport, SIGNAL( clicked() ), d_plot, SLOT( exportPlot() ) ); toolBar->addWidget( typeBox ); toolBar->addWidget( btnExport ); addToolBar( toolBar ); d_plot->setMode( typeBox->currentIndex() ); connect( typeBox, SIGNAL( currentIndexChanged( int ) ), d_plot, SLOT( setMode( int ) ) ); }