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


C++ QCheckBox::isChecked方法代码示例

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


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

示例1: handleCheckBox

void SifGenerator::handleCheckBox(const QDomElement &elem, QWidget *widget)
{
  QString name = elem.firstChildElement("SifName").text().trimmed();
  if( name == "" )
    name = elem.firstChildElement("Name").text().trimmed();
  
  QString def_val = elem.firstChildElement("DefaultValue").text().trimmed();
  if ( def_val == "" )
    def_val = "False";

  QCheckBox *checkBox = static_cast<QCheckBox*>(widget);
  
  if(checkBox->isChecked()) {
    if ( def_val != "True" )
      te->append("  " + name + " = True");
  } else {
    if ( def_val != "False" )
      te->append("  " + name + " = False");
  }
}
开发者ID:SangitaSingh,项目名称:elmerfem,代码行数:20,代码来源:sifgenerator.cpp

示例2: toText

QStringList ITranslatable::toText()
{
    QStringList output;
    QMap<QString,QWidget*> paramMap = getParameterMap();
    QMap<QString,QWidget*>::iterator it = paramMap.begin();

    for (it; it != paramMap.end(); ++it) {
        QWidget* p = it.value();
        if (!p->isVisible())
            //Don't output non-visible params
            continue;
        QString key = it.key();
        QString out = key + " = ";
        //Is text type
        QLineEdit* l = dynamic_cast<QLineEdit*>(p);
        if (l) {
            out += l->text();
            output << out;
            continue;
        }
        //Is checkbox type.
        QCheckBox* b = dynamic_cast<QCheckBox*>(p);
        if (b) {
            if (b->isChecked())
                out += "yes";
            else
                out += "no";
            output << out;
            continue;
        }
        //Is combobox type.
        QComboBox* c = dynamic_cast<QComboBox*>(p);
        if (c) {
            out += c->currentText();
            output << out;
            continue;
        }
    }

    return output;
}
开发者ID:CosteaPaul,项目名称:Circos,代码行数:41,代码来源:ITranslatable.cpp

示例3: on_pushButton_clicked

void ReportUser::on_pushButton_clicked()
{
    this->ui->pushButton->setEnabled(false);
    // we need to get a report info for all selected diffs
    QString reports = "";
    int xx = 0;
    int EvidenceID = 0;
    while (xx < this->ui->tableWidget->rowCount())
    {
        if (this->CheckBoxes.count() > xx)
        {
            QCheckBox *checkBox = (QCheckBox*)this->ui->tableWidget->cellWidget(xx, 4);
            if (checkBox->isChecked())
            {
                ++EvidenceID;
                reports += "[[Special:Diff/" + this->ui->tableWidget->item(xx, 3)->text() + "|" +
                           QString::number(EvidenceID) + "]] ";
            }
        }
        ++xx;
    }
    if (reports.isEmpty())
    {
        QMessageBox::StandardButton mb;
        mb = QMessageBox::question(this, "Question", _l("report-evidence-none-provid"), QMessageBox::Yes|QMessageBox::No);
        if (mb == QMessageBox::No)
        {
            this->ui->pushButton->setEnabled(true);
            return;
        }
    }
    // obtain current page
    this->Loading = true;
    this->ui->pushButton->setText(_l("report-retrieving"));
    this->qHistory = Generic::RetrieveWikiPageContents(this->ReportedUser->GetSite()->GetProjectConfig()->ReportAIV, this->ReportedUser->GetSite());
    this->qHistory->Site = this->ReportedUser->GetSite();
    this->qHistory->Process();
    this->ReportText = reports;
    this->tReportUser->start(HUGGLE_TIMER);
    return;
}
开发者ID:tommyang,项目名称:huggle3-qt-lx,代码行数:41,代码来源:reportuser.cpp

示例4: accept

void
SaveOnExitDialogWidget::saveClicked()
{
    // whizz through the list and save one by one using
    // singleSave to ensure warnings are given if neccessary
    // use mainWindow->ismultisave to prevent refreshing stats
    // for each file
    mainWindow->ismultisave = true;
    for (int i=0; i<dirtyList.count(); i++) {
        QCheckBox *c = (QCheckBox *)dirtyFiles->cellWidget(i,0);
        if (c->isChecked()) {
            if (i==dirtyList.count()-1) {
                mainWindow->ismultisave = false;
            }
            mainWindow->saveRideSingleDialog(dirtyList.at(i));
        }
    }

    mainWindow->ismultisave = false;
    accept();
}
开发者ID:BryanF1947,项目名称:GoldenCheetah,代码行数:21,代码来源:SaveDialogs.cpp

示例5: Store

		void Persistence::Store(QWidget* widget, QString storageName) {
			if (storageName.isEmpty()) storageName = widget->objectName();
			if (qobject_cast<QLineEdit*>(widget)) {
				QLineEdit* lineEdit = qobject_cast<QLineEdit*>(widget); 
				GetStore()[storageName] = QVariant(lineEdit->text());
			} else if (qobject_cast<QCheckBox*>(widget)) {
				QCheckBox* cb = qobject_cast<QCheckBox*>(widget); 
				GetStore()[storageName] = QVariant(cb->isChecked());
			} else if (qobject_cast<QSpinBox*>(widget)) {
				QSpinBox* sb = qobject_cast<QSpinBox*>(widget); 
				GetStore()[storageName] = QVariant(sb->value());
			} else if (qobject_cast<QRadioButton*>(widget)) {
				QRadioButton* rb = qobject_cast<QRadioButton*>(widget); 
				GetStore()[storageName] = QVariant(rb->isChecked());
			} else if (qobject_cast<QComboBox*>(widget)) {
				QComboBox* cb = qobject_cast<QComboBox*>(widget); 
				GetStore()[storageName] = QVariant(cb->currentText());
			} else {
				WARNING("Unsupported widget: " + widget->objectName());
			}
		}
开发者ID:Booley,项目名称:nbis,代码行数:21,代码来源:Persistence.cpp

示例6: SelectTarget

bool CLedInfoDialog::SelectTarget( )
{
    QString strChk = "chk%1";
    bool bRet = false;

    for ( int nIndex = 1; nIndex <= 4; nIndex++ ) {
        QCheckBox* pChk = findChild< QCheckBox* >( strChk.arg( nIndex ) );
        bRet = pChk->isChecked( );

        if ( bRet ) {
            break;
        }
    }

    if ( !bRet ) {
        CCommonFunction::MsgBox( NULL, CCommonFunction::GetMsgTitle( QMessageBox::Information ),
                                 QString( "请选择信息发布目标!" ), QMessageBox::Information, "background-image: url( );" );
    }

    return bRet;
}
开发者ID:Anne081031,项目名称:ParkCode,代码行数:21,代码来源:ledinfodialog.cpp

示例7: getDescriptionLayerShow

QString QgsSpatialQueryDialog::getDescriptionLayerShow( bool isTarget )
{
  QgsVectorLayer* lyr = NULL;
  QCheckBox * checkBox = NULL;
  if ( isTarget )
  {
    lyr = mLayerTarget;
    checkBox = ckbUsingSelectedTarget;
  }
  else
  {
    lyr = mLayerReference;
    checkBox = ckbUsingSelectedReference;
  }

  QString sDescFeatures = checkBox->isChecked()
                          ? tr( "%1 of %2" ).arg( lyr->selectedFeatureCount() ).arg( lyr->featureCount() )
                          : tr( "all = %1" ).arg( lyr->featureCount() );

  return QString( "%1 (%2)" ).arg( lyr->name() ).arg( sDescFeatures );
} // QString QgsSpatialQueryDialog::getDescriptionLayerShow(bool isTarget)
开发者ID:AaronGaim,项目名称:QGIS,代码行数:21,代码来源:qgsspatialquerydialog.cpp

示例8: setModelData

void MySqlRelationDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
{
    if (!index.isValid())
        return;

    QSqlRelationalTableModel *sqlModel = qobject_cast<QSqlRelationalTableModel *>(model);
    QSqlTableModel *childModel = sqlModel ? sqlModel->relationModel(index.column()) : 0;
    QComboBox *combo = qobject_cast<QComboBox *>(editor);
    if (!sqlModel || !childModel || !combo) {
        if (HandbookDialog::m_record.fieldName(index.column()).contains("IS_", Qt::CaseSensitive))
        {
            QCheckBox * checkBox = qobject_cast<QCheckBox *>(editor);
            sqlModel->setData(index, checkBox->isChecked(), Qt::DisplayRole);
            sqlModel->setData(index, checkBox->isChecked(), Qt::EditRole);
            return;
        }
        else if (HandbookDialog::m_record.fieldName(index.column()).contains("DATE_", Qt::CaseSensitive))
        {
            QDateEdit * dateEdit = qobject_cast<QDateEdit *>(editor);
            sqlModel->setData(index, dateEdit->date().toString("yyyy-MM-dd"), Qt::DisplayRole);
            sqlModel->setData(index, dateEdit->date().toString("yyyy-MM-dd"), Qt::EditRole);
            return;
        }
        else
        {
            QItemDelegate::setModelData(editor, model, index);
            return;
        }
    }

    int currentItem = combo->currentIndex();
    int childColIndex = childModel->fieldIndex(sqlModel->relation(index.column()).displayColumn());
    int childEditIndex = childModel->fieldIndex(sqlModel->relation(index.column()).indexColumn());
    sqlModel->setData(index,
            childModel->data(childModel->index(currentItem, childColIndex), Qt::DisplayRole),
            Qt::DisplayRole);
    sqlModel->setData(index,
            childModel->data(childModel->index(currentItem, childEditIndex), Qt::EditRole),
            Qt::EditRole);
}
开发者ID:BarsukAlexey,项目名称:xelarogi,代码行数:40,代码来源:handbookdialog.cpp

示例9: setModelData

void NotifyItemDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
{
    QLineEdit *edit = qobject_cast<QLineEdit *>(editor);
    if (edit) {
        model->setData(index, edit->text());
    } else {
        QComboBox * repeatEditor = qobject_cast<QComboBox *>(editor);
        if (repeatEditor) {
            model->setData(index, repeatEditor->currentText());
        } else {
            QSpinBox * expireEditor = qobject_cast<QSpinBox *>(editor);
            if (expireEditor) {
                model->setData(index, expireEditor->value(), Qt::EditRole);
            } else {
                QCheckBox* enablePlayEditor = qobject_cast<QCheckBox*>(editor);
                if (enablePlayEditor) {
                    model->setData(index, enablePlayEditor->isChecked(), Qt::EditRole);
                }
            }
        }
    }
}
开发者ID:1heinz,项目名称:TauLabs,代码行数:22,代码来源:notifyitemdelegate.cpp

示例10: children

	foreach (QObject* o, children()){
		QWidget* w = qobject_cast<QWidget*> (o);
		if (!w) continue;
		if (w->property("storage").isValid()){
			void* storage = w->property("storage").value<void*>();
			if (!storage) continue;
			//get value of the
			QCheckBox* checkBox = qobject_cast<QCheckBox*>(w);
			if (checkBox) {
				*((bool*)storage) = checkBox->isChecked();
				continue;
			}
			QLineEdit* edit = qobject_cast<QLineEdit*>(w);
			if (edit){
				*((QString*)storage) = edit->text();
				continue;
			}
			QTextEdit* tedit = qobject_cast<QTextEdit*>(w);
			if (tedit){
				*((QString*)storage) = tedit->toPlainText();
				continue;
			}
			QDoubleSpinBox* doubleSpinBox = qobject_cast<QDoubleSpinBox*>(w);
			if (doubleSpinBox){
				*((float*)storage) = doubleSpinBox->value();
				continue;
			}
			QSpinBox* spinBox = qobject_cast<QSpinBox*>(w);
			if (spinBox){
				*((int*)storage) = spinBox->value();
				continue;
			}
			QComboBox* comboBox = qobject_cast<QComboBox*>(w);
			if (comboBox){
				*((QStringList*)storage) = QStringList(comboBox->currentText());
				continue;
			}
		}
	}
开发者ID:svn2github,项目名称:texstudio,代码行数:39,代码来源:universalinputdialog.cpp

示例11: getValue

QVariant WidgetParameters::getValue(QWidget* curWidget)
{

    QLineEdit* lineEdit = dynamic_cast<QLineEdit*>(curWidget);
    if(lineEdit)
        return lineEdit->text();

    QScienceSpinBox* dblspinbox = dynamic_cast<QScienceSpinBox*>(curWidget);
    if(dblspinbox)
        return dblspinbox->value();

    QSpinBox* spinbox = dynamic_cast<QSpinBox*>(curWidget);
    if(spinbox)
        return spinbox->value();

    QCheckBox* checkbox = dynamic_cast<QCheckBox*>(curWidget);
    if(checkbox)
        return checkbox->isChecked();

    QComboBox* combo = dynamic_cast<QComboBox*>(curWidget);
    if(combo)
        return combo->itemData(combo->currentIndex());
}
开发者ID:OpenModelica,项目名称:OMOptim,代码行数:23,代码来源:MOParametersDlg.cpp

示例12: showQtVersionWarning

void Notepadqq::showQtVersionWarning(bool showCheckBox, QWidget *parent)
{
    QSettings settings;
    QString dir = QDir::toNativeSeparators(QDir::homePath() + "/Qt");
    QString altDir = "/opt/Qt";

    QMessageBox msgBox(parent);
    msgBox.setWindowTitle(QCoreApplication::applicationName());
    msgBox.setIcon(QMessageBox::Warning);
    msgBox.setText("<h3>" + QObject::tr("You are using an old version of Qt (%1)").arg(qVersion()) + "</h3>");
    msgBox.setInformativeText("<html><body>"
        "<p>" + QObject::tr("Notepadqq will try to do its best, but <b>some things will not work properly</b>.") + "</p>" +
        QObject::tr(
            "Install a newer Qt version (&ge; %1) from the official repositories "
            "of your distribution.<br><br>"
            "If it's not available, download Qt (&ge; %1) from %2 and install it to \"%3\" or to \"%4\".").
                  arg("5.3").
                  arg("<nobr><a href=\"http://qt-project.org/\">http://qt-project.org/</a></nobr>").
                  arg("<nobr>" + dir + "</nobr>").
                  arg("<nobr>" + altDir + "</nobr>") +
        "</body></html>");

    QCheckBox *chkDontShowAgain;

    if (showCheckBox) {
        chkDontShowAgain = new QCheckBox();
        chkDontShowAgain->setText(QObject::tr("Don't show me this warning again"));
        msgBox.setCheckBox(chkDontShowAgain);
    }

    msgBox.exec();

    if (showCheckBox) {
        settings.setValue("checkQtVersionAtStartup", !chkDontShowAgain->isChecked());
        chkDontShowAgain->deleteLater();
    }
}
开发者ID:hawkeye116477,项目名称:notepadqq,代码行数:37,代码来源:notepadqq.cpp

示例13: updateItemWidgets

void ServiceItemDelegate::updateItemWidgets(const QList<QWidget*> widgets,
                                              const QStyleOptionViewItem& option,
                                              const QPersistentModelIndex& index) const
{
    QCheckBox* checkBox = static_cast<QCheckBox*>(widgets[0]);
    KPushButton *configureButton = static_cast<KPushButton*>(widgets[1]);

    const int itemHeight = sizeHint(option, index).height();

    // Update the checkbox showing the service name and icon
    const QAbstractItemModel* model = index.model();
    checkBox->setText(model->data(index).toString());
    const QString iconName = model->data(index, Qt::DecorationRole).toString();
    if (!iconName.isEmpty()) {
        checkBox->setIcon(KIcon(iconName));
    }
    checkBox->setChecked(model->data(index, Qt::CheckStateRole).toBool());

    const bool configurable = model->data(index, ServiceModel::ConfigurableRole).toBool();

    int checkBoxWidth = option.rect.width();
    if (configurable) {
        checkBoxWidth -= configureButton->sizeHint().width();
    }
    checkBox->resize(checkBoxWidth, checkBox->sizeHint().height());
    checkBox->move(0, (itemHeight - checkBox->height()) / 2);

    // Update the configuration button
    if (configurable) {
        configureButton->setEnabled(checkBox->isChecked());
        configureButton->setIcon(KIcon("configure"));
        configureButton->resize(configureButton->sizeHint());
        configureButton->move(option.rect.right() - configureButton->width(),
                              (itemHeight - configureButton->height()) / 2);
    }
    configureButton->setVisible(configurable);
}
开发者ID:blue-shell,项目名称:folderview,代码行数:37,代码来源:serviceitemdelegate.cpp

示例14: getReminder

void MainWindow::getReminder() {
    // pull random from list
    if (m_reminderList->isEmpty()) {
        // show a text instead of a reminder
        m_text->append("There are no reminders to show.");
    }
    else {
        int rand = random(m_reminderList->length());
        QString rem = m_reminderList->at(rand);

         // show dialog
        QMessageBox reply;
        reply.setIcon(QMessageBox::Information);
        QCheckBox * check = new QCheckBox("Show this message again");
        check->setChecked(true);
        reply.setCheckBox(check);
        reply.setText(rem);
        reply.exec();

        if (!check->isChecked()) {
            m_reminderList->removeAt(rand);
        }
    }
}
开发者ID:samhmcg5,项目名称:3574-advisor,代码行数:24,代码来源:mainwindow.cpp

示例15: changeAllAssociation

void SettingsDialog::changeAllAssociation(bool checked)
{
    int size = gridLayout->count();
    QCheckBox *cb;
    for(int i = 0; i < size; ++i){
        cb = dynamic_cast<QCheckBox*>(gridLayout->itemAt(i)->widget());
        if (cb) {
            if (cb->isChecked() == checked)
                continue;

            QString ext(cb->text());
            if(checked){
                OSRelated::setAssociation(ext);
            }else{
                OSRelated::clearAssociation(ext);
            }
            cb->setChecked(checked);
        }
    }

    OSRelated::refreshExplorer();

    reviewCheckAllButtonState();
}
开发者ID:404neko,项目名称:ezviewer-1,代码行数:24,代码来源:settingdialog.cpp


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