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


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

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


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

示例1: getSelectedTypes

void VegetationWidget::getSelectedTypes(std::vector<std::string>& returnTypeList)
{
	returnTypeList.clear();
	QWidget* curWidget = _tabWidget->currentWidget();
	if (curWidget == _treeListView)
	{
		QStandardItemModel* model = qobject_cast<QStandardItemModel*>(_treeListView->model());
		for (int j = 0; j < model->rowCount(); ++j)
		{
			QStandardItem* item = model->item(j);
			if (item->checkState() == Qt::Checked)
			{
				returnTypeList.push_back(chineseTextToUTF8String(item->text()));
			}
		}
	}
	else
	{
		QStandardItemModel* model = qobject_cast<QStandardItemModel*>(_grassListView->model());
		for (int j = 0; j < model->rowCount(); ++j)
		{
			QStandardItem* item = model->item(j);
			if (item->checkState() == Qt::Checked)
			{
				returnTypeList.push_back(chineseTextToUTF8String(item->text()));
			}
		}
	}
}
开发者ID:FreeDegree,项目名称:Zhang,代码行数:29,代码来源:PlantBrushDockWidget.cpp

示例2: clone

void tst_QStandardItem::clone()
{
    QStandardItem item;
    item.setText(QLatin1String("text"));
    item.setToolTip(QLatin1String("toolTip"));
    item.setStatusTip(QLatin1String("statusTip"));
    item.setWhatsThis(QLatin1String("whatsThis"));
    item.setSizeHint(QSize(64, 48));
    item.setFont(QFont());
    item.setTextAlignment(Qt::AlignLeft|Qt::AlignVCenter);
    item.setBackground(QColor(Qt::blue));
    item.setForeground(QColor(Qt::green));
    item.setCheckState(Qt::PartiallyChecked);
    item.setAccessibleText(QLatin1String("accessibleText"));
    item.setAccessibleDescription(QLatin1String("accessibleDescription"));
    item.setFlags(Qt::ItemIsEnabled | Qt::ItemIsDropEnabled);

    QStandardItem *clone = item.clone();
    QCOMPARE(clone->text(), item.text());
    QCOMPARE(clone->toolTip(), item.toolTip());
    QCOMPARE(clone->statusTip(), item.statusTip());
    QCOMPARE(clone->whatsThis(), item.whatsThis());
    QCOMPARE(clone->sizeHint(), item.sizeHint());
    QCOMPARE(clone->font(), item.font());
    QCOMPARE(clone->textAlignment(), item.textAlignment());
    QCOMPARE(clone->background(), item.background());
    QCOMPARE(clone->foreground(), item.foreground());
    QCOMPARE(clone->checkState(), item.checkState());
    QCOMPARE(clone->accessibleText(), item.accessibleText());
    QCOMPARE(clone->accessibleDescription(), item.accessibleDescription());
    QCOMPARE(clone->flags(), item.flags());
    QVERIFY(!(*clone < item));
    delete clone;
}
开发者ID:maxxant,项目名称:qt,代码行数:34,代码来源:tst_qstandarditem.cpp

示例3: onClicked

void FilterLvl::onClicked (QModelIndex idx)
{
	if (!idx.isValid()) return;
	QStandardItem * item = m_model->itemFromIndex(idx);
	Q_ASSERT(item);

	if (idx.column() == 1)
	{
		QString const & filter_item = m_model->data(m_model->index(idx.row(), 0, QModelIndex()), Qt::DisplayRole).toString();
		QString const & mod = m_model->data(idx, Qt::DisplayRole).toString();

		E_LevelMode const curr = stringToLvlMod(mod.toStdString().c_str()[0]);
		size_t const i = (curr + 1) % e_max_lvlmod_enum_value;
		E_LevelMode const new_mode = static_cast<E_LevelMode>(i);
		m_model->setData(idx, QString(lvlModToString(new_mode)));

		bool const checked = (item->checkState() == Qt::Checked);
		setMode(filter_item, !checked, new_mode);

		emitFilterChangedSignal();
	}
	else
	{
		QString const & filter_item = m_model->data(idx, Qt::DisplayRole).toString();
		bool const orig_checked = (item->checkState() == Qt::Checked);
		if (orig_checked)
			append(filter_item);
		else
			remove(filter_item);

		emitFilterChangedSignal();
	}
}
开发者ID:BackupTheBerlios,项目名称:flogging,代码行数:33,代码来源:filter_lvl.cpp

示例4: saveWaveInfo

void PreferencesDialog::saveWaveInfo()
{
    // Change focus to force save of any open editors..
    ui->waveSearch->setFocus();

    int toprows = waveModel->rowCount();

    bool ok;
    for (int i=0; i < toprows; i++) {
        QStandardItem * topitem = waveModel->item(i,0);

        if (!topitem) continue;
        int rows = topitem->rowCount();
        for (int j=0; j< rows; ++j) {
            QStandardItem * item = topitem->child(j, 0);
            if (!item) continue;

            ChannelID id = item->data(Qt::UserRole).toUInt(&ok);
            schema::Channel & chan = schema::channel[id];
            if (chan.isNull()) continue;
            chan.setEnabled(item->checkState() == Qt::Checked ? true : false);
            chan.setFullname(item->text());
            chan.setDefaultColor(QColor(topitem->child(j,1)->data(Qt::UserRole).toUInt()));
            chan.setShowInOverview(topitem->child(j,2)->checkState() == Qt::Checked);
            chan.setLowerThreshold(topitem->child(j,3)->text().toDouble());
            chan.setUpperThreshold(topitem->child(j,4)->text().toDouble());
            chan.setLabel(topitem->child(j,5)->text());
            chan.setDescription(topitem->child(j,6)->text());
        }
    }
}
开发者ID:frohoff,项目名称:sleepyhead,代码行数:31,代码来源:preferencesdialog.cpp

示例5: setData

bool FilterModel::setData(const QModelIndex & index, 
        const QVariant& value, int role)
{
    bool res = QStandardItemModel::setData(index, value, role);

    if (role == Qt::CheckStateRole)
    {
        if (!index.parent().isValid())
        {
            QStandardItem * item = itemFromIndex(index);
            Qt::CheckState st = item->checkState(); 

            if (st != Qt::PartiallyChecked)
            {
                for (int i = 0; i < item->rowCount(); i++) 
                {
                    item->child(i)->setCheckState(st);
                }
            }
        }

        emit filterChanged();
    }

    return res;
}
开发者ID:cetium,项目名称:corbasim,代码行数:26,代码来源:FilterModel.cpp

示例6: onItemClicked

void PluginChoooserWidget::onItemClicked(QModelIndex index)
{
	QStandardItem *item = m_model->itemFromIndex(index);
	if (item) {
		item->setCheckState(item->checkState() == Qt::Unchecked ? Qt::Checked : Qt::Unchecked);
	}
}
开发者ID:AlexeyProkhin,项目名称:qutim,代码行数:7,代码来源:pluginchooserwidget.cpp

示例7: deleteTracking

void CSatelliteDlg::on_pushButton_5_clicked()
{
  QStandardItemModel *model = (QStandardItemModel *)ui->listView->model();

  for (int i = 0; i < model->rowCount(); i++)
  {
    QStandardItem *item = model->item(i);

    sgp4.tleItem(i)->used = item->checkState() ==  Qt::Checked ? true : false;
  }

  if (sgp4.count() != 0)
  {
    if (msgBoxQuest(this, m_cSaveQuest) == QMessageBox::Yes)
    {
      if (!save(curSatelliteCatName))
      {
        return;
      }
    }
  }

  deleteTracking(MO_SATELLITE);
  releaseHoldObject(MO_SATELLITE);
  pcMainWnd->removeQuickInfo(MO_SATELLITE);

  curSatelliteCatName.clear();
  sgp4.removeAll();
  fillList();
}
开发者ID:GPUWorks,项目名称:skytechx,代码行数:30,代码来源:csatellitedlg.cpp

示例8: configAccepted

void Hdd::configAccepted()
{
    KConfigGroup cg = config();
    KConfigGroup cgGlobal = globalConfig();
    QStandardItem *parentItem = m_hddModel.invisibleRootItem();

    clear();

    for (int i = 0; i < parentItem->rowCount(); ++i) {
        QStandardItem *item = parentItem->child(i, 0);
        if (item) {
            QStandardItem *child = parentItem->child(i, 1);
            if (child->text() != child->data().toString()) {
                cgGlobal.writeEntry(item->data().toString(), child->text());
            }
            if (item->checkState() == Qt::Checked) {
                appendSource(item->data().toString());
            }
        }
    }
    cg.writeEntry("uuids", sources());

    uint interval = ui.intervalSpinBox->value();
    cg.writeEntry("interval", interval);

    emit configNeedsSaving();
}
开发者ID:mgottschlag,项目名称:kwin-tiling,代码行数:27,代码来源:hdd.cpp

示例9: apply

void NotifyOptionsWidget::apply()
{
	Options::node(OPV_NOTIFICATIONS_POPUPTIMEOUT).setValue(ui.spbPopupTimeout->value());

	for(QMap<QString, QStandardItem *>::const_iterator it=FTypeItems.constBegin(); it!=FTypeItems.constEnd(); ++it)
	{
		QStandardItem *typeNameItem = it.value();
		ushort kinds = !it.key().isEmpty() ? FNotifications->typeNotificationKinds(it.key()) : 0;
		for (int row=0; row<typeNameItem->rowCount(); row++)
		{
			QStandardItem *kindEnableItem = typeNameItem->child(row, COL_ENABLE);
			if (kindEnableItem->checkState() == Qt::Checked)
				kinds |= (ushort)kindEnableItem->data(MDR_KIND).toInt();
			else
				kinds &= ~((ushort)kindEnableItem->data(MDR_KIND).toInt());
		}

		if (!it.key().isEmpty())
			FNotifications->setTypeNotificationKinds(it.key(),kinds);
		else
			FNotifications->setEnabledNotificationKinds(kinds);
	}

	emit childApply();
}
开发者ID:sanchay160887,项目名称:vacuum-im,代码行数:25,代码来源:notifyoptionswidget.cpp

示例10: tree_clicked

void QToDoContent::tree_clicked(const QModelIndex &index)
{
    int r = index.row();
    QStandardItem *item = m_model->item(r,1);
    QStandardItem *item2 = m_model->item(r,0);

    QString data = QToDoData::ref().getData("127.0.0.1","fasp_yz","postgres","postgres");
    qDebug()<<data;
    m_edit->setText(data);
    if ( item->checkState() == Qt::Checked )
    {
        qDebug()<<"Checked:";
        QString data = m_model->data( m_model->index(r,0)).toString();
        if ( m_type == ToDo )
        {
            QToDoData::ref().getToDo().removeAll(data);
        }
        qDebug()<<data;
        m_taskList.append(data);
        m_taskList.removeDuplicates();

    }else
    {
        qDebug()<<"UnChecked";
    }
}
开发者ID:xiaojianwu,项目名称:QtDeskTop,代码行数:26,代码来源:qtodocontent.cpp

示例11: OnDataChanged

//-----------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------
void tCZoneModesModel::OnDataChanged()
{
    bool modeChanged = false;

    for ( int row=0; row < rowCount(); ++row )
    {
        QStandardItem* pItem = item( row );
    
        if (pItem != 0)
        {
            bool ok;
            int index = pItem->data( INDEX_ROLE ).toInt( &ok );
            if ( ok )
            {
                tDigitalData state( tDataId( DATA_TYPE_SWITCH_STATE, index, DATA_ENGINE_CZONE_SELECTION ) );
                Qt::CheckState checkState = Qt::Unchecked;
                if ( state.Value() > 0 )
                {
                    checkState = Qt::Checked;
                }
                Qt::CheckState oldCheckState = pItem->checkState();
                pItem->setCheckState( checkState );
                if ( oldCheckState != checkState )
                {
                    modeChanged = true;
                }
            }
        }
    }

    if ( modeChanged )
    {
         emit ModeChanged();
    }
}
开发者ID:dulton,项目名称:53_hero,代码行数:38,代码来源:tCZoneModesModel.cpp

示例12: onOK

void QgsOSMExportDialog::onOK()
{
  if ( !openDatabase() )
    return;

  QgsOSMDatabase::ExportType type;
  if ( radPoints->isChecked() )
    type = QgsOSMDatabase::Point;
  else if ( radPolylines->isChecked() )
    type = QgsOSMDatabase::Polyline;
  else
    type = QgsOSMDatabase::Polygon;

  buttonBox->setEnabled( false );
  QApplication::setOverrideCursor( Qt::WaitCursor );

  QStringList tagKeys;
  QStringList notNullTagKeys;

  for ( int i = 0; i < mTagsModel->rowCount(); ++i )
  {
    QStandardItem* item = mTagsModel->item( i, 0 );
    if ( item->checkState() == Qt::Checked )
      tagKeys << item->text();

    QStandardItem* item2 = mTagsModel->item( i, 2 );
    if ( item2->checkState() == Qt::Checked )
      notNullTagKeys << item->text();
  }

  bool res = mDatabase->exportSpatiaLite( type, editLayerName->text(), tagKeys, notNullTagKeys );

  // load the layer into canvas if that was requested
  if ( chkLoadWhenFinished->isChecked() )
  {
    QgsDataSourceUri uri;
    uri.setDatabase( editDbFileName->text() );
    uri.setDataSource( QString(), editLayerName->text(), "geometry" );
    QgsVectorLayer* vlayer = new QgsVectorLayer( uri.uri(), editLayerName->text(), "spatialite" );
    if ( vlayer->isValid() )
      QgsMapLayerRegistry::instance()->addMapLayer( vlayer );
  }

  QApplication::restoreOverrideCursor();
  buttonBox->setEnabled( true );

  if ( res )
  {
    QMessageBox::information( this, tr( "OpenStreetMap export" ), tr( "Export has been successful." ) );
  }
  else
  {
    QMessageBox::critical( this, tr( "OpenStreetMap export" ), tr( "Failed to export OSM data:\n%1" ).arg( mDatabase->errorString() ) );
  }

  mDatabase->close();
}
开发者ID:NyakudyaA,项目名称:QGIS,代码行数:57,代码来源:qgsosmexportdialog.cpp

示例13: cameraTree_recursiveCheck

// check QStandardItem and its decendants
void AbstractCameraManager::cameraTree_recursiveCheck(QStandardItem* parent, Qt::CheckState checked) {
    qDebug() << "recursivecheck(" << checked << ") on " << parent->text();
    for(int i=0; i<parent->rowCount(); ++i) {
        QStandardItem* currItem = parent->child(i);
        if(currItem->checkState() != checked)
            currItem->setCheckState(checked);
        else
            cameraTree_recursiveCheck(currItem, checked);
    }
}
开发者ID:Antoinephi,项目名称:Project-Norway,代码行数:11,代码来源:abstractcameramanager.cpp

示例14: onClickedAt

void ColorizerRow::onClickedAt (QModelIndex idx)
{
	QStandardItem * item = m_model->itemFromIndex(idx);
	Q_ASSERT(item);

	QString const & str = m_model->data(idx, Qt::DisplayRole).toString();
	bool const checked = (item->checkState() == Qt::Checked);
	ColorizedRow & ct = findOrCreateColorizedRow(item->text());
	if (checked)
	{
		append(str);
		recompileColorRow(ct);
		updateColorRow(ct);
	}
	else
	{
		recompileColorRow(ct);
		updateColorRow(ct);
		remove(str);
	}

	emitFilterChangedSignal();

/*
		if (!idx.isValid()) return;
		QStandardItemModel * model = static_cast<QStandardItemModel *>(m_config_ui.ui()->viewColorRow->model());
		QStandardItem * item = model->itemFromIndex(idx);
		Q_ASSERT(item);

		QString const & val = model->data(idx, Qt::DisplayRole).toString();
		bool const checked = (item->checkState() == Qt::Checked);

		// @TODO: if state really changed
		for (int i = 0, ie = m_filter_state.m_colorized_texts.size(); i < ie; ++i)
		{
			ColorizedRow & ct = m_filter_state.m_colorized_texts[i];
			if (ct.m_row_str == val)
			{
				if (checked)
				{
					m_filter_state.setColorRowChecked(val, checked);
					recompileColorRow(ct);
					updateColorRow(ct);
				}
				else
				{
					uncolorRow(ct);
					m_filter_state.setColorRowChecked(val, checked);
					recompileColorRow(ct);
				}
				break;
			}
		}
*/
}
开发者ID:BackupTheBerlios,项目名称:flogging,代码行数:55,代码来源:colorizer_row.cpp

示例15:

QList<QSharedPointer<Shader> > ShaderListView::getCheckedShaders(){
    QList<QSharedPointer<Shader> > list;
    for(int i = 0; i < itemModel->rowCount();i++){
        QStandardItem* item = itemModel->item(i);
        if(item->checkState()){
            int key = item->data().value<int>();
            list.append(shaderMap.value(key));
        }
    }
    return list;
}
开发者ID:jgosmann,项目名称:ASL,代码行数:11,代码来源:shaderlistview.cpp


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