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


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

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


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

示例1: on_toolButton_print_clicked

void PringKvitok::on_toolButton_print_clicked()
{
#if !defined(QT_NO_PRINTER)

    QPrinter printer(QPrinter::HighResolution);
    QPrintDialog *dlg = new QPrintDialog(&printer, this);

   dlg->setWindowTitle(tr("Настройки принтера"));
   if (dlg->exec() == QDialog::Accepted){
       QString pg;
       QMapIterator<QString, QCheckBox*> i(childsCheckBox_map);
       ui->progressBar->setVisible(true);
       int count = 0;
       int c = 0;
       while (i.hasNext()) {
           i.next();
            QCheckBox *cb = i.value();
            if (cb->checkState() == Qt::Checked){
                count++;
             }
       }

       ui->progressBar->setMaximum(count);
       QString page1;
       QString page2;
       while (i.hasPrevious()) {
           i.previous();
           QCheckBox *cb = i.value();

            if (cb->checkState() == Qt::Checked){
                if (ui->checkBox_twokv->checkState() == Qt::Checked){
                if (page1 == "") page1 = prepareKvit(cb->text());
                else {
                   page2 = prepareKvit(cb->text());
                   pg += TwoKvitOnePage(page1, page2);
                   page1 = "";
                   page2 = "";
                }
             } else pg += prepareKvit(cb->text());
             ui->progressBar->setValue(c++);
           }

       }
       if (ui->checkBox_twokv->checkState() == Qt::Checked && page1 != "" && page2 == "") pg += page1;
        QTextDocument textDocument;

        textDocument.setHtml(pg);
         QPrinter printer(QPrinter::HighResolution);
         printer.setOrientation(QPrinter::Portrait);
         printer.setPaperName("A4");
         printer.setPageMargins(0.3, 0.3, 0.3, 0.3, QPrinter::Unit() );
         if (ui->checkBox_duplex->checkState() == Qt::Checked)printer.setDuplex(QPrinter::DuplexAuto);
         textDocument.print(&printer);
          ui->progressBar->setVisible(false);
   }
   delete dlg;
 #endif
}
开发者ID:haltxz,项目名称:ds,代码行数:58,代码来源:pringkvitok.cpp

示例2: on_toolButton_pdf_clicked

void PringKvitok::on_toolButton_pdf_clicked()
{
#if !defined(QT_NO_PRINTER)

    QString pg;
    QMapIterator<QString, QCheckBox*> i(childsCheckBox_map);

    ui->progressBar->setVisible(true);
    int count = 0;
    int c = 0;
    while (i.hasNext()) {
        i.next();
         QCheckBox *cb = i.value();
         if (cb->checkState() == Qt::Checked){
             count++;
          }
    }

    ui->progressBar->setMaximum(count);
    QString page1;
    QString page2;
    while (i.hasPrevious()) {
        i.previous();
        QCheckBox *cb = i.value();

         if (cb->checkState() == Qt::Checked){
             if (ui->checkBox_twokv->checkState() == Qt::Checked){
             if (page1 == "") page1 = prepareKvit(cb->text());
             else {
                page2 = prepareKvit(cb->text());
                pg += TwoKvitOnePage(page1, page2);
                page1 = "";
                page2 = "";
             }
          } else pg += prepareKvit(cb->text());
          ui->progressBar->setValue(c++);
        }

    }
    if (ui->checkBox_twokv->checkState() == Qt::Checked && page1 != "" && page2 == "") pg += page1;
     QTextDocument textDocument;

     textDocument.setHtml(pg);
     QPrinter printer(QPrinter::HighResolution);

     printer.setOutputFormat(QPrinter::PdfFormat);
     printer.setOutputFileName( "print.pdf");

     printer.setOrientation(QPrinter::Portrait);
     printer.setPaperName("A4");


     printer.setPageMargins(1, 1, 1, 1,  QPrinter::Millimeter );
     textDocument.print(&printer);
     ui->progressBar->setValue(c++);
     ui->progressBar->setVisible(false);
 #endif
}
开发者ID:haltxz,项目名称:ds,代码行数:58,代码来源:pringkvitok.cpp

示例3: GetBool

bool ParamWidget::GetBool(const QString& name) {
  QCheckBox* checkbox = dynamic_cast<QCheckBox*>(GetWidget(name));
  if (!checkbox) {
    throw std::invalid_argument("Invalid bool parameter " + name.toStdString());
  }
  return checkbox->checkState() == Qt::Checked;
}
开发者ID:ashuang,项目名称:sceneview,代码行数:7,代码来源:param_widget.cpp

示例4: drv_checkbox

int drv_checkbox(int drvid, void *a0, void* a1, void* a2, void* a3, void* a4, void* a5, void* a6, void* a7, void* a8, void* a9)
{
    handle_head* head = (handle_head*)a0;
    QCheckBox *self = (QCheckBox*)head->native;
    switch (drvid) {
    case CHECKBOX_INIT: {
        drvNewObj(a0,new QCheckBox);
        break;
    }
    case CHECKBOX_SETCHECK: {
        self->setCheckState((Qt::CheckState)drvGetInt(a1));
        break;
    }
    case CHECKBOX_CHECK: {
        drvSetInt(a1,self->checkState());
        break;
    }
    case CHECKBOX_SETTRISTATE: {
        self->setTristate(drvGetBool(a1));
        break;
    }
    case CHECKBOX_ISTRISTATE: {
        drvSetBool(a1,self->isTristate());
        break;
    }
    case CHECKBOX_ONSTATECHANGED: {
        QObject::connect(self,SIGNAL(stateChanged(int)),drvNewSignal(self,a1,a2),SLOT(call(int)));
        break;
    }
    default:
        return 0;
    }
    return 1;
}
开发者ID:weigj,项目名称:loongide,代码行数:34,代码来源:cdrv.cpp

示例5: actionText

/*! \reimp */
QString QAccessibleButton::actionText(int action, Text text, int child) const
{
    if (child)
        return QString();

    if (text == Name) switch (action) {
    case Press:
    case DefaultAction: // press, checking or open
        switch (role(0)) {
        case ButtonMenu:
            return QPushButton::tr("Open");
        case CheckBox:
            {
                if (state(child) & Checked)
                    return QCheckBox::tr("Uncheck");
                QCheckBox *cb = qobject_cast<QCheckBox*>(object());
                if (!cb || !cb->isTristate() || cb->checkState() == Qt::PartiallyChecked)
                    return QCheckBox::tr("Check");
                return QCheckBox::tr("Toggle");
            }
            break;
        case RadioButton:
            return QRadioButton::tr("Check");
        default:
            break;
        }
        break;
    }
    return QAccessibleWidgetEx::actionText(action, text, child);
}
开发者ID:RS102839,项目名称:qt,代码行数:31,代码来源:simplewidgets.cpp

示例6: myPulseDevice

/**
 * Return checked Pulse Device
 */
const QString QvkPulse::myPulseDevice( QVBoxLayout *Pulseframe )
{
  QList<QCheckBox *> listQFrame = Pulseframe->findChildren<QCheckBox *>();
  QCheckBox *box;
  QList<int> integerList;
  QString ret;
  
  for ( int i = 0; i < listQFrame.count(); i++ )
  {
    box = listQFrame.at( i );
    if ( box->checkState() == Qt::Checked  )
      integerList.append( i );
  }

  if ( integerList.count() == 0 )
    ret = "";

  if ( integerList.count() == 1 )
  {
    box = listQFrame[ integerList[ 0 ] ];
    ret = box->accessibleName();
  }

  if ( integerList.count() > 1 )
    ret = "vokoscreenMix.monitor";

  return ret;
}
开发者ID:afiestas,项目名称:vokoscreen,代码行数:31,代码来源:QvkPulse.cpp

示例7: state

QAccessible::State QAccessibleButton::state() const
{
    QAccessible::State state = QAccessibleWidget::state();

    QAbstractButton *b = button();
    QCheckBox *cb = qobject_cast<QCheckBox *>(b);
    if (b->isCheckable())
        state.checkable = true;
    if (b->isChecked())
        state.checked = true;
    else if (cb && cb->checkState() == Qt::PartiallyChecked)
        state.checkStateMixed = true;
    if (b->isDown())
        state.pressed = true;
    QPushButton *pb = qobject_cast<QPushButton*>(b);
    if (pb) {
        if (pb->isDefault())
            state.defaultButton = true;
#ifndef QT_NO_MENU
        if (pb->menu())
            state.hasPopup = true;
#endif
    }

    return state;
}
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:26,代码来源:simplewidgets.cpp

示例8:

void
  pcl::modeler::BoolParameter::getEditorData(QWidget *editor)
{
  QCheckBox *checkBox = static_cast<QCheckBox*>(editor);
  bool value = (checkBox->checkState() == Qt::Checked);
  current_value_ = value;
}
开发者ID:hitsjt,项目名称:StanfordPCL,代码行数:7,代码来源:parameter.cpp

示例9: HandleUpdateInvisibleChanged

void EmitterAttributeEditor::HandleUpdateInvisibleChanged(int value)
{
	if(updatingWidget_)
		return;

	QCheckBox* chk = (QCheckBox*)sender();

	GetEffect()->SetUpdateInvisible(chk->checkState() == Qt::Checked);
}
开发者ID:xujingsy,项目名称:Urho3D_xujing,代码行数:9,代码来源:EmitterAttributeEditor.cpp

示例10: setModelData

void PropertyEditDelegate::setModelData(QWidget* editor_,
                                        QAbstractItemModel* model_,
                                        const QModelIndex& index) const
{
    const QVariant& data = index.data();
    GeneratorPropertiesModel* model =
        static_cast<GeneratorPropertiesModel*>(model_);

    switch (data.type())
    {
    case QVariant::Double:
    {
        QLineEdit* editor = static_cast<QLineEdit*>(editor_);
        model->setData(index, editor->text().toDouble(), Qt::EditRole);
        break;
    }
    case QVariant::Int:
    {
        QSpinBox* editor = static_cast<QSpinBox*>(editor_);
        editor->interpretText();
        model->setData(index, editor->value(), Qt::EditRole);
        break;
    }
    case QVariant::Bool:
    {
        QCheckBox* editor = static_cast<QCheckBox*>(editor_);
        const bool value = editor->checkState() == Qt::Checked;
        model->setData(index, value, Qt::EditRole);
        break;
    }
    case QVariant::List:
    {
        QLineEdit* editor = static_cast<QLineEdit*>(editor_);
        QStringList list = editor->text().split(",");
        QVariantList varList;
        QDoubleValidator validator;
        for (QString& str : list)
        {
            if (str == "")
                continue;

            int pos = 0;
            if (validator.validate(str, pos) == QValidator::Acceptable)
                varList.push_back(QVariant(str.toDouble()));
            else
                varList.push_back(QVariant(-1.0));
        }
        model->setData(index, varList, Qt::EditRole);
        break;
    }
    default:
    {
        break;
    }
    }
}
开发者ID:eile,项目名称:Monsteer,代码行数:56,代码来源:PropertyEditDelegate.cpp

示例11: updateTreeChecks

void GUIImport::updateTreeChecks(QObject* obj)
{
	QTreeWidgetItem* sender = (QTreeWidgetItem*)obj;

	QCheckBox* check = (QCheckBox*)ui->viewTree->itemWidget(sender, COL_CHECKBOX);
	
	if (!sender->parent())
	{
		Qt::CheckState state = check->checkState();
		if (check->checkState() == Qt::PartiallyChecked)
			state = Qt::Unchecked;
		
		// just disable or enable childs
		for (int i = 0; i < sender->childCount(); i++)
		{
			QTreeWidgetItem* attrItem = sender->child(i);
			QCheckBox* attr_check = (QCheckBox*)ui->viewTree->itemWidget(attrItem, COL_CHECKBOX);
			attr_check->setCheckState(state);
		}
	}
	else
	{
		// clicking on child, check state of siblings
		int numChecked = 0;
		int numChilds = sender->parent()->childCount();
		if (numChilds > 0)
		{
			for (int i = 0; i < numChilds; i++)
			{
				QCheckBox* attr_check = (QCheckBox*)ui->viewTree->itemWidget(sender->parent()->child(i), COL_CHECKBOX);
				if (attr_check->checkState() == Qt::Checked)
					numChecked++;
			}

			QCheckBox* view_check = (QCheckBox*)ui->viewTree->itemWidget(sender->parent(), COL_CHECKBOX);

			if (numChecked == numChilds)
				view_check->setCheckState(Qt::Checked);
			else
				view_check->setCheckState(Qt::PartiallyChecked);
		}
	}
}
开发者ID:abroxos,项目名称:DynaMind-ToolBox,代码行数:43,代码来源:guiimport.cpp

示例12: createAdvancedTab

QWidget* EditIndexDialog::createAdvancedTab()
{
    QWidget *advanced = new QWidget(this);

    _sparceCheckBox = new QCheckBox(tr("Sparse"), advanced);
    _sparceCheckBox->setChecked(_info._sparse);
    _backGroundCheckBox = new QCheckBox(tr("Create index in background"), advanced);
    _backGroundCheckBox->setChecked(_info._backGround);

    QHBoxLayout *expireLayout = new QHBoxLayout;
    _expireAfterLineEdit = new QLineEdit(advanced);
    _expireAfterLineEdit->setMaximumWidth(150);
    QRegExp rx("\\d+");
    _expireAfterLineEdit->setValidator(new QRegExpValidator(rx, this));

    QLabel *secLabel = new QLabel(tr("seconds"), advanced);
    expireLayout->addWidget(_expireAfterLineEdit);
    expireLayout->addWidget(secLabel);
    expireLayout->addStretch(1);

    QCheckBox *expireCheckBox = new QCheckBox(tr("Expire after"));
    expireCheckBox->setChecked(false);
    if (_info._ttl >= 0) {
        expireCheckBox->setChecked(true);
        _expireAfterLineEdit->setText(QString("%1").arg(_info._ttl));
    }
    expireStateChanged(expireCheckBox->checkState());
    VERIFY(connect(expireCheckBox, SIGNAL(stateChanged(int)), this, SLOT(expireStateChanged(int))));

    QLabel *sparseHelpLabel = createHelpLabel(
                                  "If set, the index only references documents with the specified field. "
                                  "These indexes use less space but behave differently in some situations (particularly sorts).",
                                  20, -2, 0, 20);

    QLabel *backgroundHelpLabel = createHelpLabel(
                                      "Builds the index in the background so that building an index does not block other database activities.",
                                      20, -2, 0, 20);

    QLabel *expireHelpLabel = createHelpLabel(
                                  "Specifies a <i>time to live</i>, in seconds, to control how long MongoDB retains documents in this collection",
                                  20, -2, 0, 20);

    QGridLayout *layout = new QGridLayout;
    layout->addWidget(_sparceCheckBox,           0, 0, 1, 2);
    layout->addWidget(sparseHelpLabel,           1, 0, 1, 2);
    layout->addWidget(_backGroundCheckBox,       2, 0, 1, 2);
    layout->addWidget(backgroundHelpLabel,       3, 0, 1, 2);
    layout->addWidget(expireCheckBox,            4, 0);
    layout->addLayout(expireLayout,              4, 1);
    layout->addWidget(expireHelpLabel,           5, 0, 1, 2);
    layout->setAlignment(Qt::AlignTop);
    advanced->setLayout(layout);

    return advanced;
}
开发者ID:paralect,项目名称:robomongo,代码行数:55,代码来源:EditIndexDialog.cpp

示例13: flushCache

	void ConfigPage::flushCache()
	{
		// sync the cache with the widgets' state
		// iterate on checkboxes
		for (std::map<QString, WidgetCache<bool> >::iterator it = checkboxCache.begin(); it != checkboxCache.end(); it++)
		{
			QCheckBox* checkbox = dynamic_cast<QCheckBox*>((it->second).widget);
			Q_ASSERT(checkbox);
			(it->second).value = CHECKED_TO_BOOL(checkbox->checkState());
		}
	}
开发者ID:ardiny,项目名称:aseba,代码行数:11,代码来源:ConfigDialog.cpp

示例14: GetValue

	QVariant ItemHandlerCheckbox::GetValue (QObject *object) const
	{
		QCheckBox *checkbox = qobject_cast<QCheckBox*> (object);
		if (!checkbox)
		{
			qWarning () << Q_FUNC_INFO
				<< "not a QCheckBox"
				<< object;
			return QVariant ();
		}
		return checkbox->checkState ();
	}
开发者ID:Apkawa,项目名称:leechcraft,代码行数:12,代码来源:itemhandlercheckbox.cpp

示例15: sender

void 
Application::actuallyQuit()
{
    QDialog* d = qobject_cast<QDialog*>( sender());
    if( d ) {
        QCheckBox* dontAskCB = d->findChild<QCheckBox*>();
        if( dontAskCB ) {
            unicorn::AppSettings().setValue( "quitDontAsk", ( dontAskCB->checkState() == Qt::Checked ));
        }
    }
    QCoreApplication::quit();
}
开发者ID:Erkan-Yilmaz,项目名称:lastfm-desktop,代码行数:12,代码来源:Application.cpp


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