当前位置: 首页>>代码示例>>C++>>正文


C++ QRadioButton::setObjectName方法代码示例

本文整理汇总了C++中QRadioButton::setObjectName方法的典型用法代码示例。如果您正苦于以下问题:C++ QRadioButton::setObjectName方法的具体用法?C++ QRadioButton::setObjectName怎么用?C++ QRadioButton::setObjectName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QRadioButton的用法示例。


在下文中一共展示了QRadioButton::setObjectName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: KDialog

AddViewDialog::AddViewDialog( QHash<QString, ViewFactory*> *viewFactoryDict,
                              QWidget *parent )
  : KDialog( parent),
    mViewFactoryDict( viewFactoryDict )
{
  setCaption( i18n( "Add View" ) );
  setButtons( KDialog::Ok | KDialog::Cancel );
  setDefaultButton( KDialog::Ok );

  mTypeId = 0;

  QWidget *page = new QWidget(this);
  setMainWidget( page );

  QGridLayout *layout = new QGridLayout( page );
  layout->setMargin( 0 );
  layout->setSpacing( spacingHint() );
  layout->setRowStretch( 1, 1 );
  layout->setColumnStretch( 1, 1 );

  QLabel *label = new QLabel( i18n( "View name:" ), page );
  layout->addWidget( label, 0, 0 );

  mViewNameEdit = new KLineEdit( page );
  connect( mViewNameEdit, SIGNAL( textChanged( const QString& ) ),
           SLOT( textChanged( const QString& ) ) );
  layout->addWidget( mViewNameEdit, 0, 1 );

  QGroupBox *group = new QGroupBox( i18n( "View Type" ), page );
  mTypeGroup = new QButtonGroup;
  mTypeGroup->setExclusive( true );
  connect( mTypeGroup, SIGNAL( buttonClicked( int ) ), 
           this, SLOT( clicked( int ) ) );
  layout->addWidget( group, 1, 0, 1, 2 );
  QGridLayout *groupLayout = new QGridLayout();
  groupLayout->setMargin( KDialog::marginHint() );
  groupLayout->setSpacing( KDialog::spacingHint() );
  group->setLayout( groupLayout );

  int row = 0;
  QHashIterator<QString, ViewFactory*> iter( *mViewFactoryDict );
  while ( iter.hasNext() ) {
    iter.next();
    QRadioButton *button = new QRadioButton( i18n( iter.value()->type().toUtf8() ),
                                             group );
    button->setObjectName( iter.value()->type().toLatin1() );
    mTypeGroup->addButton( button, row );
    label = new QLabel( iter.value()->description(), group );
    label->setWordWrap( true );

    groupLayout->addWidget( button, row, 0, Qt::AlignTop );
    groupLayout->addWidget( label, row, 1, Qt::AlignTop );

    row++;
  }

  mTypeGroup->button( 0 )->setChecked( true );
  mViewNameEdit->setFocus();
  enableButton( KDialog::Ok, false );
}
开发者ID:akhuettel,项目名称:kdepim-noakonadi,代码行数:60,代码来源:addviewdialog.cpp

示例2: QVBoxLayout

ServiceChooser::ServiceChooser(const QByteArray &service,
							   const LocalizedString &title,
							   const QByteArray &currentService,
							   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*)));
}
开发者ID:dganic,项目名称:qutim,代码行数:27,代码来源:simplecontactlistsettings.cpp

示例3: Handle

	void ItemHandlerRadio::Handle (const QDomElement& item, QWidget *pwidget)
	{
		QGridLayout *lay = qobject_cast<QGridLayout*> (pwidget->layout ());
		RadioGroup *group = new RadioGroup (XSD_);
		group->setObjectName (item.attribute ("property"));

		QDomElement option = item.firstChildElement ("option");
		while (!option.isNull ())
		{
			QRadioButton *button = new QRadioButton (XSD_->GetLabel (option));
			button->setObjectName (option.attribute ("name"));
			group->AddButton (button,
					option.hasAttribute ("default") &&
					option.attribute ("default") == "true");
			option = option.nextSiblingElement ("option");
		}

		QVariant value = XSD_->GetValue (item);

		connect (group,
				SIGNAL (valueChanged ()),
				this,
				SLOT (updatePreferences ()));

		QGroupBox *box = new QGroupBox (XSD_->GetLabel (item));
		QVBoxLayout *layout = new QVBoxLayout ();
		box->setLayout (layout);
		layout->addWidget (group);

		group->setProperty ("ItemHandler",
				QVariant::fromValue<QObject*> (this));

		lay->addWidget (box, lay->rowCount (), 0);
	}
开发者ID:Apkawa,项目名称:leechcraft,代码行数:34,代码来源:itemhandlerradio.cpp

示例4: initialize

void PreferencesDialog::initialize(PreferencesTab initialTab, const persistence::Settings *settings, const QMap<QString, QString> &jamRecorders)
{
    Q_UNUSED(initialTab);
    this->settings = settings;
    this->jamRecorders = jamRecorders;
    this->jamRecorderCheckBoxes = QMap<QCheckBox *, QString>();
    this->jamDateFormatRadioButtons = QMap<const QRadioButton *, QString>();

    for (const auto &jamRecorder : jamRecorders.keys()) {
        QCheckBox *myCheckBox = new QCheckBox(this);
        myCheckBox->setObjectName(jamRecorder);
        myCheckBox->setText(jamRecorders.value(jamRecorder));
        ui->layoutRecorders->addWidget(myCheckBox);
        jamRecorderCheckBoxes[myCheckBox] = jamRecorder;
    }

    QDateTime now = QDateTime::currentDateTime();
    Qt::DateFormat dateFormat;
    QString nowString;
    QRadioButton *myRadioButton;

    dateFormat = Qt::TextDate;
    nowString = "Jam-" + now.toString(dateFormat).replace(QRegExp("[/:]"), "-").replace(QRegExp("[ ]"), "_");
    myRadioButton = new QRadioButton(this);
    myRadioButton->setObjectName("rbdfTextDate");
    myRadioButton->setText(nowString);
    myRadioButton->setProperty("buttonGroup", "rbDateFormat");
    ui->layoutDateFormats->addWidget(myRadioButton);
    jamDateFormatRadioButtons[myRadioButton] = "Qt::TextDate";

    dateFormat = Qt::ISODate;
    nowString = "Jam-" + now.toString(dateFormat).replace(QRegExp("[/:]"), "-").replace(QRegExp("[ ]"), "_");
    myRadioButton = new QRadioButton(this);
    myRadioButton->setObjectName("rbdfISODate");
    myRadioButton->setText(nowString);
    myRadioButton->setProperty("buttonGroup", "rbDateFormat");
    ui->layoutDateFormats->addWidget(myRadioButton);
    jamDateFormatRadioButtons[myRadioButton] = "Qt::ISODate";

    setupSignals();

    populateAllTabs();
}
开发者ID:pljones,项目名称:JamTaba,代码行数:43,代码来源:PreferencesDialog.cpp

示例5: QGroupBox

QGroupBox *ServerDialog::createGameModeBox() {
    QGroupBox *mode_box = new QGroupBox(tr("Game mode"));
    mode_group = new QButtonGroup;

    QObjectList item_list;

    // 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());
        mode_group->addButton(button);

        if (itor.key() == "02_1v1") {
            QGroupBox *box = create1v1Box();
            connect(button, SIGNAL(toggled(bool)), box, SLOT(setEnabled(bool)));

            item_list << button << box;
        } else if (itor.key() == "06_3v3") {
            QGroupBox *box = create3v3Box();
            connect(button, SIGNAL(toggled(bool)), box, SLOT(setEnabled(bool)));

            item_list << button << box;
        } else if (itor.key() == "06_XMode") {
            QGroupBox *box = createXModeBox();
            connect(button, SIGNAL(toggled(bool)), box, SLOT(setEnabled(bool)));

            item_list << button << box;
        } else {
            item_list << button;
        }

        if (itor.key() == Config.GameMode)
            button->setChecked(true);
    }

    // add scenario modes
    QRadioButton *scenario_button = new QRadioButton(tr("Scenario mode"));
    scenario_button->setObjectName("scenario");
    mode_group->addButton(scenario_button);

    scenario_ComboBox = new QComboBox;
    QStringList names = Sanguosha->getModScenarioNames();
    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);
    }
开发者ID:Satoshi-t,项目名称:Sanbansha,代码行数:53,代码来源:server.cpp

示例6: QGroupBox

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);
            }
        }
    }
开发者ID:KenKic,项目名称:QSanguosha,代码行数:51,代码来源:server.cpp

示例7: setFieldConstituentButtons

//------------------------------------------------------------------------------------------------
// 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();
}
开发者ID:gibbogle,项目名称:vspheroid-abm,代码行数:58,代码来源:field.cpp

示例8: initOptionGroup

void PatternAnalysisWizard::initOptionGroup(void)
{
	optionGroup->setExclusive(true);
	QRadioButton *outlierButton = new QRadioButton(tr("Detect Outliers (using SVM)"));
	outlierButton->setObjectName("outlierButton");
	QRadioButton *classifyButton = new QRadioButton(tr("Classify (using KPLS)"));
	classifyButton->setObjectName("classifyButton");
	QRadioButton *createTrainButton = new QRadioButton(tr("Create Training Model... (using SEGMODEL)"));
	createTrainButton->setObjectName("createTrainButton");
	QRadioButton *appendTrainButton = new QRadioButton(tr("Append Training Model... (using APPENDMODEL)"));
	appendTrainButton->setObjectName("appendTrainButton");
	QRadioButton *activeButton = new QRadioButton(tr("Choose Features for Active Learning..."));
	activeButton->setObjectName("activeButton");
	QRadioButton *activeModelButton = new QRadioButton(tr("Extract Table From Active Model..."));
	activeModelButton->setObjectName("activeModelButton");
	QRadioButton *clusButton = new QRadioButton(tr("Select Features for Clustering..."));
	clusButton->setObjectName("clusButton");

	optionGroup->addButton(outlierButton, 0);
	optionGroup->addButton(classifyButton, 1);
	optionGroup->addButton(createTrainButton, 2);
	optionGroup->addButton(appendTrainButton, 3);
	optionGroup->addButton(activeButton, 4);
	optionGroup->addButton(activeModelButton, 5);
	optionGroup->addButton(clusButton, 6);

	switch(m_module)
		{
		    case _SVM: 
				outlierButton->setChecked(true);
				break;
			case _KPLS:
			    classifyButton->setChecked(true);
		        break;
			case _SEGMODEL:
				createTrainButton->setChecked(true);
				break;
			case _APPENDMODEL:
				appendTrainButton->setChecked(true);
				break;
			case _ACTIVE:
				activeButton->setChecked(true);
				break;
			case _ACTIVEMODEL:
				activeModelButton->setChecked(true);
				break;
			case _CLUS:
				clusButton->setChecked(true);
				break;
		}
}
开发者ID:JumperWang,项目名称:farsight-clone,代码行数:51,代码来源:PatternAnalysisWizard.cpp

示例9: updateDevicesList

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);
}
开发者ID:rickysarraf,项目名称:digikam,代码行数:48,代码来源:ksane_device_dialog.cpp

示例10: setCellConstituentButtons

//------------------------------------------------------------------------------------------------
// 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();
}
开发者ID:gibbogle,项目名称:vspheroid-abm,代码行数:55,代码来源:field.cpp

示例11: pos

MeasuringReceiver::MeasuringReceiver(Device *devicePtr,
                                     double initialCenter,
                                     QWidget *parent) :
    QDialog(parent),
    device(devicePtr),
    running(true),
    reinitialize(true),
    recalibrate(true)
{
    setWindowTitle("Measuring Receiver");
    setObjectName("SH_Page");
    setFixedWidth(400);

    QPoint pos(0, 0); // For positioning widgets

    Label *title = new Label("Synchronous Level Detector", this);
    title->move(QPoint(5, pos.y()));
    title->resize(width(), WIDGET_HEIGHT);
    pos += QPoint(0, WIDGET_HEIGHT+5);
    freqEntry = new FrequencyEntry("Center Freq", initialCenter, this);
    freqEntry->move(pos);
    freqEntry->resize(width() * 0.75, WIDGET_HEIGHT);
    pos += QPoint(0, WIDGET_HEIGHT+5);

    Label *ampRangeLabel = new Label("Amplitude Range", this);
    ampRangeLabel->move(QPoint(5, pos.y()));
    ampRangeLabel->resize(width(), WIDGET_HEIGHT);
    pos += QPoint(0, WIDGET_HEIGHT);

    ampGroup = new QButtonGroup(this);
    QRadioButton *highAmp = new QRadioButton("High Power Range", this),
            *midAmp = new QRadioButton("Mid Power Range", this),
            *lowAmp = new QRadioButton("Low Power Range", this);

    highAmp->move(pos);
    highAmp->resize(width()/2, WIDGET_HEIGHT);
    highAmp->setObjectName("SHPrefRadioButton");
    highAmp->setChecked(true);
    ampGroup->addButton(highAmp, MeasRcvrRangeHigh);

    highLabel = new Label("", this);
    highLabel->move(QPoint(width()/2, pos.y()));
    highLabel->resize(width()/2, WIDGET_HEIGHT);
    pos += QPoint(0, WIDGET_HEIGHT);

    midAmp->move(pos);
    midAmp->resize(width()/2, WIDGET_HEIGHT);
    midAmp->setObjectName("SHPrefRadioButton");
    ampGroup->addButton(midAmp, MeasRcvrRangeMid);

    midLabel = new Label("", this);
    midLabel->move(QPoint(width()/2, pos.y()));
    midLabel->resize(width()/2, WIDGET_HEIGHT);
    pos += QPoint(0, WIDGET_HEIGHT);

    lowAmp->move(pos);
    lowAmp->resize(width()/2, WIDGET_HEIGHT);
    lowAmp->setObjectName("SHPrefRadioButton");
    ampGroup->addButton(lowAmp, MeasRcvrRangeLow);

    lowLabel = new Label("", this);
    lowLabel->move(QPoint(width()/2, pos.y()));
    lowLabel->resize(width()/2, WIDGET_HEIGHT);
    pos += QPoint(0, WIDGET_HEIGHT+5);

    Label *centerLabel = new Label("RF Frequency", this);
    centerLabel->move(QPoint(5, pos.y()));
    centerLabel->resize(width()/2, WIDGET_HEIGHT);
    centerReadout = new Label("915.11002 MHz", this);
    centerReadout->move(QPoint(width()/2 + 5, pos.y()));
    centerReadout->resize(width()/2, WIDGET_HEIGHT);
    pos += QPoint(0, WIDGET_HEIGHT);

    Label *powerLabel = new Label("RF Power", this);
    powerLabel->move(QPoint(5, pos.y()));
    powerLabel->resize(width()/2, WIDGET_HEIGHT);
    powerReadout = new Label("-32.22 dBm", this);
    powerReadout->move(QPoint(width()/2 + 5, pos.y()));
    powerReadout->resize(width()/2, WIDGET_HEIGHT);
    pos += QPoint(0, WIDGET_HEIGHT);

    Label *relativeLabel = new Label("Relative Power", this);
    relativeLabel->move(QPoint(5, pos.y()));
    relativeLabel->resize(width()/2, WIDGET_HEIGHT);
    relativeReadout = new Label("-5.002 dB", this);
    relativeReadout->move(QPoint(width()/2 + 5, pos.y()));
    relativeReadout->resize(width()/2, WIDGET_HEIGHT);
    pos += QPoint(0, WIDGET_HEIGHT);

    Label *averageLabel = new Label("Average Relative Power", this);
    averageLabel->move(QPoint(5, pos.y()));
    averageLabel->resize(width()/2, WIDGET_HEIGHT);
    averageReadout = new Label("-4.998 dB", this);
    averageReadout->move(QPoint(width()/2 + 5, pos.y()));
    averageReadout->resize(width()/2, WIDGET_HEIGHT);
    pos += QPoint(0, WIDGET_HEIGHT*1.5);

    SHPushButton *sync = new SHPushButton("Sync", this);
    sync->move(QPoint(5, pos.y()));
    sync->resize(width()/2 - 10, WIDGET_HEIGHT);
//.........这里部分代码省略.........
开发者ID:hendorog,项目名称:BBApp,代码行数:101,代码来源:measuring_receiver_dialog.cpp

示例12: QDialog

SelectModule::SelectModule (const QString& type, const SelectModule::Dict& types, QWidget * parent)
  : QDialog(parent, Qt::WindowTitleHint)
{
    setWindowTitle(tr("Select module"));
    groupBox = new QGroupBox(this);
    groupBox->setTitle(tr("Open %1 as").arg(type));

    group = new QButtonGroup(this);
    gridLayout = new QGridLayout(this);
    gridLayout->setSpacing(6);
    gridLayout->setMargin(9);

    gridLayout1 = new QGridLayout(groupBox);
    gridLayout1->setSpacing(6);
    gridLayout1->setMargin(9);

    int index = 0;
    for (SelectModule::Dict::const_iterator it = types.begin(); it != types.end(); ++it) {
        QRadioButton* button = new QRadioButton(groupBox);

        QRegExp rx;
        QString filter = it.key();
        QString module = it.value();

        // ignore file types in (...)
        rx.setPattern(QLatin1String("\\s+\\([\\w\\*\\s\\.]+\\)$"));
        int pos = rx.indexIn(filter);
        if (pos != -1) {
            filter = filter.left(pos);
        }

        // ignore Gui suffix in module name
        rx.setPattern(QLatin1String("Gui$"));
        pos = rx.indexIn(module);
        if (pos != -1) {
            module = module.left(pos);
        }

        button->setText(QString::fromAscii("%1 (%2)").arg(filter).arg(module));
        button->setObjectName(it.value());
        gridLayout1->addWidget(button, index, 0, 1, 1);
        group->addButton(button, index);
        index++;
    }

    gridLayout->addWidget(groupBox, 0, 0, 1, 1);
    spacerItem = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
    gridLayout->addItem(spacerItem, 1, 0, 1, 1);

    hboxLayout = new QHBoxLayout();
    hboxLayout->setSpacing(6);
    hboxLayout->setMargin(0);
    spacerItem1 = new QSpacerItem(131, 31, QSizePolicy::Expanding, QSizePolicy::Minimum);
    hboxLayout->addItem(spacerItem1);

    okButton = new QPushButton(this);
    okButton->setObjectName(QString::fromUtf8("okButton"));
    okButton->setText(tr("Select"));
    okButton->setEnabled(false);

    hboxLayout->addWidget(okButton);
    gridLayout->addLayout(hboxLayout, 2, 0, 1, 1);

    // connections
    connect(okButton, SIGNAL(clicked()), this, SLOT(accept()));
    connect(group, SIGNAL(buttonClicked(int)), this, SLOT(onButtonClicked()));
}
开发者ID:5263,项目名称:FreeCAD,代码行数:67,代码来源:FileDialog.cpp

示例13: QWidget

GenericStep::GenericStep( bool isInput_in, QString ID_in, vector<StepGenericElement*> elements_in, QWidget *parent)
    : QWidget(parent)
{
	ui.setupUi(this);
	
	inputStep = isInput_in;
	ID = ID_in; 
	QVBoxLayout * mainLayout = new QVBoxLayout();
	StepGenericElement * currentElement;
	//Loop through the elements
	for(int i = 0; i<elements_in.size(); i++){
	
		currentElement = elements_in.at(i);
		
		if(currentElement != 0){
			//Check the type of element
			switch(currentElement->getElementName()){
				case TEXT:
					
					Text * textElement = dynamic_cast<Text*>(currentElement);
					
					//Generating area where to insert the text
					QScrollArea * scrollArea = new QScrollArea();
					scrollArea->setWidgetResizable(true);
						
					//if(textElement->getWidth() != 0)
						//scrollArea->setFixedWidth(textElement->getWidth());
					//if(textElement->getRows() != 0)
						//scrollArea->setFixedHeight(textElement->getRows());
					
					QLabel *description = new QLabel(textElement->getContent(), this);
					description->setWordWrap(true);
					description->setAlignment(Qt::AlignJustify);
				
					scrollArea->setWidget(description);
					mainLayout->addWidget(scrollArea);
					break;
					
				case INPUTFIELD:
					
					Input * inputElement = dynamic_cast<Input*>(currentElement);
					
					//Generating a gridlayout where to put both the label and the field
					QGridLayout * inputContainerLayout = new QGridLayout(this);
					QWidget * inputContainer = new QWidget(this);
					
					QLabel * inputLabel = new QLabel(inputElement->getLabel(),this);
					QTextEdit * inputText = new QTextEdit(inputElement->getContent(),this);
					
					inputText->setObjectName(inputElement->getId());
					inputElements.push_back(inputText);
					
					if(inputElement->getWidth() != 0)
						inputText->setFixedHeight(inputElement->getWidth());
					if(inputElement->getRows() != 0)
						inputText->setFixedHeight(inputElement->getRows()*20);
					
					switch(inputElement->getPos()){
						case UP:
							inputContainerLayout->addWidget(inputLabel,0,0);
							inputContainerLayout->addWidget(inputText,1,0);
							break;
						case DOWN:
							inputContainerLayout->addWidget(inputLabel,1,0);
							inputContainerLayout->addWidget(inputText,0,0);
							break;
						case LEFT:
							inputContainerLayout->addWidget(inputLabel,0,0);
							inputContainerLayout->addWidget(inputText,0,1);
							break;
						case RIGHT:
							inputContainerLayout->addWidget(inputLabel,0,1);
							inputContainerLayout->addWidget(inputText,0,0);
							break;
						default : break;
							
					}
					inputContainer->setLayout(inputContainerLayout);										
					inputContainerLayout->setVerticalSpacing(1);
					mainLayout->addWidget(inputContainer);
					break;
				case IMAGE:
					/* TODO: Given an Image element, this part of the code should
					 * renderize a box (as big as width and height attributes say)
					 * containing the image. The base64 encoding of the image is given
					 * by the content of the element. Probably the most part of the times
					 * this functionality won't be required. The important thing to do
					 * is to renderize a button to snap the photo.
					 */
					break;
				case RECORDING:
					/* TODO:
					 * The stuff to do is exactly the same then the one of the image. The only 
					 * differenze is that you have to renderize a "record","play","pause" button
					 * to interact with the mobile recorder.
					 */
					break;
				case SELECT:
					Select * selectElement = dynamic_cast<Select*>(currentElement);
						QButtonGroup * radioGroup = new QButtonGroup();
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:

示例14: KDialog


//.........这里部分代码省略.........
  if ( !d->submitBugWeb )
      d->m_strVersion += ' ' + d->kde_version;
  d->m_version = new QLabel( d->m_strVersion, parent );
  d->m_version->setTextInteractionFlags(Qt::TextBrowserInteraction);
  //glay->addWidget( d->m_version, row, 1 );
  glay->addWidget( d->m_version, row, 1, 1, 2 );
  d->m_version->setWhatsThis(qwtstr );

  tmpLabel = new QLabel(i18n("OS:"), parent);
  glay->addWidget( tmpLabel, ++row, 0 );

  struct utsname unameBuf;
  uname( &unameBuf );
  d->os = QString::fromLatin1( unameBuf.sysname ) +
          " (" + QString::fromLatin1( unameBuf.machine ) + ") "
          "release " + QString::fromLatin1( unameBuf.release );

  tmpLabel = new QLabel(d->os, parent);
  tmpLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
  glay->addWidget( tmpLabel, row, 1, 1, 2 );

  tmpLabel = new QLabel(i18n("Compiler:"), parent);
  glay->addWidget( tmpLabel, ++row, 0 );
  tmpLabel = new QLabel(QString::fromLatin1(KDE_COMPILER_VERSION), parent);
  tmpLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
  glay->addWidget( tmpLabel, row, 1, 1, 2 );

  if ( !d->submitBugWeb )
  {
    // Severity
    d->m_bgSeverity = new QGroupBox( i18n("Se&verity"), parent );
    static const char * const sevNames[5] = { "critical", "grave", "normal", "wishlist", "i18n" };
    const QString sevTexts[5] = { i18n("Critical"), i18n("Grave"), i18nc("normal severity","Normal"), i18n("Wishlist"), i18n("Translation") };
    QHBoxLayout *severityLayout=new QHBoxLayout(d->m_bgSeverity);
    for (int i = 0 ; i < 5 ; i++ )
    {
      // Store the severity string as the name
      QRadioButton *rb = new QRadioButton( sevTexts[i], d->m_bgSeverity);
      rb->setObjectName(sevNames[i] );
      d->severityButtons.append(rb);
      severityLayout->addWidget(rb);
      if (i==2) rb->setChecked(true); // default : "normal"
    }

    lay->addWidget( d->m_bgSeverity );

    // Subject
    QHBoxLayout * hlay = new QHBoxLayout();
    lay->addItem(hlay);
    tmpLabel = new QLabel( i18n("S&ubject: "), parent );
    hlay->addWidget( tmpLabel );
    d->m_subject = new KLineEdit( parent );
    d->m_subject->setClearButtonShown(true);
    d->m_subject->setFocus();
    tmpLabel->setBuddy( d->m_subject );
    hlay->addWidget( d->m_subject );

    QString text = i18n("Enter the text (in English if possible) that you wish to submit for the "
                        "bug report.\n"
                        "If you press \"Send\", a mail message will be sent to the maintainer of "
                        "this program.\n");
    QLabel * label = new QLabel( parent);

    label->setText( text );
    lay->addWidget( label );

    // The multiline-edit
    d->m_lineedit = new KTextEdit( parent);
    d->m_lineedit->setMinimumHeight( 180 ); // make it big
    d->m_lineedit->setWordWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);
    d->m_lineedit->setLineWrapMode(QTextEdit::WidgetWidth);
    d->m_lineedit->setCheckSpellingEnabled(true);
    d->m_lineedit->setSpellCheckingLanguage("en");
    lay->addWidget( d->m_lineedit, 10 /*stretch*/ );

    d->_k_slotSetFrom();
  } else {
    // Point to the web form

    lay->addSpacing(10);
    QString text = i18n("<qt>To submit a bug report, click on the button below. This will open a web browser "
                        "window on <a href=\"http://bugs.kde.org\">http://bugs.kde.org</a> where you will find "
                        "a form to fill in. The information displayed above will be transferred to that server.</qt>");
    QLabel * label = new QLabel( text, parent);
    label->setOpenExternalLinks( true );
    label->setTextInteractionFlags( Qt::LinksAccessibleByMouse | Qt::LinksAccessibleByKeyboard );
    label->setWordWrap( true );
    lay->addWidget( label );
    lay->addSpacing(10);

    d->appcombo->setFocus();

    d->_k_updateUrl();

    setButtonText(Ok, i18n("&Launch Bug Report Wizard"));
    setButtonIcon(Ok, KIcon("tools-report-bug"));
  }
  parent->setMinimumHeight( parent->sizeHint().height() + 20 ); // WORKAROUND: prevent "cropped" kcombobox
  setMainWidget(parent);
}
开发者ID:,项目名称:,代码行数:101,代码来源:

示例15: if

static QList<QWidget*> getFormWidgets(QList<FormField> formFields, const QObject *receiver)
{
    QList<QWidget*> formWidgets;

    for (int i = 0; i < formFields.size(); ++i)
    {
        Poppler::FormField *formField = formFields.at(i).field;
        if (formField->type() == Poppler::FormField::FormText)
        {
            Poppler::FormFieldText *formFieldText = static_cast<Poppler::FormFieldText*>(formField);
            switch (formFieldText->textType())
            {
            case Poppler::FormFieldText::FileSelect:
            {
                // TODO replace this by a file selection widget
                QLineEdit *lineEdit = new QLineEdit;
                lineEdit->setText(formFieldText->text());
                lineEdit->setObjectName(QLatin1String("PageItem::formField") + QString::number(i));
                QObject::connect(lineEdit, SIGNAL(textEdited(QString)), receiver, SLOT(slotSetFormData(QString)));
                formWidgets << lineEdit;
            }
            break;
            case Poppler::FormFieldText::Multiline:
            {
                QTextEdit *textEdit = new QTextEdit;
                textEdit->setText(formFieldText->text());
                textEdit->setObjectName(QLatin1String("PageItem::formField") + QString::number(i));
                QObject::connect(textEdit, SIGNAL(textChanged()), receiver, SLOT(slotSetFormData()));
                formWidgets << textEdit;
            }
            break;
            case Poppler::FormFieldText::Normal:
            default:
            {
                QLineEdit *lineEdit = new QLineEdit;
                lineEdit->setText(formFieldText->text());
                lineEdit->setObjectName(QLatin1String("PageItem::formField") + QString::number(i));
                QObject::connect(lineEdit, SIGNAL(textEdited(QString)), receiver, SLOT(slotSetFormData(QString)));
                formWidgets << lineEdit;
            }
            break;
            }
        }
        else if (formField->type() == Poppler::FormField::FormButton)
        {
            Poppler::FormFieldButton *formFieldButton = static_cast<Poppler::FormFieldButton*>(formField);
            switch (formFieldButton->buttonType())
            {
            case Poppler::FormFieldButton::CheckBox:
            {
                QCheckBox *checkBox = new QCheckBox;
//						checkBox->setText(formFieldButton->caption());
                checkBox->setChecked(formFieldButton->state());
                checkBox->setObjectName(QLatin1String("PageItem::formField") + QString::number(i));
                QObject::connect(checkBox, SIGNAL(toggled(bool)), receiver, SLOT(slotSetFormData(bool)));
                formWidgets << checkBox;
            }
            break;
            case Poppler::FormFieldButton::Radio:
            {
                QRadioButton *radioButton = new QRadioButton;
                radioButton->setText(formFieldButton->caption());
                radioButton->setChecked(formFieldButton->state());
                radioButton->setObjectName(QLatin1String("PageItem::formField") + QString::number(i));
                QObject::connect(radioButton, SIGNAL(toggled(bool)), receiver, SLOT(slotSetFormData(bool)));
                formWidgets << radioButton;
            }
            break;
            case Poppler::FormFieldButton::Push:
            default:
            {
                QPushButton *pushButton = new QPushButton;
                pushButton->setText(formFieldButton->caption());
                pushButton->setChecked(formFieldButton->state());
                pushButton->setObjectName(QLatin1String("PageItem::formField") + QString::number(i));
                QObject::connect(pushButton, SIGNAL(toggled(bool)), receiver, SLOT(slotSetFormData(bool)));
                formWidgets << pushButton;
            }
            break;
            }
        }
        else if (formField->type() == Poppler::FormField::FormChoice)
        {
            Poppler::FormFieldChoice *formFieldChoice = static_cast<Poppler::FormFieldChoice*>(formField);
            switch (formFieldChoice->choiceType())
            {
            case Poppler::FormFieldChoice::ComboBox:
            {
                QComboBox *comboBox = new QComboBox;
                comboBox->addItems(formFieldChoice->choices());
                comboBox->setEditable(formFieldChoice->isEditable());
                comboBox->setCurrentIndex(formFieldChoice->currentChoices().at(0));
                comboBox->setObjectName(QLatin1String("PageItem::formField") + QString::number(i));
                QObject::connect(comboBox, SIGNAL(currentIndexChanged(int)), receiver, SLOT(slotSetFormData(int)));
                formWidgets << comboBox;
            }
            break;
            case Poppler::FormFieldChoice::ListBox:
            default:
            {
//.........这里部分代码省略.........
开发者ID:damoguyan,项目名称:pdfviewer,代码行数:101,代码来源:pageitem.cpp


注:本文中的QRadioButton::setObjectName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。