void PdfViewer::showToolBarStylePopupMenu(const QPoint &pos) { QMenu *popupMenu = new QMenu(this); popupMenu->setAttribute(Qt::WA_DeleteOnClose); popupMenu->move(mapToGlobal(QPoint(0,0)) + pos); QWidgetAction *iconOnlyAction = new QWidgetAction(popupMenu); QRadioButton *iconOnlyRadio = new QRadioButton(tr("&Icons Only"), popupMenu); iconOnlyAction->setDefaultWidget(iconOnlyRadio); QWidgetAction *textOnlyAction = new QWidgetAction(popupMenu); QRadioButton *textOnlyRadio = new QRadioButton(tr("&Text Only"), popupMenu); textOnlyAction->setDefaultWidget(textOnlyRadio); QWidgetAction *textBesideIconAction = new QWidgetAction(popupMenu); QRadioButton *textBesideIconRadio = new QRadioButton(tr("Text &Alongside Icons"), popupMenu); textBesideIconAction->setDefaultWidget(textBesideIconRadio); QWidgetAction *textUnderIconAction = new QWidgetAction(popupMenu); QRadioButton *textUnderIconRadio = new QRadioButton(tr("Text &Under Icons"), popupMenu); textUnderIconAction->setDefaultWidget(textUnderIconRadio); QButtonGroup *popupButtonGroup = new QButtonGroup(popupMenu); popupButtonGroup->addButton(iconOnlyRadio); popupButtonGroup->addButton(textOnlyRadio); popupButtonGroup->addButton(textBesideIconRadio); popupButtonGroup->addButton(textUnderIconRadio); popupButtonGroup->setId(iconOnlyRadio, 0); popupButtonGroup->setId(textOnlyRadio, 1); popupButtonGroup->setId(textBesideIconRadio, 2); popupButtonGroup->setId(textUnderIconRadio, 3); connect(popupButtonGroup, SIGNAL(buttonClicked(int)), this, SLOT(slotChangeToolBarStyle(int))); popupMenu->addAction(iconOnlyAction); popupMenu->addAction(textOnlyAction); popupMenu->addAction(textBesideIconAction); popupMenu->addAction(textUnderIconAction); popupMenu->setContentsMargins(5, 0, 5, 0); QSettings settings; settings.beginGroup("MainWindow"); const int toolBarStyleNumber = settings.value("ToolBarStyle", 0).toInt(); switch (toolBarStyleNumber) { case 0: iconOnlyRadio->setChecked(true); break; case 1: textOnlyRadio->setChecked(true); break; case 2: textBesideIconRadio->setChecked(true); break; case 3: textUnderIconRadio->setChecked(true); break; } settings.endGroup(); popupMenu->show(); // make sure that the popupMenu stays completely inside the screen (must be done after popupMenu->show() in order to have the correct width) const int desktopWidth = QApplication::desktop()->availableGeometry(this).width(); if (popupMenu->x() + popupMenu->width() > desktopWidth) popupMenu->move(desktopWidth - popupMenu->width(), popupMenu->y()); }
//------------------------------------------------------------------------------------------------ // To create the group of radiobuttons for cell constituent selection. // This uses information about active constituents fetched from the DLL. // Need to distinguish field constituent from cell constituent, because for the cell we are // interested in CFSE, volume, O2byvol in addition to the dissolved constituents: // oxygen, glucose, drugA, drugB, metabolites... //------------------------------------------------------------------------------------------------ void Field::setCellConstituentButtons(QGroupBox *gbox, QButtonGroup *bg, QVBoxLayout **vbox, QList<QRadioButton *> *rb_list, QString tag) { int ivar; QString name, str, ivar_str; QRadioButton *rb; LOG_QMSG("setCellConstituentButtons: " + tag); if (rb_list->length() != 0) { LOG_MSG("rb_list not NULL, delete it"); for (ivar=0; ivar<rb_list->length(); ivar++) { rb = (*rb_list)[ivar]; bg->removeButton(rb); delete rb; } rb_list->clear(); } if (!*vbox) { LOG_MSG("vbox = NULL, create it"); *vbox = new QVBoxLayout; gbox->setLayout(*vbox); } name = "rb_cell_constituent_"+tag; LOG_QMSG(name); sprintf(msg,"rb_list: %p vbox: %p bg: %p nvars_used: %d",rb_list,*vbox,bg,Global::nvars_used); LOG_MSG(msg); for (ivar=0; ivar<Global::nvars_used; ivar++) { ivar_str = QString::number(ivar); str = Global::var_string[ivar]; rb = new QRadioButton; rb->setText(str); rb->setObjectName(name+ivar_str); (*vbox)->addWidget(rb); rb->setEnabled(true); bg->addButton(rb,ivar); rb_list->append(rb); // LOG_QMSG(rb->objectName()); } LOG_MSG("added buttons"); if (tag.contains("FACS")) { (*rb_list)[0]->setChecked(true); // CFSE } else { (*rb_list)[1]->setChecked(true); // Oxygen } QRect rect = gbox->geometry(); rect.setHeight(25*Global::nvars_used); gbox->setGeometry(rect); gbox->show(); }
QGroupBox *ServerDialog::createGameModeBox(){ QGroupBox *mode_box = new QGroupBox(tr("Game mode")); mode_group = new QButtonGroup; QVBoxLayout *layout = new QVBoxLayout; { // normal modes QMap<QString, QString> modes = Sanguosha->getAvailableModes(); QMapIterator<QString, QString> itor(modes); while(itor.hasNext()){ itor.next(); QRadioButton *button = new QRadioButton(itor.value()); button->setObjectName(itor.key()); layout->addWidget(button); mode_group->addButton(button); if(itor.key() == Config.GameMode) button->setChecked(true); } } { // add scenario modes QRadioButton *scenario_button = new QRadioButton(tr("Scenario mode")); scenario_button->setObjectName("scenario"); layout->addWidget(scenario_button); mode_group->addButton(scenario_button); scenario_combobox = new QComboBox; QStringList names = Sanguosha->getScenarioNames(); foreach(QString name, names){ QString scenario_name = Sanguosha->translate(name); const Scenario *scenario = Sanguosha->getScenario(name); int count = scenario->getPlayerCount(); QString text = tr("%1 (%2 persons)").arg(scenario_name).arg(count); scenario_combobox->addItem(text, name); } layout->addWidget(scenario_combobox); if(mode_group->checkedButton() == NULL){ int index = names.indexOf(Config.GameMode); if(index != -1){ scenario_button->setChecked(true); scenario_combobox->setCurrentIndex(index); } } }
RKRadio::RKRadio (const QDomElement &element, RKComponent *parent_component, QWidget *parent_widget) : RKComponent (parent_component, parent_widget) { RK_TRACE (PLUGIN); // create and register properties addChild ("string", string = new RKComponentPropertyBase (this, false)); connect (string, SIGNAL (valueChanged (RKComponentPropertyBase *)), this, SLOT (propertyChanged (RKComponentPropertyBase *))); addChild ("number", number = new RKComponentPropertyInt (this, true, -1)); connect (number, SIGNAL (valueChanged (RKComponentPropertyBase *)), this, SLOT (propertyChanged (RKComponentPropertyBase *))); // get xml-helper XMLHelper *xml = XMLHelper::getStaticHelper (); // create layout QVBoxLayout *vbox = new QVBoxLayout (this, RKGlobals::spacingHint ()); // create ButtonGroup group = new QButtonGroup (xml->getStringAttribute (element, "label", i18n ("Select one:"), DL_INFO), this); // create internal layout for the buttons in the ButtonGroup group->setColumnLayout (0, Qt::Vertical); group->layout()->setSpacing (RKGlobals::spacingHint ()); group->layout()->setMargin (RKGlobals::marginHint ()); QVBoxLayout *group_layout = new QVBoxLayout (group->layout(), RKGlobals::spacingHint ()); // create all the options XMLChildList option_elements = xml->getChildElements (element, "option", DL_ERROR); int checked = 0; int i = 0; for (XMLChildList::const_iterator it = option_elements.begin (); it != option_elements.end (); ++it) { QRadioButton *button = new QRadioButton (xml->getStringAttribute (*it, "label", QString::null, DL_ERROR), group); options.insert (i, xml->getStringAttribute (*it, "value", QString::null, DL_WARNING)); group_layout->addWidget (button); if (xml->getBoolAttribute (*it, "checked", false, DL_INFO)) { button->setChecked (true); checked = i; } ++i; } updating = false; number->setIntValue (checked); // will also take care of checking the correct button number->setMin (0); number->setMax (i-1); vbox->addWidget (group); connect (group, SIGNAL (clicked (int)), this, SLOT (buttonClicked (int))); // initialize buttonClicked (group->selectedId ()); }
//------------------------------------------------------------------------------------------------ // To create the group of radiobuttons for field constituent selection. // This uses information about active constituents fetched from the DLL. // Need to distinguish field constituent from cell constituent, because for the // field we have only the dissolved constituents: // oxygen, glucose, drugA, drugB, metabolites... //------------------------------------------------------------------------------------------------ void Field::setFieldConstituentButtons(QGroupBox *gbox, QButtonGroup *bg, QVBoxLayout **vbox, QList<QRadioButton *> *rb_list, QString tag) { int ivar; QString name, str, ivar_str; QRadioButton *rb; Global::nfieldvars_used = Global::nvars_used - Global::N_EXTRA; // LOG_QMSG("setFieldConstituentButtons: " + tag + " nfieldvars_used: " // + QString::number(Global::nfieldvars_used)); if (rb_list->length() != 0) { LOG_MSG("rb_list not NULL, delete it"); for (ivar=0; ivar<rb_list->length(); ivar++) { rb = (*rb_list)[ivar]; bg->removeButton(rb); delete rb; } rb_list->clear(); } if (!*vbox) { LOG_MSG("vbox = NULL, create it"); *vbox = new QVBoxLayout; gbox->setLayout(*vbox); } name = "rb_field_constituent_"+tag; // LOG_QMSG(name); for (ivar=0; ivar<Global::nfieldvars_used; ivar++) { ivar_str = QString::number(ivar); str = Global::var_string[ivar+1]; rb = new QRadioButton; rb->setText(str); QString objname = name+ivar_str; rb->setObjectName(objname); (*vbox)->addWidget(rb); rb->setEnabled(true); bg->addButton(rb,ivar); rb_list->append(rb); // QRadioButton *chkrb = gbox->findChild<QRadioButton *>(objname); // if (chkrb) { // QString chkstr = chkrb->objectName(); // LOG_QMSG(chkstr); // } else { // chkrb = (*rb_list)[ivar]; // LOG_QMSG("findChild failed, but: " + chkrb->objectName()); // } } (*rb_list)[0]->setChecked(true); // Oxygen QRect rect = gbox->geometry(); rect.setHeight(25*(Global::nfieldvars_used + 1)); gbox->setGeometry(rect); gbox->show(); }
void mtsIntuitiveResearchKitConsoleQtWidget::setupUi(void) { QGridLayout * frameLayout = new QGridLayout; QGroupBox * groupBox = new QGroupBox("Desired state"); QRadioButton * idleButton = new QRadioButton("Idle"); QRadioButton * homeButton = new QRadioButton("Home"); QRadioButton * teleOpButton = new QRadioButton("Teleop"); // QRadioButton * gcButton = new QRadioButton("Gravity"); // QRadioButton * clutchButton = new QRadioButton("Clutch"); idleButton->setChecked(true); QButtonGroup * group = new QButtonGroup; group->addButton(idleButton); group->addButton(homeButton); group->addButton(teleOpButton); // group->addButton(gcButton); // group->addButton(clutchButton); group->setExclusive(true); QVBoxLayout * vbox = new QVBoxLayout; vbox->addWidget(idleButton); vbox->addWidget(homeButton); vbox->addWidget(teleOpButton); // vbox->addWidget(gcButton); // vbox->addWidget(clutchButton); vbox->addStretch(1); groupBox->setLayout(vbox); frameLayout->addWidget(groupBox, 0, 0); QTEMessages = new QTextEdit(); QTEMessages->setReadOnly(true); QTEMessages->ensureCursorVisible(); frameLayout->addWidget(QTEMessages, 0, 1); QVBoxLayout * mainLayout = new QVBoxLayout; mainLayout->addLayout(frameLayout); setLayout(mainLayout); setWindowTitle("Intuitive Research Kit"); resize(sizeHint()); connect(group, SIGNAL(buttonClicked(QAbstractButton*)), this, SLOT(SlotSetStateButton(QAbstractButton*))); connect(this, SIGNAL(SignalAppendMessage(QString)), QTEMessages, SLOT(append(QString))); connect(this, SIGNAL(SignalSetColor(QColor)), QTEMessages, SLOT(setTextColor(QColor))); connect(QTEMessages, SIGNAL(textChanged()), this, SLOT(SlotTextChanged())); }
QWidget * ExtArgRadio::createEditor(QWidget * parent) { int count = 0; bool anyChecked = false; selectorGroup = new QButtonGroup(parent); QWidget * radioButtons = new QWidget; QVBoxLayout * vrLayout = new QVBoxLayout(); QMargins margins = vrLayout->contentsMargins(); vrLayout->setContentsMargins(0, 0, 0, margins.bottom()); if ( callStrings != 0 ) delete callStrings; callStrings = new QList<QString>(); if ( values.length() > 0 ) { ExtcapValueList::const_iterator iter = values.constBegin(); while ( iter != values.constEnd() ) { QRadioButton * radio = new QRadioButton((*iter).value()); QString callString = (*iter).call(); callStrings->append(callString); if ( (*iter).isDefault() ) { radio->setChecked(true); anyChecked = true; } connect(radio, SIGNAL(clicked(bool)), SLOT(onBoolChanged(bool))); selectorGroup->addButton(radio, count); vrLayout->addWidget(radio); count++; ++iter; } } /* No default was provided, and not saved value exists */ if ( anyChecked == false && count > 0 ) ((QRadioButton*)(selectorGroup->button(0)))->setChecked(true); radioButtons->setLayout(vrLayout); return radioButtons; }
/** Add a radio button to the plot options * * @param text :: text on the radio button * @param tooltip :: tooltip * @param bIntegrated :: flag to indicate that the dimension is integrated. */ void LinePlotOptions::addPlotRadioButton(const std::string &text, const std::string &tooltip, const bool bIntegrated) { QRadioButton *rad; rad = new QRadioButton(ui.widgetPlotAxis); rad->setText(QString::fromStdString(text)); rad->setToolTip(QString::fromStdString(tooltip)); rad->setEnabled(!bIntegrated); // Insert it one before the horizontal spacer. QBoxLayout *layout = qobject_cast<QBoxLayout *>(ui.widgetPlotAxis->layout()); layout->insertWidget(layout->count() - 1, rad); m_radPlots.push_back(rad); QObject::connect(rad, SIGNAL(toggled(bool)), this, SLOT(radPlot_changed())); }
// new groups void KNGroupDialog::slotUser2() { QDate lastDate = a_ccount->lastNewFetch(); KDialog *dlg = new KDialog( this ); dlg->setCaption( i18n("New Groups") ); dlg->setButtons( Ok | Cancel ); QGroupBox *btnGrp = new QGroupBox( i18n("Check for New Groups"), dlg ); dlg->setMainWidget(btnGrp); QGridLayout *topL = new QGridLayout( btnGrp ); QRadioButton *takeLast = new QRadioButton( i18n("Created since last check:"), btnGrp ); topL->addWidget(takeLast, 0, 0, 1, 2 ); QLabel *l = new QLabel(KGlobal::locale()->formatDate(lastDate, KLocale::LongDate),btnGrp); topL->addWidget(l, 1, 1, Qt::AlignLeft); connect(takeLast, SIGNAL(toggled(bool)), l, SLOT(setEnabled(bool))); QRadioButton *takeCustom = new QRadioButton( i18n("Created since this date:"), btnGrp ); topL->addWidget(takeCustom, 2, 0, 1, 2 ); dateSel = new KDatePicker( lastDate, btnGrp ); dateSel->setMinimumSize(dateSel->sizeHint()); topL->addWidget(dateSel, 3, 1, Qt::AlignLeft); connect(takeCustom, SIGNAL(toggled(bool)), this, SLOT(slotDatePickerEnabled(bool))); takeLast->setChecked(true); dateSel->setEnabled(false); topL->addItem( new QSpacerItem(30, 0 ), 0, 0 ); if (dlg->exec()) { if (takeCustom->isChecked()) lastDate = dateSel->date(); a_ccount->setLastNewFetch(QDate::currentDate()); leftLabel->setText(i18n("Checking for new groups...")); enableButton(User1,false); enableButton(User2,false); filterEdit->clear(); subCB->setChecked(false); newCB->setChecked(true); emit(checkNew(a_ccount,lastDate)); incrementalFilter=false; slotRefilter(); } delete dlg; }
TransparencyDialog::TransparencyDialog( QWidget * parent, ViewerRendererWidget * vrw ) : QDialog( parent ) , m_renderer( vrw ) { DP_ASSERT( m_renderer ); setWindowTitle( "Transparency Settings" ); setWindowFlags( windowFlags() & ~Qt::WindowContextHelpButtonHint ); m_restoreTransparencyMode = m_renderer->getTransparencyMode(); QRadioButton * noneButton = new QRadioButton( "None" ); noneButton->setChecked( m_restoreTransparencyMode == dp::sg::renderer::rix::gl::TransparencyMode::NONE ); QRadioButton * sortedBlendedButton = new QRadioButton( "Sorted Blended" ); sortedBlendedButton->setChecked( m_restoreTransparencyMode == dp::sg::renderer::rix::gl::TransparencyMode::SORTED_BLENDED ); QRadioButton * orderIndependentClosestListButton = new QRadioButton( "Order Independent Closest List" ); orderIndependentClosestListButton->setChecked( m_restoreTransparencyMode == dp::sg::renderer::rix::gl::TransparencyMode::ORDER_INDEPENDENT_CLOSEST_LIST ); QRadioButton * orderIndependentAllButton = new QRadioButton( "Order Independent All" ); orderIndependentAllButton->setChecked( m_restoreTransparencyMode == dp::sg::renderer::rix::gl::TransparencyMode::ORDER_INDEPENDENT_ALL ); QButtonGroup * buttonGroup = new QButtonGroup(); buttonGroup->addButton( noneButton, static_cast<int>(dp::sg::renderer::rix::gl::TransparencyMode::NONE) ); buttonGroup->addButton( sortedBlendedButton, static_cast<int>(dp::sg::renderer::rix::gl::TransparencyMode::SORTED_BLENDED) ); buttonGroup->addButton( orderIndependentClosestListButton, static_cast<int>(dp::sg::renderer::rix::gl::TransparencyMode::ORDER_INDEPENDENT_CLOSEST_LIST) ); buttonGroup->addButton( orderIndependentAllButton, static_cast<int>(dp::sg::renderer::rix::gl::TransparencyMode::ORDER_INDEPENDENT_ALL) ); connect( buttonGroup, SIGNAL(buttonClicked(int)), this, SLOT(buttonClicked(int)) ); m_restoreLayers = m_renderer->getOITDepth(); m_layersBox = new QSpinBox(); m_layersBox->setMinimum( 1 ); m_layersBox->setValue( m_restoreLayers ); m_layersBox->setEnabled( ( m_restoreTransparencyMode == dp::sg::renderer::rix::gl::TransparencyMode::ORDER_INDEPENDENT_CLOSEST_ARRAY ) || ( m_restoreTransparencyMode == dp::sg::renderer::rix::gl::TransparencyMode::ORDER_INDEPENDENT_CLOSEST_LIST ) ); connect( m_layersBox, SIGNAL(valueChanged(int)), this, SLOT(layersChanged(int)) ); QFormLayout * layersLayout = new QFormLayout; layersLayout->addRow( "Transparency Layers", m_layersBox ); QFrame * separatorLine = new QFrame; separatorLine->setFrameShape( QFrame::HLine ); separatorLine->setFrameShadow( QFrame::Sunken ); QDialogButtonBox * dbb = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel ); dbb->button( QDialogButtonBox::Ok )->setDefault ( true ); connect( dbb, SIGNAL(accepted()), this, SLOT(accept()) ); connect( dbb, SIGNAL(rejected()), this, SLOT(reject()) ); QVBoxLayout * vLayout = new QVBoxLayout(); vLayout->addWidget( noneButton ); vLayout->addWidget( sortedBlendedButton ); vLayout->addWidget( orderIndependentClosestListButton ); vLayout->addLayout( layersLayout ); vLayout->addWidget( orderIndependentAllButton ); vLayout->addWidget( separatorLine ); vLayout->addWidget( dbb ); setLayout( vLayout ); adjustSize(); setMinimumSize( size() ); setMaximumSize( size() ); }
egx_wnd_t egx_radiobutton_create_(int res_id,char *name,egx_uint32_t style,int x,int y,int width,int height,egx_wnd_t parent,egx_wnd_t radiogroup) { QRadioButton *button = new QRadioButton((QWidget*)(parent)); button->setText(QString::fromLocal8Bit(name)); if(x == 0 || y == 0){ button->resize(width,height); }else{ button->setGeometry(x,y,width,height); } QButtonGroup *_radiogroup = (QButtonGroup*)radiogroup; if(_radiogroup){ _radiogroup->addButton(button); } return HWND_TO_GUIWND(button); }
void GlyphEditor::setPrimitives(int p){ primitives = p; if (p==0){ QRadioButton* prb = findChild<QRadioButton*>("points"); prb->setChecked(true); if (data->surfset) data->surfset->vectors = false; if (data->surfsetr) data->surfsetr->vectors = false; } else if (p==1){ QRadioButton* vrb = findChild<QRadioButton*>("vectors"); vrb->setChecked(true); if (data->surfset) data->surfset->vectors = true; if (data->surfsetr) data->surfsetr->vectors = true; } update(); }
void MainWindow::ChangeLanguage() { std::clog<<"MainWindow::ChangeLanguage()"<<std::endl; QList<QRadioButton*> list = ui->groupBox->findChildren<QRadioButton*>(); for(int i=0;i<list.size();i++) { QRadioButton* rb = list.at(i); if(rb->isChecked()) { lang->ChangeLanguage(rb->property(("lang_file")).toString()); // lang_file is dynamic property break; } } ui->retranslateUi(this); }
void KSaneDeviceDialog::updateDevicesList() { while (!m_btnGroup->buttons().isEmpty()) { delete m_btnGroup->buttons().takeFirst(); } const QList<KSaneWidget::DeviceInfo> list = m_findDevThread->devicesList(); if (list.isEmpty()) { m_btnBox->setTitle(i18n("Sorry. No devices found.")); m_btnBox->layout()->itemAt(0)->widget()->show(); // explanation m_btnBox->layout()->itemAt(1)->widget()->hide(); // scroll area enableButton(KDialog::User1, true); return; } delete m_btnLayout; m_btnLayout = new QVBoxLayout; m_btnContainer->setLayout(m_btnLayout); m_btnBox->setTitle(i18n("Found devices:")); m_btnBox->layout()->itemAt(0)->widget()->hide(); // explanation m_btnBox->layout()->itemAt(1)->widget()->show(); // scroll area for (int i=0; i< list.size(); i++) { QRadioButton *b = new QRadioButton(this); b->setObjectName(list[i].name); b->setToolTip(list[i].name); b->setText(QString("%1 : %2\n%3") .arg(list[i].vendor) .arg(list[i].model) .arg(list[i].name)); m_btnLayout->addWidget(b); m_btnGroup->addButton(b); connect(b, SIGNAL(clicked(bool)), this, SLOT(setAvailable(bool))); if((i==0) || (list[i].name == m_selectedDevice)) { b->setChecked(true); setAvailable(true); } } m_btnLayout->addStretch(); if(list.size() == 1) { button(KDialog::Ok)->animateClick(); } enableButton(KDialog::User1, true); }
TrainerGui::TrainerGui(QWidget *parent) : QMainWindow(parent), ui(new Ui::TrainerGui) { ui->setupUi(this); ui_label1 = qFindChild<ClickLabel*>(this, "img1Label"); ui_label2 = qFindChild<ClickLabel*>(this, "img2Label"); // defaults QRadioButton *posRadio = qFindChild<QRadioButton*>(this, "positiveRadio"); posRadio->setChecked(true); m_trainingType = m_posTrainingType; m_trainingFile = NULL; m_defaultImgWidth = 640; }
int SongcastDLG::selectedSenderIdx() { int senderidx = -1; // Note: quite unbelievably, gridLayout::rowCount() is not the number // of actual rows, but the size of the internal allocation. So can't use it // after deleting rows... for (int i = 0; i < numSenderRows(); i++) { QRadioButton *btn = (QRadioButton*) sndGridLayout->itemAtPosition(i, 0)->widget(); if (btn->isChecked()) { senderidx = i; break; } } return senderidx; }
void addTypeFormats(const QString &type, const QStringList &typeFormats, int current) { const int row = m_layout->rowCount(); int column = 0; QButtonGroup *group = new QButtonGroup(this); m_layout->addWidget(new QLabel(type), row, column++); for (int i = -1; i != typeFormats.size(); ++i) { QRadioButton *choice = new QRadioButton(this); choice->setText(i == -1 ? TypeFormatsDialog::tr("Reset") : typeFormats.at(i)); m_layout->addWidget(choice, row, column++); if (i == current) choice->setChecked(true); group->addButton(choice, i); } }
void MultipleChoiceWidget::addButton() { QSize newSize = this->size(); QRadioButton * button = new QRadioButton(tr("Insert Text: New"), this); //QFont *font = new QFont("Arial", 100); //button->setFont(*font); correctButtonSize(button); questions->append(button); box->addButton(button); gridLayoutButtonGroup->addWidget(button); if (button->width() > this->width()) newSize.setWidth(button->width()); newSize.setHeight(questions->size() * button->height()); this->resize(newSize); button->show(); this->update(); }
void PlastikConfig::load(const KConfigGroup&) { KConfigGroup cg(m_config, "General"); QString value = cg.readEntry("TitleAlignment", "AlignLeft"); QRadioButton *button = m_dialog->titleAlign->findChild<QRadioButton*>(value.toLatin1()); if (button) button->setChecked(true); bool animateButtons = cg.readEntry("AnimateButtons", true); m_dialog->animateButtons->setChecked(animateButtons); bool menuClose = cg.readEntry("CloseOnMenuDoubleClick", true); m_dialog->menuClose->setChecked(menuClose); bool titleShadow = cg.readEntry("TitleShadow", true); m_dialog->titleShadow->setChecked(titleShadow); bool coloredBorder = cg.readEntry("ColoredBorder", true); m_dialog->coloredBorder->setChecked(coloredBorder); }
void DataSerieDialog::selectRadio(QGroupBox *groupBox, int defaultSelection) { QVBoxLayout *layout = qobject_cast<QVBoxLayout *>(groupBox->layout()); Q_ASSERT(layout); Q_ASSERT(layout->count()); QLayoutItem *item = 0; if (defaultSelection == -1) { item = layout->itemAt(0); } else if (layout->count() > defaultSelection) { item = layout->itemAt(defaultSelection); } Q_ASSERT(item); QRadioButton *radio = qobject_cast<QRadioButton *>(item->widget()); Q_ASSERT(radio); radio->setChecked(true); }
void kiptablesgenerator::setupIncomingPage() { incomingPage = new QFrame(this); QGridLayout *layout = new QGridLayout(incomingPage, 2, 2); QLabel *intro = new QLabel(i18n( "<p>Do you want to filter incoming data? (recommended)</p>" "<p>This will allow you to control other computers access to " "your computer.</p>"), incomingPage); intro->show(); layout->addMultiCellWidget(intro, 0, 0, 0, 1); QButtonGroup *optYesNo = new QButtonGroup(incomingPage); namedWidgets["incomingYesNo"] = optYesNo; optYesNo->hide(); QRadioButton *optYes = new QRadioButton(i18n("&Yes"), incomingPage); optYes->setChecked(true); optYes->setName("yes"); optYes->show(); layout->addWidget(optYes, 1, 0); optYesNo->insert(optYes); QRadioButton *optNo = new QRadioButton(i18n("N&o"), incomingPage); optNo->setName("no"); optNo->show(); layout->addWidget(optNo, 1, 1); optYesNo->insert(optNo); incomingPage->show(); this->addPage(incomingPage, i18n("Incoming Data")); }
void UimImSwitcher::createGUI() { /* im list view */ listview = new QListView( this ); listview->setSelectionMode( QListView::Single ); listview->setAllColumnsShowFocus( true ); listview->addColumn( _( "InputMethodName" ) ); listview->addColumn( _( "Language" ) ); listview->addColumn( _( "Description" ) ); /* radio buttons for the switcher coverage */ QRadioButton *button; vbGroup = new QVButtonGroup( _( "Effective coverage" ), this ); button = new QRadioButton( _( "whole desktop" ), vbGroup ); vbGroup->insert( button, ID_CHANGE_WHOLE_DESKTOP ); button->setChecked( TRUE ); // default is "whole desktop" button = new QRadioButton( _( "current application only" ), vbGroup ); vbGroup->insert( button, ID_CHANGE_THIS_APPLICATION_ONLY ); button = new QRadioButton( _( "current text area only" ), vbGroup ); vbGroup->insert( button, ID_CHANGE_THIS_TEXT_AREA_ONLY ); /* cancel & ok button */ okButton = new QPushButton( this ); okButton->setText( _( "OK" ) ); okButton->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); QObject::connect( okButton, SIGNAL( clicked() ), this, SLOT( slotChangeInputMethod() ) ); cancelButton = new QPushButton( this ); cancelButton->setText( _( "Cancel" ) ); cancelButton->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); QObject::connect( cancelButton, SIGNAL( clicked() ), qApp, SLOT( quit() ) ); QHBoxLayout *buttonLayout = new QHBoxLayout; buttonLayout->addStretch( 0 ); buttonLayout->addWidget( okButton ); buttonLayout->addWidget( cancelButton ); // main layout QVBoxLayout *mainLayout = new QVBoxLayout( this ); mainLayout->setMargin( 6 ); mainLayout->setSpacing( 6 ); mainLayout->addWidget( listview ); mainLayout->addWidget( vbGroup ); mainLayout->addLayout( buttonLayout ); }
void AbstractNumberFilter::createWidget() { QFont greaterThanLessThanFont("SansSerif", 9); QRadioButton * lessThanButton = new QRadioButton("<="); lessThanButton->setFont(greaterThanLessThanFont); QRadioButton * greaterThanButton = new QRadioButton(">="); greaterThanButton->setFont(greaterThanLessThanFont); greaterThanLessThan = new QButtonGroup; connect(greaterThanLessThan, SIGNAL(buttonClicked(int)), this, SIGNAL(filterChanged())); greaterThanLessThan->addButton(lessThanButton, 0); greaterThanLessThan->addButton(greaterThanButton, 1); // hide inclusive and exclusive buttons, and add greater than and less than // in the inclusiveExclusiveLayout. getInclusiveExclusiveLayout()->itemAt(0)->widget()->setVisible(false); getInclusiveExclusiveLayout()->itemAt(1)->widget()->setVisible(false); getInclusiveExclusiveLayout()->addWidget(lessThanButton); getInclusiveExclusiveLayout()->addWidget(greaterThanButton); lineEditText = new QString; lineEdit = new QLineEdit; lineEdit->setMinimumWidth(75); connect(lineEdit, SIGNAL(textChanged(QString)), this, SLOT(updateLineEditText(QString))); connect(lineEdit, SIGNAL(textChanged(QString)), this, SIGNAL(filterChanged())); QHBoxLayout * layout = new QHBoxLayout; QMargins margins = layout->contentsMargins(); margins.setTop(0); margins.setBottom(0); layout->setContentsMargins(margins); layout->addWidget(lineEdit); layout->addStretch(); getMainLayout()->addLayout(layout); // FIXME: QSettings should handle this lessThanButton->click(); }
void CSysSettingDialog::Precision( int &nPrecision, bool bGet ) { QString strName = "rdxPrecision%1"; QRadioButton* pRB; if ( bGet ) { for ( int nIndex = 0; nIndex < 9; nIndex++ ) { pRB = ui->gbPrecision->findChild< QRadioButton* >( strName.arg( QString::number( nIndex ) ) ); if ( pRB->isChecked( ) ) { nPrecision = nIndex; break; } } } else { pRB = ui->gbPrecision->findChild< QRadioButton* >( strName.arg( QString::number( nPrecision ) ) ); pRB->setChecked( true ); } }
void SerialPortUi::radioButton_CRC_clicked() { QRadioButton *rtn = dynamic_cast<QRadioButton*>(sender()); int key = rtn->whatsThis().toInt(); switch (key) { case 1: ui->textBrowser->append("CRCNO"); break; case 2: ui->textBrowser->append("CRC8"); break; case 3: ui->textBrowser->append("CRC16"); break; default: break; } }
void createUi(PlotViewInterpolation* plot_view) { _b1_rbtn = new QRadioButton("no boundary", plot_view); _b2_rbtn = new QRadioButton("c1 boundary", plot_view); _b3_rbtn = new QRadioButton("c2 boundary", plot_view); _b1_rbtn->setDown(true); _lbl_weight = new QLabel("lambda", plot_view); _lbl_weight->setAlignment(Qt::AlignRight); _lbl_weight->adjustSize(); _sld_precision = new QSlider(Qt::Horizontal, plot_view); _sld_precision->setMinimum(1); _sld_precision->setMaximum(1000); _sld_precision->setTickInterval(1); _sld_precision->setValue(20); _sld_precision->adjustSize(); _sld_alpha = new QSlider(Qt::Horizontal, plot_view); _sld_alpha->setMinimum(1); _sld_alpha->setMaximum(1000); _sld_alpha->setTickInterval(1); _sld_alpha->setValue(50); _sld_alpha->adjustSize(); _lbl_knot = new QLabel("initial knots", plot_view); _lbl_knot->setAlignment(Qt::AlignRight); _lbl_knot->adjustSize(); _lbl_level = new QLabel("level", plot_view); _lbl_level->setAlignment(Qt::AlignRight); _lbl_knot->adjustSize(); _sld_level = new QSlider(Qt::Horizontal, plot_view); _sld_level->setMinimum(1); _sld_level->setMaximum(10); _sld_level->setTickInterval(1); _sld_level->setValue(1); _sld_level->adjustSize(); QSignalMapper* signal_map = new QSignalMapper(plot_view); signal_map->setMapping(_b1_rbtn, 0); // no boundary signal_map->setMapping(_b2_rbtn, 1); // c1 boundary signal_map->setMapping(_b3_rbtn, 2); // c2 boundary QObject::connect(_b1_rbtn, SIGNAL(clicked()), signal_map, SLOT(map())); QObject::connect(_b2_rbtn, SIGNAL(clicked()), signal_map, SLOT(map())); QObject::connect(_b3_rbtn, SIGNAL(clicked()), signal_map, SLOT(map())); QObject::connect(signal_map, SIGNAL(mapped(int)), plot_view, SLOT(setBoundary(int))); QObject::connect(_sld_precision, &QSlider::valueChanged, plot_view, &PlotViewInterpolation::changePrecision); QObject::connect(_sld_alpha, &QSlider::valueChanged, plot_view, &PlotViewInterpolation::changeAlpha); QObject::connect(_sld_level, &QSlider::valueChanged, plot_view, &PlotViewInterpolation::changeLevel); }
static inline QRadioButton* buildRadioButton(QString text, QString icon, int mode, QGroupBox *groupBox, QHBoxLayout *hbox, LogWidgetModel *m_viewmodel) { QRadioButton *build = new QRadioButton(text, groupBox); build->setIcon(QIcon(QString(":/in/%0").arg(icon))); build->setProperty("mode", mode); build->setToolTip(build->text()); hbox->addWidget(build); QObject::connect(build, SIGNAL(toggled(bool)), m_viewmodel, SLOT(changeMode(bool))); return build; }
void ClangDiagnosticConfigsWidget::syncClazyWidgets(const ClangDiagnosticConfig &config) { const QString clazyChecks = config.clazyChecks(); QRadioButton *button = m_clazyChecks->clazyRadioDisabled; if (clazyChecks.isEmpty()) button = m_clazyChecks->clazyRadioDisabled; else if (clazyChecks == "level0") button = m_clazyChecks->clazyRadioLevel0; else if (clazyChecks == "level1") button = m_clazyChecks->clazyRadioLevel1; else if (clazyChecks == "level2") button = m_clazyChecks->clazyRadioLevel2; else if (clazyChecks == "level3") button = m_clazyChecks->clazyRadioLevel3; button->setChecked(true); m_clazyChecksWidget->setEnabled(!config.isReadOnly()); }
void ConvertDialogTest::convert_filter_colorSepia() { EffectsScrollArea *effectsScrollArea = convertDialog->effectsScrollArea; QGroupBox *filterGroupBox = effectsScrollArea->filterGroupBox; filterGroupBox->setChecked(true); QRadioButton *filterColorRadioButton = effectsScrollArea->filterColorRadioButton; filterColorRadioButton->setChecked(true); int sepia = 1; QComboBox *filterTypeComboBox = effectsScrollArea->filterTypeComboBox; filterTypeComboBox->setCurrentIndex(sepia); convertDialog->convert(); SharedInformation *sharedInfo = convertDialog->sharedInfo; EffectsConfiguration conf = sharedInfo->effectsConfiguration(); QCOMPARE(conf.getFilterType(), int(Sepia)); QCOMPARE(conf.getFilterBrush(), QBrush()); }
ClassifiedViewer::ClassifiedViewer(QWidget *parent) : QMainWindow(parent), ui(new Ui::ClassifiedViewer), m_classified(NULL) { ui->setupUi(this); ui_label = qFindChild<QLabel*>(this, "imageLabel"); ui_hueSlider = qFindChild<QSlider*>(this, "hueSlider"); ui_thresholdSlider = qFindChild<QSlider*>(this, "thresholdSlider"); ui_thresholdSpin = qFindChild<QDoubleSpinBox*>(this, "thresholdSpin"); m_threshold = ui_thresholdSpin->value(); m_highlightColor.setHsv(ui_hueSlider->value(), 255, 255); QRadioButton *imageOnlyRadio = qFindChild<QRadioButton*>(this, "imageOnlyRadio"); imageOnlyRadio->setChecked(true); m_visualizationOption = imageOnly; }