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


C++ QTreeWidgetItem::setCheckState方法代码示例

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


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

示例1: fillOutputTree

void ConfigureArtNet::fillOutputTree()
{
    m_outputTree->header()->setResizeMode(QHeaderView::ResizeToContents);

    QList<QNetworkAddressEntry> ifaces = m_plugin->interfaces();
    QList<ArtNetIO> IOmap = m_plugin->getIOMapping();

    foreach (QNetworkAddressEntry entry, ifaces)
    {
        QString ifaceStr = entry.ip().toString();
        for (int u = 0; u < UNIVERSES_PER_ADDRESS; u++)
        {
            QTreeWidgetItem* pitem = new QTreeWidgetItem(m_outputTree);
            pitem->setFlags(pitem->flags() | Qt::ItemIsUserCheckable);
            pitem->setCheckState(KOutputColumnNetwork, Qt::Unchecked);
            for (int idx = 0; idx < IOmap.length(); idx++)
            {
                if (IOmap.at(idx).IPAddress == ifaceStr && IOmap.at(idx).port == u)
                {
                    pitem->setCheckState(KOutputColumnNetwork, Qt::Checked);
                    break;
                }
            }
            pitem->setText(KOutputColumnNetwork, ifaceStr);
            pitem->setText(KOutputColumnUniverse, tr("Universe %1").arg(u));
            pitem->setData(KOutputColumnUniverse, Qt::UserRole, u);
        }
    }
开发者ID:JanetPeck,项目名称:qlcplus,代码行数:28,代码来源:configureartnet.cpp

示例2: foreach

    foreach(sqlb::FieldPtr f, fields)
    {
        QTreeWidgetItem *tbitem = new QTreeWidgetItem(ui->treeWidget);
        tbitem->setFlags(tbitem->flags() | Qt::ItemIsEditable);
        tbitem->setText(kName, f->name());
        QComboBox* typeBox = new QComboBox(ui->treeWidget);
        typeBox->setProperty("column", f->name());
        typeBox->setEditable(false);
        typeBox->addItems(sqlb::Field::Datatypes);
        int index = typeBox->findText(f->type(), Qt::MatchExactly);
        if(index == -1)
        {
            // non standard named type
            typeBox->addItem(f->type());
            index = typeBox->count() - 1;
        }
        typeBox->setCurrentIndex(index);
        connect(typeBox, SIGNAL(currentIndexChanged(int)), this, SLOT(updateTypes()));
        ui->treeWidget->setItemWidget(tbitem, kType, typeBox);

        tbitem->setCheckState(kNotNull, f->notnull() ? Qt::Checked : Qt::Unchecked);
        tbitem->setCheckState(kPrimaryKey, f->primaryKey() ? Qt::Checked : Qt::Unchecked);
        tbitem->setCheckState(kAutoIncrement, f->autoIncrement() ? Qt::Checked : Qt::Unchecked);
        tbitem->setCheckState(kUnique, f->unique() ? Qt::Checked : Qt::Unchecked);
        tbitem->setText(kDefault, f->defaultValue());
        tbitem->setText(kCheck, f->check());
        ui->treeWidget->addTopLevelItem(tbitem);
    }
开发者ID:zxjqazwsx,项目名称:sqlitebrowser,代码行数:28,代码来源:EditTableDialog.cpp

示例3: updateParentItem

//向上递归判断
void XMLInfoDialog::updateParentItem(QTreeWidgetItem *item)
{
    QTreeWidgetItem* parent = item->parent();
    if (parent == NULL)
        return;

    //选中的子节点个数
    int selectedCount = 0;
    int childCount = parent->childCount();
    for (int i = 0; i < childCount; i++)
    {
        QTreeWidgetItem* childItem = parent->child(i);
        if (childItem->checkState(0) == Qt::Checked)
            selectedCount++;
    }

    if (selectedCount <= 0)
    {
        parent->setCheckState(0, Qt::Unchecked);//全没选状态
    }
    else if (selectedCount > 0 && selectedCount < childCount)
    {
        parent->setCheckState(0, Qt::PartiallyChecked);//设置为部分选中状态
        updateParentItem(parent);
    }
    else if (selectedCount == childCount)
    {
        parent->setCheckState(0, Qt::Checked);//全选中状态
    }
}
开发者ID:oduiwei,项目名称:RSStalk,代码行数:31,代码来源:xmlinfodialog.cpp

示例4: addFixtureItem

void EFXEditor::addFixtureItem(EFXFixture* ef)
{
    QTreeWidgetItem* item;
    Fixture* fxi;

    Q_ASSERT(ef != NULL);

    fxi = m_doc->fixture(ef->fixture());
    if (fxi == NULL)
        return;

    item = new QTreeWidgetItem(m_tree);
    item->setText(KColumnName, fxi->name());
    item->setData(0, Qt::UserRole, QVariant(reinterpret_cast<qulonglong> (ef)));
    item->setFlags(item->flags() | Qt::ItemIsUserCheckable);

    if (ef->direction() == Function::Backward)
        item->setCheckState(KColumnReverse, Qt::Checked);
    else
        item->setCheckState(KColumnReverse, Qt::Unchecked);

    updateIntensityColumn(item, ef);
    updateStartOffsetColumn(item, ef);

    updateIndices(m_tree->indexOfTopLevelItem(item),
                  m_tree->topLevelItemCount() - 1);

    /* Select newly-added fixtures so that they can be moved quickly */
    m_tree->setCurrentItem(item);
    redrawPreview();
}
开发者ID:Unknownly,项目名称:qlcplus,代码行数:31,代码来源:efxeditor.cpp

示例5: if

void
UserSelectView::slotItemChanged(QTreeWidgetItem* item, int column)
{
        if (this->indexOfTopLevelItem(item) != -1)
        {
                int cnt = item->childCount();
                if (item->checkState(0) == Qt::Checked)
                {
                        for (int i = 0; i < cnt; i++)
                        {
                                QTreeWidgetItem* chld = item->child(i);
                                chld->setCheckState(0, Qt::Checked);
                        }
                }
                else if (item->checkState(0) == Qt::Unchecked)
                {
                        for (int i = 0; i < cnt; i++)
                        {
                                QTreeWidgetItem* chld = item->child(i);
                                chld->setCheckState(0, Qt::Unchecked);
                        }
                }
        }
        else
        {
                QTreeWidgetItem* p = item->parent();
                p->setCheckState(0, Qt::PartiallyChecked);
        }
}
开发者ID:mahdiattarbashi,项目名称:lulum,代码行数:29,代码来源:UserSelectView.cpp

示例6: recursiveInsert

void SelectiveSyncTreeView::recursiveInsert(QTreeWidgetItem* parent, QStringList pathTrail, QString path)
{
    QFileIconProvider prov;
    QIcon folderIcon = prov.icon(QFileIconProvider::Folder);
    if (pathTrail.size() == 0) {
        if (path.endsWith('/')) {
            path.chop(1);
        }
        parent->setToolTip(0, path);
        parent->setData(0, Qt::UserRole, path);
    } else {
        QTreeWidgetItem *item = findFirstChild(parent, pathTrail.first());
        if (!item) {
            item = new QTreeWidgetItem(parent);
            if (parent->checkState(0) == Qt::Checked
                    || parent->checkState(0) == Qt::PartiallyChecked) {
                item->setCheckState(0, Qt::Checked);
                foreach(const QString &str , _oldBlackList) {
                    if (str == path) {
                        item->setCheckState(0, Qt::Unchecked);
                        break;
                    } else if (str.startsWith(path)) {
                        item->setCheckState(0, Qt::PartiallyChecked);
                    }
                }
            } else if (parent->checkState(0) == Qt::Unchecked) {
开发者ID:crioux,项目名称:mirall,代码行数:26,代码来源:selectivesyncdialog.cpp

示例7: addItem

void DataSelectionScreen::addItem(QString name)
{
    if (name.contains(":"))
    {
        QString sysid = name.mid(0,name.indexOf(":"));
        name = name.mid(name.indexOf(":")+1);
        m_nameToSysId[name] = sysid;
    }
    if (name.contains("."))
    {
        //It's a split name, "GCS Status.Roll" for instance.
        QString shortname = name.split(".")[1];
        QString groupname = name.split(".")[0];
        QList<QTreeWidgetItem*> findlist = ui.treeWidget->findItems(groupname,Qt::MatchContains);
        if (findlist.size() > 0)
        {
            QTreeWidgetItem *child = new QTreeWidgetItem(QStringList() << shortname);
            child->setFlags(child->flags() | Qt::ItemIsUserCheckable);
            child->setCheckState(0,Qt::Unchecked);
            findlist[0]->addChild(child);

        }
        else
        {
            QTreeWidgetItem *item = new QTreeWidgetItem(QStringList() << groupname);
            ui.treeWidget->addTopLevelItem(item);
            QTreeWidgetItem *child = new QTreeWidgetItem(QStringList() << shortname);
            child->setFlags(child->flags() | Qt::ItemIsUserCheckable);
            child->setCheckState(0,Qt::Unchecked);
            item->addChild(child);
        }
    }
    ui.treeWidget->sortByColumn(0,Qt::AscendingOrder);
}
开发者ID:mshurtliff,项目名称:apm_planner,代码行数:34,代码来源:dataselectionscreen.cpp

示例8: recieveData

// Получение данных из главного окна
// и заполнение виджетов новой информацией
void serverEdit::recieveData(favServer server, QList<addon> addonsList, bool newServer, QStringList names) {

    qInfo() << "serverEdit::recieveData: start";

    newServ = newServer;
    // Настройка сервера
    //..при добавлении
    if(newServer) {
        // Установка параметров сервера
        ui->serverName->setText(tr("Новый сервер"));
        if(server.serverIP == "...")
            ui->serverIP->clear();
        else
            ui->serverIP->setText(server.serverIP);
        ui->serverPort->setText(server.serverPort);
        ui->serverPassword->setText(server.serverPass);
        ui->name_check->setChecked(false);
    // При зименении
    } else {
        // Установка параметров сервера
        ui->serverName->setText(server.serverName);
        ui->serverIP->setText(server.serverIP);
        ui->serverPort->setText(server.serverPort);
        ui->serverPassword->setText(server.serverPass);
        ui->name_check->setChecked(server.check_name);
    }

    // Заполнение списка аддонов
    ui->addonTree->clear();
    QTreeWidgetItem * item;
    for(int i=0; i<addonsList.count();i++) {
        // Добавление элемента
        item = new QTreeWidgetItem(ui->addonTree);
        item->setText(0, addonsList[i].addonName);
        item->setText(1, addonsList[i].addonDir);
        item->setText(2, addonsList[i].addonPath);
        item->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsSelectable);
        // Проверка, активен ли этот аддон на сервере
        QString fullPath = addonsList[i].addonPath + QString("/") +
                addonsList[i].addonDir;
        if(server.serverAddons.count()>0) {
            // Если содержит, то активируем
            if(server.serverAddons.contains(fullPath))
                item->setCheckState(0, Qt::Checked);
            else // Иначе. деактивируем
                item->setCheckState(0, Qt::Unchecked);
        } else { // Если у сервера нет подключенных аддонов, то сразу деактивируем
            item->setCheckState(0, Qt::Unchecked);
        }
    }

    // Выбранный профиль сервера
    ui->name->clear();
    ui->name->addItems(names);
    ui->name->setCurrentText(server.name);

    this->open();
}
开发者ID:Fyzu,项目名称:ArmALauncher,代码行数:60,代码来源:serveredit.cpp

示例9: PrefWidget

SoundPref::SoundPref(QWidget *parent)
	: PrefWidget(parent)
{
	ui.setupUi(this);

	AmeDirs *ame = AmeDirs::global();
	stg1 = new AmeSettings(ame->stdDir(AmeDirs::Configs) + "/Sound", QSettings::IniFormat);

	readSettings();

	// Sound effects tab
	ui.soundsLst->setColumnCount(2);
	ui.soundsLst->setColumnWidth(0, 420);

	QStringList hdr;
	hdr << "Name" << "Enabled";
	ui.soundsLst->setHeaderLabels(hdr);
	Sounds lst = AmeSoundTheme::global()->getAll();
	for (int i=0; i<lst.size(); i++) {
		QTreeWidgetItem *it = new QTreeWidgetItem(ui.soundsLst);
		it->setText(0, lst.at(i)->name);
		it->setText(1, "");
		if (lst.at(i)->enabled)
			it->setCheckState(1, Qt::Checked);
		else
			it->setCheckState(1, Qt::Unchecked);
		it->setData(1, Qt::UserRole, QVariant(lst.at(i)->soundId));
	}

	connect(ui.soundsLst, SIGNAL(itemChanged(QTreeWidgetItem*, int)), this, SLOT(onSoundItemChange(QTreeWidgetItem *, int)));
	connect(ui.soundsLst, SIGNAL(itemActivated(QTreeWidgetItem*, int)), this, SLOT(onSoundItem(QTreeWidgetItem *, int)));

	ui.volumeSldr->setMinimum(0);
	ui.volumeSldr->setMaximum(100);
	connect(ui.volumeSldr, SIGNAL(sliderMoved(int)), this, SLOT(onSlider(int)));
	connect(ui.volumeSldr, SIGNAL(sliderReleased()), this, SLOT(onSliderRelease()));

	connect(ui.muteChk, SIGNAL(clicked()), this, SLOT(onMute()));
	connect(ui.sndVolFeedbackChk, SIGNAL(clicked()),this, SLOT(onVolumeFeedback()));
	connect(ui.showCtrlChk, SIGNAL(clicked()), this, SLOT(onShowHideVolumeCtrl()));

	timer = new QTimer();
	connect(timer, SIGNAL(timeout()), this, SLOT(checkVolume()));
	timer->start(100);

	// Output settings tab
	hwList = new hwDevices();
	getHwList(modePlayback);
	getMixerDevices(modePlayback);

	connect(ui.playbackMixerDeviceCmb, SIGNAL(activated(const QString &)), this, SLOT(onMixerDevice(const QString &)));

	refresh();

	moduleName = "Sound";
}
开发者ID:admiral0,项目名称:Antico-Deluxe,代码行数:56,代码来源:soundpref.cpp

示例10: addLocalChannel

void ChannelTreeWidget::addLocalChannel(int ch, const QString &name, bool mute, bool broadcast)
{
  QTreeWidgetItem *local = topLevelItem(0);
  QTreeWidgetItem *channel = addChannelItem(local, name, CF_BROADCAST);

  channel->setData(0, ItemTypeRole, ItemTypeLocalChannel);
  channel->setData(0, ChannelIndexRole, ch);
  channel->setCheckState(1, mute ? Qt::Checked : Qt::Unchecked);
  channel->setCheckState(2, broadcast ? Qt::Checked : Qt::Unchecked);
}
开发者ID:tzhuan,项目名称:wahjam,代码行数:10,代码来源:ChannelTreeWidget.cpp

示例11: QTreeWidgetItem

QTreeWidgetItem *ChannelTreeWidget::addChannelItem(QTreeWidgetItem *parent, const QString &text, int flags)
{
  QTreeWidgetItem *channel = new QTreeWidgetItem(parent);

  channel->setText(0, text);
  channel->setCheckState(1, Qt::Unchecked);
  if (flags & CF_BROADCAST) {
    channel->setCheckState(2, Qt::Unchecked);
  }
  return channel;
}
开发者ID:tzhuan,项目名称:wahjam,代码行数:11,代码来源:ChannelTreeWidget.cpp

示例12: QDialog

ReportFilter::ReportFilter(QVector<QString> objects)
{
	mDialog = new QDialog();
	mVbox = new QVBoxLayout();

	mDialog->setWindowTitle(tr("Report Filter"));

	mLabel = new QLabel("Please select the objects and categories to be presented in report");

	mTreeWidget = new QTreeWidget();
	QStringList ColumnNames;
	ColumnNames << "Object";
	mTreeWidget->setHeaderLabels(ColumnNames);
	mObject = objects;
	for (int i = 0; i < objects.size(); i++)
	{
		QTreeWidgetItem *item = new QTreeWidgetItem();
		item->setText(0, QString(objects[i]));
		item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
		item->setCheckState(0, Qt::Unchecked);
		for (int j = 0; j < 11; j++)
		{
			QTreeWidgetItem *child = new QTreeWidgetItem();
			child->setText(0, QString(num2category(j).c_str()));
			child->setFlags(child->flags() | Qt::ItemIsUserCheckable);
			child->setCheckState(0, Qt::Unchecked);
			item->addChild(child);
		}
		mItems.push_back(item);
	}
	mTreeWidget->insertTopLevelItems(0, mItems);
	connect(mTreeWidget, SIGNAL(itemChanged(QTreeWidgetItem* , int)), this, SLOT(itemChanged(QTreeWidgetItem* , int)));

	mButtonGridBox = new QGridLayout();
	mGenerateButton = new QPushButton("Generate");
	connect(mGenerateButton, SIGNAL(clicked()), this, SLOT(generate()));
	mCancelButton = new QPushButton("Cancel");
	connect(mCancelButton, SIGNAL(clicked()), this, SLOT(cancel()));
	mSelectAllButton = new QPushButton("Select All");
	connect(mSelectAllButton, SIGNAL(clicked()), this, SLOT(selectAll()));
	mButtonGridBox->addWidget(mSelectAllButton, 0, 4, 1, 1,  Qt::AlignVCenter | Qt::AlignLeft);
	mButtonGridBox->addWidget(mGenerateButton, 0, 4, 1, 3,  Qt::AlignVCenter | Qt::AlignRight);
	mButtonGridBox->addWidget(mCancelButton, 0, 4, 1, 4, Qt::AlignVCenter | Qt::AlignRight);
	
	mVbox->addWidget(mLabel);
	mVbox->addWidget(mTreeWidget);
	mVbox->addLayout(mButtonGridBox);
	mDialog->setMinimumWidth(250);
	mDialog->setLayout(mVbox);
	isGenerate = false;
}
开发者ID:WeiqiJust,项目名称:CHER-Ob,代码行数:51,代码来源:reportFilter.cpp

示例13: load

  void ImporterWizard::load(ObjImporter::SceneInfo& si)
  {
    QTreeWidget* t = m_ui->tree;
    t->clear();

    QList<QTreeWidgetItem*> items;
    m_objects = new QTreeWidgetItem(t, QStringList() << "Objects");
    m_models = new QTreeWidgetItem(t, QStringList() << "Models");
    m_animations = new QTreeWidgetItem(t, QStringList() << "Animations");
    m_cameras = new QTreeWidgetItem(t, QStringList() << "Cameras");
    m_lights = new QTreeWidgetItem(t, QStringList() << "Lights");
    m_materials = new QTreeWidgetItem(t, QStringList() << "Materials");
    m_textures = new QTreeWidgetItem(t, QStringList() << "Textures");

    items << m_objects << m_models << m_animations << m_cameras << m_lights << m_materials << m_textures;
    t->addTopLevelItems(items);

    QMap<QString, QString>::const_iterator it;

    for (it = si.objects.begin(); it != si.objects.end(); ++it) {
      newItem(m_objects, it);
      newItem(m_models, it);
    }
    for (it = si.animations.begin(); it != si.animations.end(); ++it) {
      QTreeWidgetItem* x = newItem(m_animations, it);
      x->setCheckState(0, Qt::Unchecked);
      x->setDisabled(true);
    }
    for (it = si.cameras.begin(); it != si.cameras.end(); ++it) {
      QTreeWidgetItem* x = newItem(m_animations, it);
      x->setCheckState(0, Qt::Unchecked);
      x->setDisabled(true);
    }
    for (it = si.lights.begin(); it != si.lights.end(); ++it) {
      QTreeWidgetItem* x = newItem(m_lights, it);
      x->setCheckState(0, Qt::Unchecked);
      x->setDisabled(true);
    }
    for (it = si.materials.begin(); it != si.materials.end(); ++it) {
      newItem(m_materials, it);
    }
    for (it = si.textures.begin(); it != si.textures.end(); ++it) {
      newItem(m_textures, it);
    }

    foreach (QTreeWidgetItem* i, items) {
      i->setFirstColumnSpanned(true);
      i->setExpanded(true);
      if (i->childCount() == 0) i->setDisabled(true);
    }
开发者ID:LBdN,项目名称:Shaderkit,代码行数:50,代码来源:importer_wizard.cpp

示例14: updateAttributes

void FilterSettingsPage::updateAttributes(QListWidgetItem *item)
{
    QStringList checkedList;
    if (item)
        checkedList = m_filterMap.value(item->text());

    for (int i = 0; i < m_ui.attributeWidget->topLevelItemCount(); ++i) {
        QTreeWidgetItem *itm = m_ui.attributeWidget->topLevelItem(i);
        if (checkedList.contains(itm->text(0)))
            itm->setCheckState(0, Qt::Checked);
        else
            itm->setCheckState(0, Qt::Unchecked);
    }
}
开发者ID:gidlbn,项目名称:dlbn_02,代码行数:14,代码来源:filtersettingspage.cpp

示例15: addImportList

//void DataMergeGui::addImportList(vector<string>& vec)
void DataMergeGui::addImportList(vector<ImportElement>& vec)
{
	vector<ImportElement>::iterator iter;
    for (iter = vec.begin(); iter != vec.end(); ++iter)
    {
        QTreeWidgetItem *topItem = new QTreeWidgetItem(importTree);
		string name = iter->fileName;
		
		topItem->setText(0, name.c_str());
		topItem->setCheckState(0, Qt::Unchecked);
		for (int i = 0; i < iter->bandNum; i++)
		{
			QTreeWidgetItem *childItem = new QTreeWidgetItem(topItem);
			childItem->setCheckState(0, Qt::Unchecked);
			childItem->setText(0, tr("Band%1").arg(i + 1));
		}
    }

	/* 
	vector<string>::iterator iter;
    for (iter = vec.begin(); iter != vec.end(); ++iter)
    {
        QListWidgetItem *item = new QListWidgetItem(importList);
        item->setText(iter->c_str());
    }
*/
	
   // importTree->setColumnCount(1);
   /*
    for (int i = 0; i < 4; ++i)
    {
        QTreeWidgetItem *item = new QTreeWidgetItem(importTree);
        item->setText(0, tr("item%1").arg(i));
        item->setCheckState(0, Qt::Unchecked);
        connect(importTree, SIGNAL(itemClicked(QTreeWidgetItem *, int)),
                this, SLOT(treeItemSlot(QTreeWidgetItem *, int)));

        items.append(item);
    }

    for (int t = 0; t < 4; ++t) 
	{
        QTreeWidgetItem *table = new QTreeWidgetItem(items.at(0));
        table->setCheckState(0, Qt::Unchecked);
        table->setText(0, "Test");
    }

    importTree->insertTopLevelItems(0, items); */
}
开发者ID:yuguess,项目名称:GSoC,代码行数:50,代码来源:DataMergeGui.cpp


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