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


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

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


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

示例1: on_extractBtn_clicked

void MainWindow::on_extractBtn_clicked()
{
    QString msg = ui->inputTxt->text();
    if (msg.isEmpty())
        return;
    isoExtract->process(msg);

    QTreeWidget* tree = ui->resultTree;
    tree->clear();

    QTreeWidgetItem *parentItem = new QTreeWidgetItem(tree,QStringList(isoExtract->msgType));

    QList<QTreeWidgetItem *> items;

    QMap<int, IsoField*> isoMsgMap = isoExtract->isoMessage;

    QMapIterator<int, IsoField*> i(isoMsgMap);
    while (i.hasNext()) {
        i.next();
        QStringList bitmsg;
        bitmsg << QString("Bit %1").arg(i.key()) << i.value()->lengthType << i.value()->value;
        items.append(new QTreeWidgetItem((QTreeWidget*)0, bitmsg));
    }
    parentItem->addChildren(items);
    tree->expandItem(parentItem);
//    tree->setSelectionMode(QAbstractItemView::ExtendedSelection);

}
开发者ID:bmanojlovic,项目名称:iso8583extract,代码行数:28,代码来源:mainwindow.cpp

示例2: generateScreenTree

QTreeWidgetItem* LOCACC::generateScreenTree(QJsonObject screenJObj)
{
    QStringList treeList;
    treeList << screenJObj["id"].toString();
    QTreeWidgetItem *screenItemWidget = new QTreeWidgetItem(treeList);
    screenItemWidget->addChildren(generateElementsTree(screenJObj));
    return screenItemWidget;
}
开发者ID:vihangpatel,项目名称:WatchDog2,代码行数:8,代码来源:locacc.cpp

示例3: sort

void LibraryTreeWidget::sort()
{
	QTreeWidgetItem* root = invisibleRootItem();

	if (selectedItems().empty() == false)
		root = selectedItems()[0];

	QList<QTreeWidgetItem*> children = root->takeChildren();

	std::sort(children.begin(), children.end(), LessQTreeWidgetItem());

	root->addChildren(children);
}
开发者ID:lsouchet,项目名称:gideros,代码行数:13,代码来源:librarytreewidget.cpp

示例4: binresToQList

static QList<QTreeWidgetItem *> binresToQList(binresult *res){
    QList<QTreeWidgetItem *> items;
    QTreeWidgetItem *item;
    binresult *e;
    quint32 i;
    for (i=0; i<res->length; i++){
        e=res->array[i];
        item=new QTreeWidgetItem((QTreeWidget*)0, QStringList(QString(find_res(e, "name")->str)));
        item->setData(1, Qt::UserRole, (qulonglong)find_res(e, "folderid")->num);
        item->addChildren(binresToQList(find_res(e, "contents")));
        items.append(item);
    }
    return items;
}
开发者ID:shaglund,项目名称:pfs-gui,代码行数:14,代码来源:directorypickerdialog.cpp

示例5: createTree

QTreeWidgetItem* XPathInspector::createTree(QWebElement root)
{
	QString js = "var arr = []; ";
    js +=        "for (var i=0; i<this.childNodes.length; i++) ";
    js +=        "   if (this.childNodes[i].nodeType == 3 && this.childNodes[i].nodeValue.replace(/^\\s+|\\s+$/g,'') != '') ";
    js +=        "      arr.push(this.childNodes[i].nodeValue); ";
	js +=        "   else if (this.childNodes[i].nodeType == 1)";
	js +=        "      arr.push(this.childNodes[i].tagName); ";
    js +=        "arr; ";
	QVariant v = root.evaluateJavaScript(js);
	QStringList nodes = v.toStringList();

	QWebElement child = root.firstChild();
	QList<QTreeWidgetItem*> list;
	int i = 0;
	while (!(i>=nodes.count() && child.isNull()))
	{
		while (i<nodes.count() && nodes.at(i) != child.tagName())
		{
			QTreeWidgetItem *item2 = new QTreeWidgetItem();
			item2->setText(0, nodes.at(i));
			list.append(item2);
			i++;
		}
		if (!child.isNull())
		{
			list.append(createTree(child));
			child = child.nextSibling();
			i++;
		}
	}

	QString text = "<"+root.tagName().toLower();
	QStringList attrs = root.attributeNames();
	for (int i=0; i<attrs.count(); i++)
		text += " "+attrs.at(i)+"=\""+root.attribute(attrs.at(i))+"\"";
	text += ">";
	
	QTreeWidgetItem *item = new QTreeWidgetItem();
	item->setText(0, text);
	QVariant v2(QVariant::UserType);
	v2.setValue<QWebElement>(root);
	item->setData(0, Qt::UserRole, v2);
	item->addChildren(list);
	return item;
}
开发者ID:scraperlab,项目名称:browserext,代码行数:46,代码来源:xpathinspector.cpp

示例6: QTreeWidgetItem

QList<QTreeWidgetItem *> LOCACC::generateElementsTree(QJsonObject screenJObj)
{
    QStringList treeList;
    QJsonObject eleJObject;
    QList<QTreeWidgetItem *> eleTreeItemlist;
    QJsonArray eleJArray = screenJObj["elements"].toArray();
    for(int i = 0 ; i < eleJArray.count(); i++)
    {
        treeList.clear();
        eleJObject = eleJArray.at(i).toObject();
        treeList << eleJObject["id"].toString();
        QTreeWidgetItem *ele = new QTreeWidgetItem(treeList);
        // qDebug() << eleJArray.at(i).toString();
        eleTreeItemlist.append(ele);
        ele->addChildren(generateMessageTree(eleJObject["messages"].toArray()));
    }
    return eleTreeItemlist;
}
开发者ID:vihangpatel,项目名称:WatchDog2,代码行数:18,代码来源:locacc.cpp

示例7: createTopLevelItems

void EffectsListWidget::createTopLevelItems(QList <QTreeWidgetItem *>list, int effectType)
{
    // Favorites is a pseudo-folder used to store items, not visible to end user, so don't i18n its name
    QTreeWidgetItem *misc = findFolder(QStringLiteral("TemporaryFolder"));
    if (misc == NULL) {
        misc = new QTreeWidgetItem(this, QStringList(QStringLiteral("TemporaryFolder")));
        misc->setData(0, TypeRole, QString::number((int) EffectsList::EFFECT_FOLDER));
        misc->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
    }
    else qDeleteAll(misc->takeChildren());
    setIndentation(0);
    misc->addChildren(list);
    for (int j = 0; j < misc->childCount(); ++j) {
        QTreeWidgetItem *child = misc->child(j);
        child->setHidden(false);
        child->setData(0, Qt::UserRole, effectType);
    }
    setRootIndex(indexFromItem(misc));
}
开发者ID:JongHong,项目名称:kdenlive,代码行数:19,代码来源:effectslistwidget.cpp

示例8: isVariantDeep

static QTreeWidgetItem *
variantToItem(const QString &key, const QVariant &var,
              const QVariant &defaultVar)
{
    if (var == defaultVar) {
        return NULL;
    }

    QString val;

    bool deep = isVariantDeep(var);
    if (!deep) {
        variantToString(var, val);
    }

    //qDebug()<<"key = "<<key;
    //qDebug()<<"val = "<<val;
    QStringList lst;
    lst += key;
    lst += val;

    QTreeWidgetItem *item = new QTreeWidgetItem((QTreeWidgetItem *)0, lst);

    if (deep) {
        QList<QTreeWidgetItem *> children;
        if (var.type() == QVariant::Map) {
            QVariantMap map = var.toMap();
            QVariantMap defaultMap = defaultVar.toMap();
            variantMapToItems(map, defaultMap, children);
        }
        if (var.type() == QVariant::List) {
            QVector<QVariant> lst = var.toList().toVector();
            QVector<QVariant> defaultLst = defaultVar.toList().toVector();
            variantListToItems(lst, defaultLst, children);
        }
        item->addChildren(children);
    }

    return item;
}
开发者ID:Acidburn0zzz,项目名称:apitrace,代码行数:40,代码来源:mainwindow.cpp

示例9: addTreeData


//.........这里部分代码省略.........

            // Show the number of elements as the value for the field itself
            item->setData(Column_Value, Qt::DisplayRole, n);

            // Make sure we have enough children
            int children = item->childCount();
            if (children < n) {
                // Add children
                for (int i = children; i < n; ++i) {
                    QTreeWidgetItem* child = new QTreeWidgetItem(item);
                    child->setText(Column_Field, QString("[%1]").arg(i));

                    child->setData(Column_Tag, FieldDescriptorRole, field);

                    // For repeated items, the tag column holds the index in the
                    // field
                    child->setData(Column_Tag, Qt::DisplayRole, i);

                    // A FieldMap is not used here because the items don't
                    // actually have tags. The item's position in its parent is
                    // its position in the repeated field.
                }

                newFields = true;
            } else if (children > n) {
                // Remove excess children
                // Internally, QTreeWidgetItem stores a QList of children.
                // Hopefully this is efficient.
                QList<QTreeWidgetItem*> kids = item->takeChildren();
                for (int i = 0; i < (children - n); ++i) {
                    delete kids.back();
                    kids.pop_back();
                }
                item->addChildren(kids);
            }

            // Set data for children
            for (int i = 0; i < n; ++i) {
                QTreeWidgetItem* child = item->child(i);

                switch (field->type()) {
                    case FieldDescriptor::TYPE_INT32:
                    case FieldDescriptor::TYPE_SINT32:
                    case FieldDescriptor::TYPE_FIXED32:
                    case FieldDescriptor::TYPE_SFIXED32:
                        child->setData(Column_Value, Qt::DisplayRole,
                                       ref->GetRepeatedInt32(msg, field, i));
                        break;

                    case FieldDescriptor::TYPE_INT64:
                    case FieldDescriptor::TYPE_SINT64:
                    case FieldDescriptor::TYPE_FIXED64:
                    case FieldDescriptor::TYPE_SFIXED64:
                        child->setData(
                            Column_Value, Qt::DisplayRole,
                            (qlonglong)ref->GetRepeatedInt64(msg, field, i));
                        break;

                    case FieldDescriptor::TYPE_UINT32:
                        child->setData(Column_Value, Qt::DisplayRole,
                                       ref->GetRepeatedUInt32(msg, field, i));
                        break;

                    case FieldDescriptor::TYPE_UINT64:
                        child->setData(
                            Column_Value, Qt::DisplayRole,
开发者ID:danbudanov,项目名称:robocup-software,代码行数:67,代码来源:ProtobufTree.cpp

示例10: addChildren

void QTreeWidgetItemProto::addChildren(const QList<QTreeWidgetItem *> &children)
{
  QTreeWidgetItem *item = qscriptvalue_cast<QTreeWidgetItem*>(thisObject());
  if (item)
    item->addChildren(children);
}
开发者ID:,项目名称:,代码行数:6,代码来源:


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