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


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

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


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

示例1: updateFilteredElements

void SelectionWindow::updateFilteredElements()
      {
      if (!_score)
            return;
      int filter = _score->selectionFilter().filtered();
      bool all = true;
      bool none = true;
      _listWidget->blockSignals(true);
      for(int row = 1; row < _listWidget->count(); row++) {
            QListWidgetItem *item = _listWidget->item(row);
            if (filter & 1 << (row - 1)) {
                  if (item->checkState() != Qt::Checked)
                        item->setCheckState(Qt::Checked);
                  none = false;
                  }
            else {
                  if (item->checkState() != Qt::Unchecked)
                        item->setCheckState(Qt::Unchecked);
                  all = false;
                  }
            }
      QListWidgetItem *item = _listWidget->item(0);
      Qt::CheckState state = all ? Qt::Checked : (none ? Qt::Unchecked : Qt::PartiallyChecked);
      if (item->checkState() != state)
            item->setCheckState(state);
      _listWidget->blockSignals(false);
      }
开发者ID:Fyrult,项目名称:MuseScore,代码行数:27,代码来源:selectionwindow.cpp

示例2: GetCheckedState

StatePropertyGridWidget::eCheckedState StatePropertyGridWidget::GetCheckedState()
{
	eCheckedState state = STATE_PARTIALLY_CHECKED;

	bool everyItemUnchecked = true;
	bool everyItemChecked = true;

	for (int32 i = 0; i < ui->stateSelectListWidget->count(); ++i)
	{
		QListWidgetItem* item = ui->stateSelectListWidget->item(i);

		everyItemChecked &= (item->checkState() == Qt::Checked);
		everyItemUnchecked &= (item->checkState() == Qt::Unchecked);
	}

	if (everyItemChecked)
	{
		state = STATE_EVERY_ITEM_CHECKED;
	}
	if (everyItemUnchecked)
	{
		state = STATE_EVERY_ITEM_UNCHECKED;
	}

	return state;
}
开发者ID:droidenko,项目名称:dava.framework,代码行数:26,代码来源:statepropertygridwidget.cpp

示例3: on_buttonBox_accepted

//OK pressed
void UpdateAvailiableDialog::on_buttonBox_accepted()
{
    QListWidgetItem *AppItem = ui->listWidget->item(0);
    QListWidgetItem *UpdateItem = ui->listWidget->item(1);
    //check if any updates are selected
    bool UpdateApp = (!AppItem->isHidden() && AppItem->checkState() == Qt::Checked);
    bool UpdateUpdater = (!UpdateItem->isHidden() && UpdateItem->checkState() == Qt::Checked);

    emit Update(UpdateApp,UpdateUpdater);
}
开发者ID:KasaiDot,项目名称:Ouroboros,代码行数:11,代码来源:updateavailiabledialog.cpp

示例4: listsToXML

//XML
//Converts the given lists and puts them in an XML tree
QString TaskList_Main::listsToXML(const QListWidget &inList){
    QDomDocument doc;
    QDomProcessingInstruction instr = doc.createProcessingInstruction(
                "xml", "version='1.0' encoding='UTF-8'");
    doc.appendChild(instr);

    //Create list to hold individual task lists
    QDomElement listElement = addElement(doc, doc, "listset");

    //Iteratore through available 'lists'
    for(int i = 0; i < inList.count(); ++i){
        QDomElement list = addElement(doc, listElement, "list");
        addElement(doc, list, "list_title", inList.item(i)->text());

        //Find associated note mapping
        my_listwidget *listPtr = notePane->listMap[inList.item(i)];

        //Iterates through 'tasks' in 'list'
        bool nextIsSub = false;
        for(int j = 0; j < listPtr->count(); ++j){
            QDomElement task = addElement(doc, list, "task");
            QListWidgetItem *taskPtr = listPtr->item(j);

            //If next item is subtext...
            if(nextIsSub){
                nextIsSub = false;
                task.setAttribute("task_type", "sub");
                addElement(doc, task, "task_title", taskPtr->text());
                addElement(doc, task, "task_font", taskPtr->font().toString());
            }
            //Else, we know it's main task
            else{
                task.setAttribute("task_type", "main");
                addElement(doc, task, "task_title", taskPtr->text());
                if(taskPtr->checkState() == Qt::Unchecked)
                    addElement(doc, task, "task_check", "unchecked");
                if(taskPtr->checkState() == Qt::Checked)
                    addElement(doc, task, "task_check", "checked");
                if(taskPtr->checkState() == Qt::PartiallyChecked)
                    addElement(doc, task, "task_check", "part_check");
                addElement(doc, task, "task_note", taskPtr->data(32).toString());
                addElement(doc, task, "task_display", taskPtr->data(33).toString());
                addElement(doc, task, "task_date", taskPtr->data(34).toDate().toString(Qt::ISODate));
                addElement(doc, task, "task_font", taskPtr->font().toString());

                if(taskPtr->data(35).toBool() == true){
                    nextIsSub = true;
                }
            }
        }
    }

    //Return DOM document
    return doc.toString();
}
开发者ID:ep3998,项目名称:Tasklist493---Test,代码行数:57,代码来源:tasklist_main.cpp

示例5: add

/*
 * Add highlighted entries into main data store
 */
void UploadImpl::add()
{
    // checked rather than selected seems more intuitive
    //	QList<QListWidgetItem *> items;
    //  items = listWidget->selectedItems();
	
    for (int n=0; n< listWidget->count(); ++n)
    {
        QListWidgetItem* i = listWidget->item(n);

        if ( (i->checkState() == Qt::Checked) &&
             (i->flags() & Qt::ItemIsEnabled) )
        {
            // userrole data contains location exercise list
            unsigned int pos = i->data(Qt::UserRole).toInt();

            //Disable once uploaded
            i->setFlags(0);
            i->setCheckState(Qt::Checked);
            
            // TODO add session ids to remove this date grouping hack.
            QDateTime initial(exdata[pos].date, exdata[pos].time);

            std::vector<ExerciseSet> sets;
            while (pos < exdata.size() &&
                   QDateTime(exdata[pos].date, exdata[pos].time) == initial)
            {
                sets.push_back(exdata[pos++]);
            }
            if (sets.size())
                ds->add(sets);
        }
    }
    close();
}
开发者ID:jerome-labidurie,项目名称:poolviewer,代码行数:38,代码来源:uploadimpl.cpp

示例6: on_btn_ok_clicked

void EditUserDlg::on_btn_ok_clicked()
{
    if( !isNameRight() )
        return;

    m_user.m_strName = ui->edit_name->text();
    m_user.m_strPassword = ui->edit_password->text();
    m_user.m_strDescrip = ui->edit_description->text();
    m_groupNames.clear();

    //需要添加用户组隶属信息
    for(int i=0; i<ui->listWidget->count(); i++)
    {
        QListWidgetItem *item = ui->listWidget->item(i);
        if(item && item->checkState() == Qt::Checked)
        {
            m_groupNames << item->text();
        }
    }

    if(m_groupNames.size() == 0 && iOpenType == 0)
    {
        QMessageBox box(QMessageBox::Warning,tr("警告"),tr("默认用户没有相应的组对应!"),QMessageBox::Ok|QMessageBox::No,this,Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint);
        box.button(QMessageBox::Ok)->setText(tr("确定"));
        box.button(QMessageBox::No)->setText(tr("取消"));
        box.exec();
        if(box.clickedButton()== box.button(QMessageBox::No))
        {
            return;
        }
    }

    accept();
}
开发者ID:maqiangddb,项目名称:pc_code,代码行数:34,代码来源:edituserdlg.cpp

示例7: on_exportButton_clicked

void StatWidget::on_exportButton_clicked()
{
	QString filepath = ui.dirLineEdit->text() + "/" + ui.fileNameLineEdit->text();
	QFile file(filepath);
	file.open(QFile::WriteOnly);
	QTextStream out(&file);
	//	QTableWidgetItem *item;

	for (int headnum = 0; headnum < tableHeader.size(); headnum++ ) {
		out << tableHeader.at(headnum) << "\t";
	}
	out << "\n";	
	QListWidgetItem *item;
	int row = 0;
	for (int i = 0; i < ui.listWidget->count(); i++) {
		item = ui.listWidget->item(i);
		if (item->checkState() == Qt::Checked) {
			row++;
		}
	}

	int  column = ui.tableWidget->columnCount();

	for (int i = 0; i < row; i++) 
	{	
		for(int j = 0; j < column; j++) 
		{
			out<< ui.tableWidget->item(i, j)->text()<<"\t";
		}
		out<<"\n";
	}

	file.close();
	ui.showLabel->setText(tr("导出成功!"));
}
开发者ID:BunnyWei,项目名称:Anthropometric-Data-Analysis-Software,代码行数:35,代码来源:stat_widget.cpp

示例8: do_save_color_ranges

QStringList MainWindow::do_save_color_ranges(QString &base)
{
	QMap<QString, rc_map> jobs;

	const QString& palId = current_pal_name();
	const QList<QRgb>& palData = current_pal_data();

	QStringList needOverwriteFiles;

	for(int k = 0; k < ui->listRanges->count(); ++k) {
		QListWidgetItem* itemw = ui->listRanges->item(k);
		Q_ASSERT(itemw);

		if(itemw->checkState() == Qt::Checked) {
			const QString& rangeId = itemw->data(Qt::UserRole).toString();

			const QString& filePath = base + "/" + QFileInfo(img_path_).completeBaseName() +
					"-RC-" + palId + "-" + QString::number(k + 1) +
					"-" + rangeId + ".png";

			jobs[filePath] = recolor_range(color_ranges_.value(rangeId), palData);

			if(QFileInfo(filePath).exists()) {
				needOverwriteFiles.push_back(filePath);
			}
		}
	}

	if(!needOverwriteFiles.isEmpty() && !confirm_existing_files(needOverwriteFiles)) {
		throw canceled_job();
	}

	return do_run_jobs(jobs);
}
开发者ID:shikadilord,项目名称:morningstar,代码行数:34,代码来源:mainwindow.cpp

示例9: togglePlaneVisibility

void FlightVisualization::togglePlaneVisibility(QListWidgetItem * item)
{
    if (item->text().startsWith(ALL_PLANES_LABEL)) {
        for (int index = 0; index < popupPlaneSelector->count(); index++) {
            QListWidgetItem * newItem = popupPlaneSelector->item(index);
            newItem->setCheckState(item->checkState());
            int planeIndex = newItem->text().remove(DISP_PLANE_PREFIX).toInt();
            QString visible = "false";

            if (newItem->checkState() > 0) {
                visible = "true";
            }

            QString function = QString("togglePlaneVisibility(%1, %2)").arg(
                                   planeIndex).arg(visible);

            ui->webView->page()->currentFrame()->documentElement().evaluateJavaScript(
                function);
        }
    } else {
        int planeIndex = item->text().remove(DISP_PLANE_PREFIX).toInt();
        QString visible = "false";

        if (item->checkState() > 0) {
            visible = "true";
        }

        QString function = QString("togglePlaneVisibility(%1, %2)").arg(
                               planeIndex).arg(visible);

        ui->webView->page()->currentFrame()->documentElement().evaluateJavaScript(
            function);
    }
}
开发者ID:CptMacHammer,项目名称:au_uav_pkg,代码行数:34,代码来源:flightvisualization.cpp

示例10: on_buttonBox_accepted

void repair::on_buttonBox_accepted()
{
    QListWidgetItem *item = _listinstalled->currentItem();

    if (_listinstalled->count() && item)
    {   //Some OSes are selected

        for(int row = 0; row < ui->listWidget->count(); row++)
        {
            QListWidgetItem * actionitem = ui->listWidget->item(row);
            if (actionitem->checkState() == Qt::Checked)
            {
                QVariantMap m = actionitem->data(Qt::UserRole).toMap();

                if (m["action"] == "fscheck")
                {
                    fscheck dlg(_listinstalled);
                    dlg.exec();
                }
                if (m["action"] == "setup")
                {
                   rerunsetup dlg(_listinstalled,_mw,_drive);
                   dlg.exec();
                }
                if (m["action"] == "upgrade")
                {
                    /*xxx dlg(_listinstalled);
                    dlg.exec();*/
                }
            }
        }
    }
}
开发者ID:procount,项目名称:pinn,代码行数:33,代码来源:repair.cpp

示例11:

bool
user_edit_dialog::update_granted_roles(user& u, db_ctxt* dbc)
{
  // Re-read the roles from database, compare to our list and
  // run GRANT or REVOKE accordingly
  bool ok=true;
  QList<QString> assigned_roles = user::granted_roles(m_role_oid);
  const QString username = u.m_login;

  for (int i=0; i<m_qlist_roles->count(); i++) {
    QListWidgetItem* item = m_qlist_roles->item(i);
    if (item->checkState()==Qt::Checked) {
      if (assigned_roles.indexOf(item->text()) < 0) {
	// checked but not granted => grant it
	ok=user::grant_role(username, item->text(), dbc);
	if (!ok) break;
	assigned_roles.append(item->text());
      }
    }
    else {
      if (assigned_roles.indexOf(item->text()) >= 0) {
	// not checked but granted => revoke it
	ok = user::revoke_role(username, item->text(), dbc);
	if (!ok) break;
      }
    }
  }

  return ok;
}
开发者ID:manitou-mail,项目名称:manitou-mail-ui,代码行数:30,代码来源:users_dialog.cpp

示例12: actionBreakpoints

void SkDebuggerGUI::actionBreakpoints() {
    fBreakpointsActivated = !fBreakpointsActivated;
    for (int row = 0; row < fListWidget.count(); row++) {
        QListWidgetItem *item = fListWidget.item(row);
        item->setHidden(item->checkState() == Qt::Unchecked && fBreakpointsActivated);
    }
}
开发者ID:Jimmy0319,项目名称:skia,代码行数:7,代码来源:SkDebuggerGUI.cpp

示例13: getData

void PrefAssociations::getData(Preferences *)
{
	qDebug("PrefAssociations::getData: something_changed: %d", something_changed);
	if (!something_changed) return;
	
	QStringList extensions; 

	for (int k = 0; k < listWidget->count(); k++)
	{
		QListWidgetItem* pItem = listWidget->item(k); 
		if (pItem && pItem->checkState() == Qt::Checked)
			extensions.append(pItem->text()); 
	}

	int processed = ProcessAssociations(extensions, m_regExtensions); 

	if (processed != extensions.count())
	{
		QMessageBox::warning(this, tr("Warning"), 
            tr("Not all files could be associated. Please check your "
               "security permissions and retry."), QMessageBox::Ok);
	}
	
	refreshList(); //Useless when OK is pressed... How to detect if apply or ok is pressed ?

	something_changed = false;
}
开发者ID:corossig,项目名称:smplayer-mpv,代码行数:27,代码来源:prefassociations.cpp

示例14: save

void PluginsManager::save()
{
    if (!m_loaded) {
        return;
    }

    QStringList allowedPlugins;
    for (int i = 0; i < ui->list->count(); i++) {
        QListWidgetItem* item = ui->list->item(i);

        if (item->checkState() == Qt::Checked) {
            const Plugins::Plugin plugin = item->data(Qt::UserRole + 10).value<Plugins::Plugin>();

            // Save plugins with relative path in portable mode
            if (mApp->isPortable())
                allowedPlugins.append(plugin.fileName);
            else
                allowedPlugins.append(plugin.fullPath);
        }
    }

    Settings settings;
    settings.beginGroup("Plugin-Settings");
    settings.setValue("EnablePlugins", ui->allowAppPlugins->isChecked());
    settings.setValue("AllowedPlugins", allowedPlugins);
    settings.endGroup();
}
开发者ID:Acidburn0zzz,项目名称:qupzilla,代码行数:27,代码来源:pluginsmanager.cpp

示例15: putToCache

/* Save data from corresponding widgets to cache,
 * this task SHOULD be performed in GUI thread only: */
void UIMachineSettingsSystem::putToCache()
{
    /* Prepare system data: */
    UIDataSettingsMachineSystem systemData = m_cache.base();

    /* Gather system data: */
    systemData.m_bootItems.clear();
    for (int i = 0; i < mTwBootOrder->count(); ++i)
    {
        QListWidgetItem *pItem = mTwBootOrder->item(i);
        UIBootItemData data;
        data.m_type = static_cast<UIBootTableItem*>(pItem)->type();
        data.m_fEnabled = pItem->checkState() == Qt::Checked;
        systemData.m_bootItems << data;
    }
    systemData.m_fIoApicEnabled = mCbApic->isChecked() || mSlCPU->value() > 1 ||
                                  (KChipsetType)mCbChipset->itemData(mCbChipset->currentIndex()).toInt() == KChipsetType_ICH9;
    systemData.m_fEFIEnabled = mCbEFI->isChecked();
    systemData.m_fUTCEnabled = mCbTCUseUTC->isChecked();
    systemData.m_fUseAbsHID = mCbUseAbsHID->isChecked();
    systemData.m_fPAEEnabled = mCbPae->isChecked();
    systemData.m_fHwVirtExEnabled = mCbVirt->checkState() == Qt::Checked || mSlCPU->value() > 1;
    systemData.m_fNestedPagingEnabled = mCbNestedPaging->isChecked();
    systemData.m_iRAMSize = mSlMemory->value();
    systemData.m_cCPUCount = mSlCPU->value();
    systemData.m_cCPUExecCap = mSlCPUExecCap->value();
    systemData.m_chipsetType = (KChipsetType)mCbChipset->itemData(mCbChipset->currentIndex()).toInt();

    /* Cache system data: */
    m_cache.cacheCurrentData(systemData);
}
开发者ID:greg100795,项目名称:virtualbox,代码行数:33,代码来源:UIMachineSettingsSystem.cpp


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