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()); }
void kiptablesgenerator::setupNewHostDialog() { newHostDialog = new KDialogBase(this, 0, true, i18n("Add Host"), KDialogBase::Ok | KDialogBase::Cancel); QFrame *dialogArea = new QFrame(newHostDialog); QGridLayout *layout = new QGridLayout(dialogArea, 5, 2); QLabel *intro = new QLabel(i18n( "<p>Here you can tell netfilter to allow all connections from a given host regardless of other rules, " "or block all connections from a given host regardless of other rules.</p>" "<p>You can specify a host either by IP address or MAC address.</p>"), dialogArea); intro->show(); layout->addMultiCellWidget(intro, 0, 0, 0, 1); QButtonGroup *whitelistOrBlacklist = new QButtonGroup(dialogArea); whitelistOrBlacklist->hide(); QRadioButton *whitelist = new QRadioButton(i18n("&Allow"), dialogArea); whitelist->setChecked(true); whitelist->show(); layout->addWidget(whitelist, 1, 0); namedWidgets["newHost_allow"] = whitelist; whitelistOrBlacklist->insert(whitelist); QRadioButton *blacklist = new QRadioButton(i18n("&Block"), dialogArea); blacklist->setChecked(false); blacklist->show(); layout->addWidget(blacklist, 1, 1); whitelistOrBlacklist->insert(blacklist); QButtonGroup *ipOrMAC = new QButtonGroup(dialogArea); ipOrMAC->hide(); QRadioButton *useIP = new QRadioButton(i18n("&Use IP"), dialogArea); useIP->setChecked(true); useIP->show(); layout->addWidget(useIP, 2, 0); namedWidgets["newHost_useIP"] = useIP; ipOrMAC->insert(useIP); QRadioButton *useMAC = new QRadioButton(i18n("U&se MAC"), dialogArea); useMAC->show(); layout->addWidget(useMAC, 2, 1); ipOrMAC->insert(useMAC); QLabel *hostLabel = new QLabel(i18n("Host:"), dialogArea); hostLabel->show(); layout->addMultiCellWidget(hostLabel, 3, 3, 0, 1); KLineEdit *host = new KLineEdit(dialogArea); host->show(); namedWidgets["newHost_address"] = host; layout->addMultiCellWidget(host, 4, 4, 0, 1); connect(newHostDialog, SIGNAL(okClicked()), this, SLOT(slotAddHost())); dialogArea->show(); newHostDialog->setMainWidget(dialogArea); }
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() ); }
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 ( _default != NULL && (*iter).isDefault() ) { radio->setChecked(true); anyChecked = true; } else if (_default != NULL) { if ( callString.compare(_default->toString()) == 0 ) { 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; }
void SettingsWidget::updateAddresses(const Protos::Common::Interface& interfaceMess, QWidget* container) { QVBoxLayout* layout = container->findChild<QVBoxLayout*>(); if (!layout) { layout = new QVBoxLayout(container); QMargins margins = layout->contentsMargins(); margins.setTop(3); layout->setContentsMargins(margins); } QList<QRadioButton*> addressesNotUpdated = container->findChildren<QRadioButton*>(); for (int i = 0; i < interfaceMess.address_size(); i++) { const QString& addresseName = Common::ProtoHelper::getStr(interfaceMess.address(i), &Protos::Common::Interface::Address::address); for (QListIterator<QRadioButton*> j(container->findChildren<QRadioButton*>()); j.hasNext();) { QRadioButton* addressButton = j.next(); if (addressButton->text() == addresseName) { addressesNotUpdated.removeOne(addressButton); if (interfaceMess.address(i).listened()) addressButton->setChecked(true); goto nextAddress; } } { // Address not found -> add a new one. QRadioButton* newAddressButton = new QRadioButton(addresseName, container); this->ui->grpAddressesToListenTo->addButton(newAddressButton); if (interfaceMess.address(i).listened()) newAddressButton->setChecked(true); layout->addWidget(newAddressButton); } nextAddress: ; } // Remove the non-existant addresses. for (QListIterator<QRadioButton*> i(container->findChildren<QRadioButton*>()); i.hasNext();) { QRadioButton* current = i.next(); if (addressesNotUpdated.contains(current)) { layout->removeWidget(current); this->ui->grpAddressesToListenTo->removeButton(current); delete current; } } }
void GrpRadioButton::keyPressEvent(QKeyEvent *e) { switch (e->key()){ case Key_Down:{ QRadioButton *first = NULL; QRadioButton *next = NULL; QObjectList *l = parentWidget()->queryList("QRadioButton"); QObjectListIt it(*l); QObject *obj; while ((obj=it.current()) != NULL){ if (first == NULL) first = static_cast<QRadioButton*>(obj); if (obj == this){ ++it; if ((obj = it.current()) == NULL){ next = first; }else{ next = static_cast<QRadioButton*>(obj); } break; } ++it; } delete l; if (next){ next->setFocus(); next->setChecked(true); } return; } case Key_Up:{ QRadioButton *prev = NULL; QObjectList *l = parentWidget()->queryList("QRadioButton"); QObjectListIt it(*l); QObject *obj; while ((obj=it.current()) != NULL){ if ((obj == this) && prev) break; prev = static_cast<QRadioButton*>(obj); ++it; } delete l; if (prev){ prev->setFocus(); prev->setChecked(true); } return; } } QRadioButton::keyPressEvent(e); }
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(); }
// Create new radio button QtWidgetObject* AtenTreeGuiDialog::addRadioButton(TreeGuiWidget* widget, TreeGuiWidget* groupWidget, QString name, QString label, int id) { // Cast QObject in groupWidget into QButtonGroup QtWidgetObject* wo = groupWidget->qtWidgetObject(); if (wo == NULL) { printf("Internal Error: Can't add button to radiogroup widget since supplied widget doesn't have an associated QtWidgetObject.\n"); return NULL; } QButtonGroup *group = static_cast<QButtonGroup*>(wo->qObject()); if (!group) { printf("Internal Error: Couldn't cast QObject into QButtonGroup.\n"); return NULL; } // Create new QtWidgetObject for page QRadioButton *radio = new QRadioButton(label, this); group->addButton(radio, id); QtWidgetObject* qtwo = widgetObjects_.add(); qtwo->set(widget, radio); radio->setEnabled(widget->enabled()); radio->setVisible(widget->visible()); radio->setChecked(widget->valueI() == 1); radio->setMinimumHeight(WIDGETHEIGHT); radio->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); // Connect signal to master slot QObject::connect(radio, SIGNAL(clicked(bool)), this, SLOT(radioButtonWidget_clicked(bool))); return qtwo; }
IsotropicElasticityPropertyWidget::IsotropicElasticityPropertyWidget(QWidget * parent) : PropertySpecialWidget(parent) { buttonGroup_ = new QButtonGroup(this); QVBoxLayout *vbox = new QVBoxLayout(this); QRadioButton * rb; rb = new QRadioButton("Calculated from Young's Modulus and Poisson Ratio", this); vbox->addWidget(rb); buttonGroup_->addButton(rb, 0); rb->setChecked(true); rb = new QRadioButton("Calculated from Young's Modulus and Shear Modulus", this); vbox->addWidget(rb); buttonGroup_->addButton(rb, 1); rb = new QRadioButton("Calculated from Poisson Ratio and Shear Modulus", this); vbox->addWidget(rb); buttonGroup_->addButton(rb, 2); vbox->addStretch(1); setLayout(vbox); connect(buttonGroup_, SIGNAL(buttonClicked(int)), this, SLOT(modeChanged(int))); }
void MDRadioButtonGroup::addRadioButton(const QString &name, const QString &value) { QRadioButton *radio = new QRadioButton(name, this); radio->setChecked(value == selected); radiobuttons.insert(radio, value); this->layout()->addWidget(radio); }
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")); }
ListInputDialog::ListInputDialog(QWidget *parent, const QString &title, const QString &labelText, const QStringList &list, int current, Qt::WFlags f) : QDialog(parent, f), m_strings(list) { setWindowTitle(title); QVBoxLayout *vbox = new QVBoxLayout(this); QLabel *label = new QLabel(labelText, this); vbox->addWidget(label); vbox->addStretch(1); int count = 0; for (QStringList::const_iterator i = list.begin(); i != list.end(); ++i) { QRadioButton *radio = new QRadioButton(*i); if (current == count++) radio->setChecked(true); m_radioButtons.push_back(radio); vbox->addWidget(radio); } vbox->addStretch(1); m_footnote = new QLabel; vbox->addWidget(m_footnote); m_footnote->hide(); QDialogButtonBox *bb = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); vbox->addWidget(bb); connect(bb, SIGNAL(accepted()), this, SLOT(accept())); connect(bb, SIGNAL(rejected()), this, SLOT(reject())); }
void QgsGeometryCheckerFixDialog::setupNextError() { mProgressBar->setValue( mProgressBar->maximum() - mErrors.size() ); mNextBtn->setVisible( false ); mFixBtn->setVisible( true ); mFixBtn->setFocus(); mSkipBtn->setVisible( true ); mStatusLabel->setText( "" ); mResolutionsBox->setEnabled( true ); QgsGeometryCheckError* error = mErrors.first(); emit currentErrorChanged( error ); mResolutionsBox->setTitle( tr( "Select how to fix error \"%1\":" ).arg( error->description() ) ); delete mRadioGroup; mRadioGroup = new QButtonGroup( this ); delete mResolutionsBox->layout(); qDeleteAll( mResolutionsBox->children() ); mResolutionsBox->setLayout( new QVBoxLayout() ); mResolutionsBox->layout()->setContentsMargins( 0, 0, 0, 4 ); int id = 0; int checkedid = QSettings().value( QgsGeometryCheckerResultTab::sSettingsGroup + error->check()->errorName(), QVariant::fromValue<int>( 0 ) ).toInt(); foreach ( const QString& method, error->check()->getResolutionMethods() ) { QRadioButton* radio = new QRadioButton( method ); radio->setChecked( checkedid == id ); mResolutionsBox->layout()->addWidget( radio ); mRadioGroup->addButton( radio, id++ ); } adjustSize(); }
ServiceChooser::ServiceChooser(const QByteArray &service, const LocalizedString &title, const QByteArray ¤tService, ExtensionInfoList &services, QWidget *parent) : QGroupBox(title, parent), m_layout(new QVBoxLayout(this)), m_service(service), m_currentService(currentService) { foreach (const ExtensionInfo &service, services) { const QMetaObject *meta = service.generator()->metaObject(); QByteArray name = meta->className(); const char *desc = MetaObjectBuilder::info(meta, "SettingsDescription"); if (!desc || !*desc) desc = name.constData(); QRadioButton *button = new QRadioButton(QCoreApplication::translate("ContactList", desc), this); button->setObjectName(QString::fromLatin1(name)); button->setChecked(name == m_currentService); connect(button, SIGNAL(toggled(bool)), SLOT(onButtonToggled(bool))); m_buttons.insert(name, button); m_infos.insert(name, service); m_layout->addWidget(button); } connect(ServiceManager::instance(), SIGNAL(serviceChanged(QByteArray,QObject*,QObject*)), SLOT(onServiceChanged(QByteArray,QObject*,QObject*))); }
void QgsSourceSelectDialog::populateImageEncodings( const QStringList& availableEncodings ) { QLayoutItem* item; while (( item = gbImageEncoding->layout()->takeAt( 0 ) ) != nullptr ) { delete item->widget(); delete item; } bool first = true; QList<QByteArray> supportedFormats = QImageReader::supportedImageFormats(); foreach ( const QString& encoding, availableEncodings ) { bool supported = false; foreach ( const QByteArray& fmt, supportedFormats ) { if ( encoding.startsWith( fmt, Qt::CaseInsensitive ) ) { supported = true; } } if ( !supported ) { continue; } QRadioButton* button = new QRadioButton( encoding, this ); button->setChecked( first ); gbImageEncoding->layout()->addWidget( button ); mImageEncodingGroup->addButton( button ); first = false; }
void QMwMaterialLayersWidget::UpdateLayersPanel() { QGridLayout *layersLayout = (QGridLayout*)this->layersWidget->layout(); QLayoutItem *child; while ((child = layersLayout->takeAt(0)) != 0) { delete child->widget(); delete child; } if (this->material == 0) return; for (int layerIndex = 0; layerIndex < this->material->shaderSlots.count; layerIndex++) { QRadioButton *layerSelectRadioButton = new QRadioButton(this->layersWidget); layerSelectRadioButton->setChecked(layerIndex == this->selectedLayerIndex); layerSelectRadioButton->setProperty("layerIndex", QVariant(layerIndex)); layerSelectRadioButton->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Minimum); QObject::connect(layerSelectRadioButton, SIGNAL(clicked()), this, SLOT(LayerSelected())); layersLayout->addWidget(layerSelectRadioButton, layerIndex, 0); QComboBox *shaderOpComboBox = new QComboBox(this->layersWidget); this->SetShaderOpComboBox(shaderOpComboBox, layerIndex); QObject::connect(shaderOpComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(LayerShaderOperationChanged(int))); layersLayout->addWidget(shaderOpComboBox, layerIndex, 1); QComboBox *colorOpComboBox = new QComboBox(this->layersWidget); this->SetColorOpComboBox(colorOpComboBox, layerIndex); QObject::connect(colorOpComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(LayerColorOperationChanged(int))); layersLayout->addWidget(colorOpComboBox, layerIndex, 2); } }
void Select1::loadData() { kDebug() <<"Select1::loadData()" << ref().toString() <<"context:" << context().tagName(); QString txt = ref().applyString( context() ); int count = 0; QStringList::ConstIterator it; for( it = mValues.constBegin(); it != mValues.constEnd(); ++it, ++count ) { if ( *it == txt ) break; } if ( it != mValues.constEnd() ) { if( mProperties->appearance == Full ) { QRadioButton *radio = mRadioButtons[count]; if( radio ) radio->setChecked( true ); } else if( mProperties->appearance == Compact ) { mListWidget->setCurrentRow( count ); } else { mComboBox->setCurrentIndex( count ); } } else { kWarning() <<"Select1::loadData() unknown value:" << txt; } }
UIMJSelect::UIMJSelect( DJDesktopMahjongController *mjController, const MJCardsGroups& groups, QWidget * parent, Qt::WindowFlags f ) :QDialog( parent, f ) { setupUi(this); m_rows = new QButtonGroup(this); qreal scale = 0.5; for( MJCardsGroupsConstIterator groupsIt = groups.begin(); groupsIt != groups.end(); groupsIt++ ) { const MJCards& cards = *groupsIt; QList<QPixmap> pixmaps; for( MJCardsConstIterator cardsIt = cards.begin(); cardsIt != cards.end(); cardsIt++ ) { MJCard card = *cardsIt; QString resPath = mjController->cardResPath( card, DJDesktopMahjongController::Standing, 1 ); QSvgRenderer *renderer = mjController->cardRenderer( resPath ); if ( renderer ) { QPixmap pix = SvgRender2Pixmap( renderer ); pixmaps << pix; } } QPixmap conjointPix = CreateConjointPixmap( pixmaps ); ScalePixmap( conjointPix, scale ); QRadioButton *button = new QRadioButton; button->setIconSize( conjointPix.size() ); button->setIcon( conjointPix ); button->setChecked( true ); m_rows->addButton( button ); vboxLayout1->addWidget( button ); } }
void ImportExport::MD5CheckPage::createRow( QGridLayout* layout, int& row, const QString& name, const QString& title, bool anyClashes, bool allowMerge ) { if ( row % 3 == 0 ) { QFrame* line = new QFrame; line->setFrameShape( QFrame::HLine ); layout->addWidget( line, ++row, 0, 1, 4 ); } QLabel* label = new QLabel( title ); label->setEnabled( anyClashes ); layout->addWidget( label, ++row, 0 ); QButtonGroup* group = new QButtonGroup(this); m_groups[name]=group; for ( int i = 1; i<4;++i ) { if ( i == 3 && !allowMerge ) continue; QRadioButton* rb = new QRadioButton; layout->addWidget( rb, row, i ); group->addButton( rb, i ); rb->setEnabled( anyClashes ); if (i == 1 ) rb->setChecked(true); } }
QuetzalChoiceDialog::QuetzalChoiceDialog(const char *title, const char *primary, const char *secondary, int default_value, const char *ok_text, GCallback ok_cb, const char *cancel_text, GCallback cancel_cb, void *user_data, va_list choices, QWidget *parent) : QuetzalRequestDialog(title, primary, secondary, PURPLE_REQUEST_CHOICE, user_data, parent) { m_ok_cb = (PurpleRequestChoiceCb) ok_cb; m_cancel_cb = (PurpleRequestChoiceCb) cancel_cb; QPushButton *ok_button = buttonBox()->addButton(ok_text, QDialogButtonBox::AcceptRole); QPushButton *cancel_button = buttonBox()->addButton(cancel_text, QDialogButtonBox::RejectRole); connect(ok_button, SIGNAL(clicked()), this, SLOT(onOkClicked())); connect(cancel_button, SIGNAL(clicked()), this, SLOT(onCancelClicked())); const char *text; int id; int i = 1; // Label with description is situated at index 0 while (!!(text = va_arg(choices, gchararray))) { id = va_arg(choices, int); QRadioButton *button = new QRadioButton(text, this); m_radios << button; button->setProperty("choiceId", id); boxLayout()->insertWidget(i++, button); if (id == default_value) button->setChecked(true); } }
void RaceWizard::createPage2() { QWidget *page2Widget = new QWidget; Ui_RaceWizardPage2 page2; page2.setupUi(page2Widget); pagesWidget->addWidget(page2Widget); QVBoxLayout *column1Layout = new QVBoxLayout(page2.PRTcolumn1); QVBoxLayout *column2Layout = new QVBoxLayout(page2.PRTcolumn2); QButtonGroup *buttonGroup = new QButtonGroup(this); unsigned int numPRTs = RacialTrait::PrimaryTraitCount(); for(unsigned int i = 0 ; i != numPRTs ; i++) { const RacialTrait *prt = RacialTrait::GetPrimaryTrait(i); QRadioButton *radioButton = new QRadioButton(prt->Name().c_str(), this); if(i < (numPRTs / 2)) { column1Layout->addWidget(radioButton); } else { column2Layout->addWidget(radioButton); } if(race->GetPRT() == prt) { radioButton->setChecked(true); } buttonGroup->addButton(radioButton, i); } connect(buttonGroup, SIGNAL(buttonClicked(int)), this, SLOT(PRTChanged(int))); }
DeviceSettingUpm::DeviceSettingUpm(Device *device, QWidget *parent) : DeviceSetting(device, parent) { QVBoxLayout *layout = new QVBoxLayout(this); layout->addSpacerItem( new QSpacerItem(20, 109, QSizePolicy::Minimum, QSizePolicy::Expanding) ); QGridLayout *gl = new QGridLayout; QLabel *houseLabel = new QLabel( tr("House"), this); houseLabel->setAlignment( Qt::AlignCenter ); gl->addWidget(houseLabel, 0, 0); house.setMinimum(0); house.setMaximum(4095); gl->addWidget(&house, 1, 0); QLabel *buttonLabel = new QLabel( tr("Button"), this); buttonLabel->setAlignment( Qt::AlignCenter ); gl->addWidget(buttonLabel, 0, 1); int choosedButton = device->parameter("unit", "1").toInt(); QVBoxLayout *vl = new QVBoxLayout; for (int i = 1; i <= 4; ++i) { QRadioButton *button = new QRadioButton( tr("Button %1").arg(i), this); if (i == 1 || choosedButton == i) { button->setChecked( true ); } vl->addWidget(button); } gl->addLayout(vl, 1, 1); layout->addLayout( gl ); layout->addSpacerItem( new QSpacerItem(20, 109, QSizePolicy::Minimum, QSizePolicy::Expanding) ); house.setValue( device->parameter("house", "0").toInt() ); }
void uitabdelegate::setEditorData(QWidget *editor, const QModelIndex &index) const { QVariant data = index.model()->data(index, Qt::DisplayRole); switch (typeeditor) { case TComboBox:{ QComboBox *cmbox = static_cast<QComboBox *> (editor); cmbox->setCurrentIndex(cmbox->findText(data.toString())); break;} case TRadioButton:{ QRadioButton *cradio = static_cast<QRadioButton *> (editor); cradio->setChecked(data.toBool()); break; break;} case TCheckBox:{ QCheckBox *chbox = static_cast<QCheckBox *> (editor); chbox->setChecked(data.toBool()); break;} case TButton:{ break;} default:{ QSpinBox *spinBox = static_cast<QSpinBox *> (editor); spinBox->setValue(data.toInt());}}}
//Revise Rates tab void MainWindow::occupancyPage() { QLabel *monthLabel = new QLabel(tr("Month : ")); QLabel *averageOccupancyLabel = new QLabel(tr("Average Occupancy : ")); monthCombo = new QComboBox; averageOccupancyField = new QLineEdit; QStringList months; months <<"January"<<"February"<<"March"<<"April"<<"May"<<"June"<<"July"<<"August"<<"September"<<"October"<<"November"<<"December"; monthCombo->addItems(months); connect(monthCombo,SIGNAL(currentIndexChanged(int)),this,SLOT(setValue(const int))); connect(monthCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(showAverageOccupancy())); monthCombo->setCurrentIndex(0); averageOccupancyField->setText(QString::number(manager->getAverageOccupancy(0))); averageOccupancyField->setReadOnly(true); QLabel *reviseRatesLabel = new QLabel; reviseRatesLabel->setText(tr("Revise Rates By % : ")); reviseRatesField = new QLineEdit(tr("0")); QRadioButton *reviseRatesUpRadio = new QRadioButton; reviseRatesUpRadio->setText(tr("Increment")); QRadioButton *reviseRatesDownRadio = new QRadioButton; reviseRatesDownRadio->setText(tr("Decrement")); reviseRatesGroup = new QButtonGroup; reviseRatesGroup->addButton(reviseRatesUpRadio,0); reviseRatesGroup->addButton(reviseRatesDownRadio,1); reviseRatesUpRadio->setChecked(true); QPushButton *reviseRatesButton = new QPushButton(tr("Revise Tariff")); connect(reviseRatesButton,SIGNAL(clicked()),this,SLOT(reviseRates())); connect(reviseRatesField, SIGNAL(returnPressed()), this, SLOT(reviseRates())); occupancyWidget = new QWidget; QHBoxLayout *horizontalLayout1 = new QHBoxLayout; horizontalLayout1->addWidget(monthLabel); horizontalLayout1->addWidget(monthCombo); QHBoxLayout *horizontalLayout2 = new QHBoxLayout; horizontalLayout2->addWidget(averageOccupancyLabel); horizontalLayout2->addWidget(averageOccupancyField); QHBoxLayout *horizontalLayout3 = new QHBoxLayout; horizontalLayout3->addWidget(reviseRatesLabel); horizontalLayout3->addWidget(reviseRatesField); horizontalLayout3->addWidget(reviseRatesUpRadio); horizontalLayout3->addWidget(reviseRatesDownRadio); QVBoxLayout *verticalLayout = new QVBoxLayout; verticalLayout->addLayout(horizontalLayout1); verticalLayout->addLayout(horizontalLayout2); verticalLayout->addLayout(horizontalLayout3); verticalLayout->addWidget(reviseRatesButton); occupancyWidget->setLayout(verticalLayout); }
NewIdentityDialog::NewIdentityDialog(const QStringList &identities, QWidget *parent, const char *name, bool modal) : KDialogBase(parent, name, modal, i18n("New Identity"), Ok | Cancel | Help, Ok, true) { setHelp(QString::fromLatin1("configure-identity-newidentitydialog")); QWidget *page = makeMainWidget(); QVBoxLayout *vlay = new QVBoxLayout(page, 0, spacingHint()); // row 0: line edit with label QHBoxLayout *hlay = new QHBoxLayout(vlay); // inherits spacing mLineEdit = new KLineEdit(page); mLineEdit->setFocus(); hlay->addWidget(new QLabel(mLineEdit, i18n("&New identity:"), page)); hlay->addWidget(mLineEdit, 1); connect(mLineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(slotEnableOK(const QString &))); mButtonGroup = new QButtonGroup(page); mButtonGroup->hide(); // row 1: radio button QRadioButton *radio = new QRadioButton(i18n("&With empty fields"), page); radio->setChecked(true); mButtonGroup->insert(radio, Empty); vlay->addWidget(radio); // row 2: radio button radio = new QRadioButton(i18n("&Use Control Center settings"), page); mButtonGroup->insert(radio, ControlCenter); vlay->addWidget(radio); // row 3: radio button radio = new QRadioButton(i18n("&Duplicate existing identity"), page); mButtonGroup->insert(radio, ExistingEntry); vlay->addWidget(radio); // row 4: combobox with existing identities and label hlay = new QHBoxLayout(vlay); // inherits spacing mComboBox = new QComboBox(false, page); mComboBox->insertStringList(identities); mComboBox->setEnabled(false); QLabel *label = new QLabel(mComboBox, i18n("&Existing identities:"), page); label->setEnabled(false); hlay->addWidget(label); hlay->addWidget(mComboBox, 1); vlay->addStretch(1); // spacer // enable/disable combobox and label depending on the third radio // button's state: connect(radio, SIGNAL(toggled(bool)), label, SLOT(setEnabled(bool))); connect(radio, SIGNAL(toggled(bool)), mComboBox, SLOT(setEnabled(bool))); enableButtonOK(false); // since line edit is empty }
void TestQTestComplex::pl_button_checked() { QRadioButton *button = new QRadioButton(); button->setChecked(true); delete button; }
void LiquidConfig::load(KConfig*) { config_->setGroup("General"); QString value = config_->readEntry("TitleAlignment", "AlignHCenter"); QRadioButton *button = (QRadioButton*)dialog_->titlealign->child((const char *)value.latin1()); if (button) button->setChecked(true); bool useShadowedText = config_->readBoolEntry("UseShadowedText", true); dialog_->useShadowedText->setChecked(useShadowedText); }
QGroupBox *ServerDialog::create3v3Box() { QGroupBox *box = new QGroupBox(tr("3v3 options")); box->setEnabled(Config.GameMode == "06_3v3"); box->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); QVBoxLayout *vlayout = new QVBoxLayout; official_3v3_radiobutton = new QRadioButton(tr("Official mode")); QComboBox *officialComboBox = new QComboBox; officialComboBox->addItem(tr("Classical"), "Classical"); officialComboBox->addItem("2012", "2012"); officialComboBox->addItem("2013", "2013"); official_3v3_ComboBox = officialComboBox; QString rule = Config.value("3v3/OfficialRule", "2012").toString(); if (rule == "2012") officialComboBox->setCurrentIndex(1); else if (rule == "2013") officialComboBox->setCurrentIndex(2); QRadioButton *extend = new QRadioButton(tr("Extension mode")); QPushButton *extend_edit_button = new QPushButton(tr("General selection ...")); extend_edit_button->setEnabled(false); connect(extend, SIGNAL(toggled(bool)), extend_edit_button, SLOT(setEnabled(bool))); connect(extend_edit_button, SIGNAL(clicked()), this, SLOT(select3v3Generals())); exclude_disaster_checkbox = new QCheckBox(tr("Exclude disasters")); exclude_disaster_checkbox->setChecked(Config.value("3v3/ExcludeDisasters", true).toBool()); QComboBox *roleChooseComboBox = new QComboBox; roleChooseComboBox->addItem(tr("Normal"), "Normal"); roleChooseComboBox->addItem(tr("Random"), "Random"); roleChooseComboBox->addItem(tr("All roles"), "AllRoles"); role_choose_ComboBox = roleChooseComboBox; QString scheme = Config.value("3v3/RoleChoose", "Normal").toString(); if (scheme == "Random") roleChooseComboBox->setCurrentIndex(1); else if (scheme == "AllRoles") roleChooseComboBox->setCurrentIndex(2); vlayout->addLayout(HLay(official_3v3_radiobutton, official_3v3_ComboBox)); vlayout->addLayout(HLay(extend, extend_edit_button)); vlayout->addWidget(exclude_disaster_checkbox); vlayout->addLayout(HLay(new QLabel(tr("Role choose")), role_choose_ComboBox)); box->setLayout(vlayout); bool using_extension = Config.value("3v3/UsingExtension", false).toBool(); if (using_extension) extend->setChecked(true); else official_3v3_radiobutton->setChecked(true); return box; }
void JSPoliciesFrame::refresh() { QRadioButton *button; button = static_cast<QRadioButton *>(js_popup->button( policies->window_open)); if (button != 0) button->setChecked(true); button = static_cast<QRadioButton *>(js_resize->button( policies->window_resize)); if (button != 0) button->setChecked(true); button = static_cast<QRadioButton *>(js_move->button( policies->window_move)); if (button != 0) button->setChecked(true); button = static_cast<QRadioButton *>(js_focus->button( policies->window_focus)); if (button != 0) button->setChecked(true); button = static_cast<QRadioButton *>(js_statusbar->button( policies->window_status)); if (button != 0) button->setChecked(true); }
void PlastikConfig::defaults() { QRadioButton *button = m_dialog->titleAlign->findChild<QRadioButton*>("AlignLeft"); if (button) button->setChecked(true); m_dialog->animateButtons->setChecked(true); m_dialog->menuClose->setChecked(false); m_dialog->titleShadow->setChecked(true); m_dialog->coloredBorder->setChecked(true); }