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


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

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


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

示例1:

HierarchyTreeControlMimeData::HierarchyTreeControlMimeData(const QList<QTreeWidgetItem*> items)
{
	for (QList<QTreeWidgetItem*>::const_iterator iter = items.begin(); iter != items.end(); ++iter)
	{
		QTreeWidgetItem* item = (*iter);
		QVariant data = item->data(ITEM_ID);
		HierarchyTreeNode::HIERARCHYTREENODEID id = data.toInt();
		
		Logger::Debug("HierarchyTreeNode::HIERARCHYTREENODEID %d", id);
		
		HierarchyTreeNode::HIERARCHYTREENODESIDLIST::iterator it = std::find(this->items.begin(), this->items.end(), id);
		if (it == this->items.end())
			this->items.push_back(id);
	}
}
开发者ID:droidenko,项目名称:dava.framework,代码行数:15,代码来源:hierarchytreecontrol.cpp

示例2: s

void EditDrumset::updateList2()
      {
      for (int i = 0; i < pitchList->topLevelItemCount(); ++i) {
            QTreeWidgetItem* item = pitchList->topLevelItem(i);
            int pitch = item->data(0, Qt::UserRole).toInt();
            if (nDrumset.shortcut(pitch) == 0)
                  item->setText(COL_SHORTCUT, "");
            else {
                  QString s(QChar(nDrumset.shortcut(pitch)));
                  item->setText(COL_SHORTCUT, s);
                  }
            item->setText(COL_NAME, qApp->translate("drumset", qPrintable(nDrumset.name(pitch))));
            item->setData(0, Qt::UserRole, pitch);
            }
      }
开发者ID:alexkonradi,项目名称:MuseScore,代码行数:15,代码来源:editdrumset.cpp

示例3: UpdateTrackVolumeAnnotation

void InfoTreeWidget::UpdateTrackVolumeAnnotation(Layer *layer, const QVariantMap &info)
{
  for (int i = 0; i < this->topLevelItemCount(); i++)
  {
    QTreeWidgetItem* item = this->topLevelItem(i);
    if (item)
    {
      QVariantMap map = item->data(1, Qt::UserRole).toMap();
      if (map.contains("Object") && map["Object"].value<QObject*>() == layer)
      {
        item->setText(1, QString("%1 \t%2").arg(info["label"].toInt()).arg(info["name"].toString()));
      }
    }
  }
}
开发者ID:CBoensel,项目名称:freesurfer,代码行数:15,代码来源:InfoTreeWidget.cpp

示例4: excludeFromExecution

void LibraryTreeWidget::excludeFromExecution(bool checked)
{
    if (selectedItems().empty() == true)
        return;

    QTreeWidgetItem* item = selectedItems()[0];

    QMap<QString, QVariant> data = item->data(0, Qt::UserRole).toMap();
    data["excludeFromExecution"] = checked;
    item->setData(0, Qt::UserRole, data);

    item->setIcon(0, IconLibrary::instance().icon(0, checked ? "lua with stop" : "lua"));

    dependencyGraph_.setExcludeFromExecution(data["filename"].toString(), checked);
}
开发者ID:lsouchet,项目名称:gideros,代码行数:15,代码来源:librarytreewidget.cpp

示例5: foreach

VCXYPadPreset *VCXYPadProperties::getSelectedPreset()
{
    if (m_presetsTree->selectedItems().isEmpty())
        return NULL;

    QTreeWidgetItem* item = m_presetsTree->selectedItems().first();
    if (item != NULL)
    {
        quint8 presetID = item->data(0, Qt::UserRole).toUInt();
        foreach(VCXYPadPreset* preset, m_presetList)
        {
            if (preset->m_id == presetID)
                return preset;
        }
    }
开发者ID:fourbytes,项目名称:qlcplus,代码行数:15,代码来源:vcxypadproperties.cpp

示例6: updateTextFormatDisplay

void EditorPage::updateTextFormatDisplay()
{
    QTreeWidgetItem *item = ui->textFormats->currentItem();
    bool canEdit = item && item->data(0, TextFormatConfigKeyRole).isValid();
    if (!canEdit)
        return;

    QTextCharFormat format = constructTextFormat();
    item->setData( 0, TextFormatRole, QVariant::fromValue(format) );

    if (item != mCommonTextFormatItem)
        updateTextFormatDisplay( item );
    else
        updateTextFormatDisplayCommons();
}
开发者ID:SpaceAppsXploration,项目名称:supercollider,代码行数:15,代码来源:editor_page.cpp

示例7: invisibleRootItem

  /**
   * Get the QTreeWidgetItem associated with the given undo command (work order). Returns NULL if
   *   none found or given NULL.
   *
   * @param undoCommand A work order
   * @return The QTreeWidgetItem that represents (is associated with) the undoCommand
   */
  QTreeWidgetItem *HistoryTreeWidget::undoCommandToTreeItem(const QUndoCommand *undoCommand) {
    QTreeWidgetItem *result = NULL;

    if (undoCommand) {
      for (int i = invisibleRootItem()->childCount() - 1; !result && i >= 0; i--) {
        QTreeWidgetItem *item = invisibleRootItem()->child(i);
        WorkOrder *workOrder = item->data(0, Qt::UserRole).value<WorkOrder *>();

        if (undoCommand == workOrder)
          result = item;
      }
    }

    return result;
  }
开发者ID:jlaura,项目名称:isis3,代码行数:22,代码来源:HistoryTreeWidget.cpp

示例8:

QSet <quint32> VCSpeedDialProperties::functions() const
{
    QSet <quint32> set;
    for (int i = 0; i < m_tree->topLevelItemCount(); i++)
    {
        QTreeWidgetItem* item = m_tree->topLevelItem(i);
        Q_ASSERT(item != NULL);

        QVariant var = item->data(COL_NAME, PROP_ID);
        if (var.isValid() == true)
            set << var.toUInt();
    }

    return set;
}
开发者ID:mguentner,项目名称:qlc,代码行数:15,代码来源:vcspeeddialproperties.cpp

示例9: fixtureItem

QTreeWidgetItem* EFXEditor::fixtureItem(EFXFixture* ef)
{
    QTreeWidgetItemIterator it(m_tree);
    while (*it != NULL)
    {
        QTreeWidgetItem* item = *it;
        EFXFixture* ef_item = reinterpret_cast<EFXFixture*>
                              (item->data(0, Qt::UserRole).toULongLong());
        if (ef_item == ef)
            return item;
        ++it;
    }

    return NULL;
}
开发者ID:PML369,项目名称:qlcplus,代码行数:15,代码来源:efxeditor.cpp

示例10: expandMessages

void ProtobufTree::expandMessages(QTreeWidgetItem* item) {
    if (!item) {
        item = invisibleRootItem();
    }

    expandItem(item);

    for (int i = 0; i < item->childCount(); ++i) {
        QTreeWidgetItem* child = item->child(i);

        if (child->data(Column_Tag, IsMessageRole).toBool()) {
            expandMessages(child);
        }
    }
}
开发者ID:RoboJackets,项目名称:robocup-software,代码行数:15,代码来源:ProtobufTree.cpp

示例11: closeLibrary

void LibraryWidget::closeLibrary(const QUrl &projectThingUrl)
{
    int toplevelItems = ui->treeWidget->topLevelItemCount();

    for(int i=1; i <= toplevelItems; i++) {
        QTreeWidgetItem *root = ui->treeWidget->topLevelItem(i);

        QUrl openProject = (root->data(0,BibGlobals::Role_ProjectThing).toUrl());
        if(openProject == projectThingUrl) {
            QTreeWidgetItem *closedItem = ui->treeWidget->takeTopLevelItem(i);
            delete closedItem;
            break;
        }
    }
}
开发者ID:KDE,项目名称:conquirere,代码行数:15,代码来源:librarywidget.cpp

示例12: listChanged

void CheatEditorWindow::listChanged() {
  QList<QTreeWidgetItem*> items = list->selectedItems();
  if(items.count() > 0) {
    QTreeWidgetItem *item = items[0];
    unsigned n = item->data(0, Qt::UserRole).toUInt();

    SNES::Cheat::cheat_t code;
    SNES::cheat.get(n, code);

    descEdit->setText(utf8() << code.desc);
    codeEdit->setText(utf8() << code.code);
  }

  syncUi();
}
开发者ID:ben401,项目名称:OpenEmu,代码行数:15,代码来源:cheateditor.cpp

示例13: onEditButtonClicked

	void LinkList::onEditButtonClicked()
	{
		QTreeWidgetItem *item =
			linkTree->currentItem();
		if( item == NULL )
			return;

		bool ok;
		uint32 id = item->data( 3, Qt::UserRole ).toUInt( &ok );
		if( !ok )
			return;

		linkEditor->setLinkId( id );
		linkEditor->show();
	}
开发者ID:CCChaos,项目名称:RyzomCore,代码行数:15,代码来源:link_list.cpp

示例14: moveToMostActiveItem

void TreeWidget::moveToMostActiveItem()
{
    QTreeWidgetItem* mostActive = 0;
    QTreeWidgetItemIterator it(this, QTreeWidgetItemIterator::Unselected);
    while (*it) {
        QTreeWidgetItem* item = *it;

        if (d.highlightedItems.contains(item)) {
            // we found a channel hilight or PM to us
            setCurrentItem(item);
            return;
        }

        // as a backup, store the most active window with any sort of activity
        const int badge = item->data(1, TreeRole::Badge).toInt();
        if (badge > 0 && (!mostActive || mostActive->data(1, TreeRole::Badge).toInt() < badge))
            mostActive = item;

        it++;
    }

    if (mostActive)
        setCurrentItem(mostActive);
}
开发者ID:jpnurmi,项目名称:communi-desktop,代码行数:24,代码来源:treewidget.cpp

示例15: size

void QgsVectorGradientColorRampV2Dialog::updatePreview()
{
  // update ramp stops from the tree widget
  QgsGradientStopsList stops;
  if ( groupStops->isChecked() )
  {
    int count = treeStops->topLevelItemCount();
    for ( int i = 0; i < count; i++ )
    {
      QTreeWidgetItem* item = treeStops->topLevelItem( i );
      double offset = item->data( 0, StopOffsetRole ).toDouble();
      QColor color = item->data( 0, StopColorRole ).value<QColor>();
      stops.append( QgsGradientStop( offset, color ) );
    }
  }
  mRamp->setStops( stops );

  // generate the preview
  QSize size( 300, 40 );
  lblPreview->setPixmap( QgsSymbolLayerV2Utils::colorRampPreviewPixmap( mRamp, size ) );

  btnColor1->setColor( mRamp->color1() );
  btnColor2->setColor( mRamp->color2() );
}
开发者ID:L-Infantini,项目名称:Quantum-GIS,代码行数:24,代码来源:qgsvectorgradientcolorrampv2dialog.cpp


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