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


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

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


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

示例1:

std::vector<Property*> PropertySelectionTreeWidget::getSelectedProperties(ProcessorNetwork* processorNetwork) {
    std::vector<Property*> selectedProperties;
    int workspaceCount  = propertySelectionTree_->topLevelItemCount();

    for (int i=0; i<workspaceCount; i++) {
        QTreeWidgetItem* wrokspaceItem = propertySelectionTree_->topLevelItem(i);
        int processorCount = wrokspaceItem->childCount();

        for (int j=0; j<processorCount; j++) {
            QTreeWidgetItem* processorItem = wrokspaceItem->child(j);
            int propertyCount = processorItem->childCount();
            QString qproecessorId = processorItem->text(0);
            std::string proecessorId = qproecessorId.toLocal8Bit().constData();

            for (int k=0; k<propertyCount; k++) {
                QTreeWidgetItem* propertyItem = processorItem->child(k);

                if (propertyItem->checkState(0) == Qt::Checked) {
                    QString propertyId = propertyItem->text(0);
                    std::string prop = propertyId.toLocal8Bit().constData();
                    QString workspaceName = wrokspaceItem->text(0);
                    std::string workspace = workspaceName.toLocal8Bit().constData();
                    Processor* processor = processorNetwork->getProcessorByIdentifier(proecessorId);
                    Property* selectedProperty = processor->getPropertyByIdentifier(prop);

                    if (selectedProperty)
                        selectedProperties.push_back(selectedProperty);
                }
            }
        }
    }

    return selectedProperties;
}
开发者ID:Ojaswi,项目名称:inviwo,代码行数:34,代码来源:propertyselectiontreewidget.cpp

示例2: onTestResultsReady

void TestListView::onTestResultsReady(TestProgram* program) {

    // sanity check
    Q_ASSERT_X(program, Q_FUNC_INFO, "null test program");
    if ( program == 0 )
        return;

    // fetch tree item for requested program
    QTreeWidgetItem* programItem = itemForProgram(program);
    if ( programItem == 0 )
        return;
    updateItemForResults(programItem);

    // update program's children (suites & test cases)
    const int suiteCount = programItem->childCount();
    for ( int j = 0; j < suiteCount; ++j ) {
        QTreeWidgetItem* suiteItem = programItem->child(j);
        if ( suiteItem )
            updateItemForResults(suiteItem);

        // foreach test case
        const int testCount = suiteItem->childCount();
        for ( int k = 0; k < testCount; ++k ) {
            QTreeWidgetItem* testItem = suiteItem->child(k);
            if ( testItem )
                updateItemForResults(testItem);
        }
    }

    // select program item if none selected yet
    QTreeWidgetItem* item = currentItem();
    if ( item == 0 )
        setCurrentItem(programItem);
}
开发者ID:pezmaster31,项目名称:edgecase,代码行数:34,代码来源:testlistview.cpp

示例3: updatePresets

void InsertFxPopup::updatePresets()
{
	int i;
	for (i = 0; i < m_fxTree->topLevelItemCount(); i++) {
		QTreeWidgetItem *folder = m_fxTree->topLevelItem(i);
		TFilePath path = TFilePath(folder->data(0, Qt::UserRole).toString().toStdWString());
		if (folder->text(0).toStdString() == "Plugins") {
			continue;
		}
		if (path.getName() == "macroFx") {
			int j;
			for (j = folder->childCount() - 1; j >= 0; j--)
				folder->removeChild(folder->child(j));
			m_fxTree->removeItemWidget(folder, 0);
			delete folder;
		} else if (path.getParentDir().getName() == "macroFx")
			continue;
		else
			for (int i = 0; i < folder->childCount(); i++) {
				bool isPresetLoaded = loadPreset(folder->child(i));
				if (isPresetLoaded)
					folder->child(i)->setIcon(0, m_presetIcon);
				else
					folder->child(i)->setIcon(0, m_fxIcon);
			}
	}
	loadMacro();

	update();
}
开发者ID:CroW-CZ,项目名称:opentoonz,代码行数:30,代码来源:insertfxpopup.cpp

示例4: updateTreeList

void SettingsEditorForm::updateTreeList(QString path, QStringList newDirs, QStringList newElements)
{
    QStringList dirs = path.split("/");
    dirs.removeFirst();
    QTreeWidgetItem* iter = ui->treeWidget->topLevelItem(0);
    for(QString dir : dirs)
    {
        for(int i=0; i<iter->childCount(); i++)
        {
            if(iter->child(i)->type() == TWT_DIR
                    && iter->child(i)->text(0) == dir)
            {
                iter = iter->child(i);
            }
        }
    }

    for(QString dir : newDirs)
    {
        QTreeWidgetItem * newItem = new QTreeWidgetItem(TWT_DIR);
        newItem->setText(0, dir);
        iter->addChild( newItem );
    }

    for(QString element : newElements)
    {
        QTreeWidgetItem * newItem = new QTreeWidgetItem(TWT_RES);
        newItem->setText(0, element);
        iter->addChild( newItem );
    }

    ui->treeWidget->expandAll();
}
开发者ID:ddomurad,项目名称:mibot,代码行数:33,代码来源:SettingsEditorForm.cpp

示例5: functionItem

QTreeWidgetItem* FunctionsTreeWidget::functionItem(const Function* function)
{
    Q_ASSERT(function != NULL);

    QTreeWidgetItem* parent = parentItem(function);
    Q_ASSERT(parent != NULL);

    for (int i = 0; i < parent->childCount(); i++)
    {
        QTreeWidgetItem* item = parent->child(i);
        if (itemFunctionId(item) == function->id())
            return item;
        // Sequences are in a further sublevel. Check if there is any
        if (item->childCount() > 0)
        {
            for (int j = 0; j < item->childCount(); j++)
            {
                QTreeWidgetItem* seqItem = item->child(j);
                if (itemFunctionId(seqItem) == function->id())
                    return item;
            }
        }
    }

    return NULL;
}
开发者ID:CShark,项目名称:qlcplus,代码行数:26,代码来源:functionstreewidget.cpp

示例6: displayElement

void Tree::displayElement(EltID id)
{
    if (_displayedElements.contains(id))
        return;
    _displayedElements << id;

    // Affichage
    QTreeWidgetItem *child;

    int max = this->topLevelItemCount();
    for (int i = 0; i < max; i++)
    {
        child = this->topLevelItem(i);
        if (child->text(1).toInt() == id.indexSf2)
        {
            if (id.typeElement == elementSmpl)
                child = child->child(0);
            else if (id.typeElement == elementInst)
                child = child->child(1);
            else
                child = child->child(2);
            int numChilds = child->childCount();
            for (int j = 0; j < numChilds; j++)
            {
                // Affichage de la sous-arborescence
                if (child->child(j)->text(3).toInt() == id.indexElt)
                    child->child(j)->setHidden(false);
            }
        }
    }
}
开发者ID:UIKit0,项目名称:polyphone,代码行数:31,代码来源:tree.cpp

示例7: trier

void Tree::trier(int forme)
{
    // fichiers SF2 par ordre alphabétique
    int max = this->topLevelItemCount();
    QTreeWidgetItem *child;
    this->sortItems(0, Qt::AscendingOrder); // colonne 5 ne fonctionne pas ?!
    for (int i = 0; i < max; i ++)
        this->topLevelItem(i)->sortChildren(5, Qt::AscendingOrder);
    if (forme)
    {
        // Mise en forme (expanded / collapsed)
        for (int i = 0; i < max; i++)
        {
            child = this->topLevelItem(i);
            child->setExpanded(1);
            for (int j = 0; j < child->childCount(); j++)
            {
                child->child(j)->setExpanded(0);
                for (int k = 0; k < child->child(j)->childCount(); k++)
                {
                    child->child(j)->child(k)->setExpanded(0);
                }
            }
        }
    }
}
开发者ID:UIKit0,项目名称:polyphone,代码行数:26,代码来源:tree.cpp

示例8:

QList<QList<int>> XMLInfoDialog::getSelectedTuple()
{
    QList<QList<int>> list;

    int topLevelCount = ui->treeWidget->topLevelItemCount();
    for (int i = 0; i < topLevelCount; i++)
    {
        //如果顶层item没有被选中(即其子节点都未被选中),直接跳过这个节点
        if (ui->treeWidget->topLevelItem(i)->checkState(0) == Qt::Unchecked)
            continue;

        QTreeWidgetItem* topLevelItem = ui->treeWidget->topLevelItem(i);
        int secLevelCount = topLevelItem->childCount();
        for (int j = 0; j < secLevelCount; j++)
        {
            //如果第二层item没有被选中(即第三层的节点都未被选中), 直接跳过这个节点
            if (topLevelItem->child(j)->checkState(0) == Qt::Unchecked)
                continue;

            QTreeWidgetItem* secLevelItem = topLevelItem->child(j);
            int thirLevelCount = secLevelItem->childCount();
            for (int k = 0; k < thirLevelCount; k++)
            {
                if (secLevelItem->child(k)->checkState(0) ==  Qt::Checked)
                {
                    QList<int> subList;
                    subList << i << j << k;
                    list.append(subList);
                }
            }
        }
    }

    return list;
}
开发者ID:oduiwei,项目名称:RSStalk,代码行数:35,代码来源:xmlinfodialog.cpp

示例9: moveSelection

void Parametertuner::moveSelection(int dir)
{
	QTreeWidgetItem* thisItem = getSelectedItem();
	if (!thisItem)
	{
		m_ui.parameter_root_widget->topLevelItem(0)->setSelected(true);
		return;
	}
	QTreeWidgetItem* parent = thisItem->parent();
	QTreeWidgetItem* nextItem;

	if (!parent)
	{
		parent = m_ui.parameter_root_widget->invisibleRootItem();
	}
	int thisItemIndex = parent->indexOfChild(thisItem);
	if (thisItem->isExpanded() && dir == DOWN)
	{
		nextItem = thisItem->child(0);
		updateSelection(thisItem, nextItem);
		return;
	}
	else if (!parent->child(thisItemIndex + dir))
	{
		updateSelection(thisItem, parent);
		return;
	}
	else
	{
		nextItem = parent->child(thisItemIndex + dir);
		updateSelection(thisItem, nextItem);
		return;
	}

}
开发者ID:NimbRo-Copter,项目名称:nimbro-op-ros,代码行数:35,代码来源:parametertuner.cpp

示例10: populateFileWidget

void PackageProperties::populateFileWidget()
{
    treeWidget->clear();
    treeWidget->header()->hide();
    QStringList files = curPkg.files();
    foreach(const QString &file, files) {
        QStringList splitted = file.split(QChar('/'));
        QTreeWidgetItem *parentItem = 0;
        foreach(const QString &spl, splitted) {
            if (spl.isEmpty())
                continue;
            if (parentItem) {
                bool there = false;
                int j = parentItem->childCount();
                for (int i = 0; i != j; i++) {
                    if (parentItem->child(i)->text(0) == spl) {
                        there = true;
                        parentItem = parentItem->child(i);
                        continue;
                    }
                }
                if (!there)
                    parentItem->addChild(new QTreeWidgetItem(parentItem, (QStringList) spl));
            } else {
                QList<QTreeWidgetItem*> list = treeWidget->findItems(spl, Qt::MatchExactly);
                if (!list.isEmpty()) {
                    parentItem = list.first();
                } else {
                    treeWidget->insertTopLevelItem(0, new QTreeWidgetItem(treeWidget, (QStringList) spl));
                }
            }
        }
    }
开发者ID:drf,项目名称:shaman1,代码行数:33,代码来源:PackageProperties.cpp

示例11: modelExcelRemoveFile

void OutputWindow::modelExcelRemoveFile(const QString &name)
{
    QTreeWidget* tree = ui->treeWidget;
    QTreeWidgetItem* root = tree->topLevelItem(0);
    QFileInfo info(name);
    QString xlpath = info.absolutePath().replace(modelFolder, tr(""));
    QString xlfile = info.fileName();

    bool removed = false;
    for(int j = 0; j<root->childCount(); ++j) {
        if(root->child(j)->text(0).compare(xlpath, Qt::CaseInsensitive) == 0) {
            QTreeWidgetItem* item = root->child(j);
            for(int k = 0; k< item->childCount(); ++k) {
                if( item->child(k)->text(0).compare(xlfile, Qt::CaseInsensitive) == 0) {
                    //Gotcha!
                    item->takeChild(k);
                    removed = true;
                    break;//for-k
                }
            }
            if(removed) {
                if( item->childCount() == 0) {
                    root->takeChild(j);
                }
                break;//for-j
            }
        } else if(root->child(j)->text(0).compare(xlfile, Qt::CaseInsensitive) == 0) {
            root->takeChild(j);
            break;//for-j
        }
    }

}
开发者ID:LMiceOrg,项目名称:Modelingtools,代码行数:33,代码来源:outputwindow.cpp

示例12: while

QTreeWidgetItem *QTreeWidgetItemIteratorPrivate::next(const QTreeWidgetItem *current)
{
    if (!current) return 0;

    QTreeWidgetItem *next = 0;
    if (current->childCount()) {
        // walk the child
        m_parentIndex.push(m_currentIndex);
        m_currentIndex = 0;
        next = current->child(0);
    } else {
        // walk the sibling
        QTreeWidgetItem *parent = current->parent();
        next = parent ? parent->child(m_currentIndex + 1)
                      : m_model->rootItem->child(m_currentIndex + 1);
        while (!next && parent) {
            // if we had no sibling walk up the parent and try the sibling of that
            parent = parent->parent();
            m_currentIndex = m_parentIndex.pop();
            next = parent ? parent->child(m_currentIndex + 1)
                          : m_model->rootItem->child(m_currentIndex + 1);
        }
        if (next) ++(m_currentIndex);
    }
    return next;
}
开发者ID:AlekSi,项目名称:phantomjs,代码行数:26,代码来源:qtreewidgetitemiterator.cpp

示例13: addFunction

void UserFitFunctionDialog::addFunction(const QString &op, bool brackets) {
  ui.teExpression->setFocus();

  QList<QTreeWidgetItem *> selection = ui.treeFunctions->selectedItems();
  if (selection.size() == 0)
    return;

  QTreeWidgetItem *item = selection.first();
  QTreeWidgetItem *parentItem = item->parent();

  if (parentItem == NULL)
    return; // this sould never happen, just in case

  if (parentItem->parent() != NULL)
    item = parentItem;

  // QTextCursor cursor = ui.teExpression->textCursor();
  // cursor.insertText( item->text(1) );

  QString oper = ui.teExpression->toPlainText().isEmpty() ? "" : op;
  QString expr = item->text(1);
  if (brackets)
    expr = QString("(") + expr + ")";
  expr = oper + expr;
  ui.teExpression->insertPlainText(expr);

  if (item->childCount() == 0 || !ui.lePeakParams->text().isEmpty())
    return;

  ui.lePeakParams->setText(item->child(0)->text(1));
  ui.leWidthFormula->setText(item->child(1)->text(1));
}
开发者ID:liyulun,项目名称:mantid,代码行数:32,代码来源:UserFitFunctionDialog.cpp

示例14: searchTree

void Tree::searchTree(QString qStr)
{
    qStr = qStr.toLower();
    unsigned int max = this->topLevelItemCount();
    unsigned int max2;
    QTreeWidgetItem *child;

    // Etat initial
    _displayedElements.clear();
    bool isDisplayed = qStr.isEmpty();
    for (unsigned int i = 0; i < max; i ++)
    {
        child = this->topLevelItem(i);
        max2 = child->childCount();

        // Niveau 1: en-têtes "échantillons", "instruments", "presets"
        for (unsigned int j = 0; j < max2; j++)
        {
            // Niveau 2: sample, instrument ou preset
            for (int k = 0; k < child->child(j)->childCount(); k++)
            {
                QTreeWidgetItem * item = child->child(j)->child(k);
                if (item->text(6) == "0") // Si l'élément n'est pas masqué par une suppression non définitive
                    item->setHidden(!isDisplayed);
            }
        }
    }
    if (isDisplayed)
        return;

    for (unsigned int i = 0; i < max; i ++)
    {
        child = this->topLevelItem(i);
        max2 = child->childCount();

        // Niveau 1: en-têtes "échantillons", "instruments", "presets"
        for (unsigned int j = 0; j < max2; j++)
        {
            // Niveau 2: sample, instrument ou preset
            for (int k = 0; k < child->child(j)->childCount(); k++)
            {
                QTreeWidgetItem * item = child->child(j)->child(k);
                if (item->text(6) == "0") // Si l'élément n'est pas masqué par une suppression non définitive
                {
                    if (item->text(0).toLower().indexOf(qStr) != -1 || item->isSelected())
                    {
                        if (item->text(2) == "smpl")
                            displaySample(item->text(1).toInt(), item->text(3).toInt());
                        else if (item->text(2) == "inst")
                            displayInstrument(item->text(1).toInt(), item->text(3).toInt());
                        else if (item->text(2) == "prst")
                            displayPreset(item->text(1).toInt(), item->text(3).toInt());
                    }
                }
            }
        }
    }
}
开发者ID:UIKit0,项目名称:polyphone,代码行数:58,代码来源:tree.cpp

示例15: refreshTree

void TabManagerWidget::refreshTree()
{
    if (m_refreshBlocked) {
        return;
    }

    if (m_isRefreshing && !m_webPage) {
        return;
    }

    // store selected items
    QList<QWidget*> selectedTabs;
    for (int i = 0; i < ui->treeWidget->topLevelItemCount(); ++i) {
        QTreeWidgetItem* winItem = ui->treeWidget->topLevelItem(i);
        if (winItem->checkState(0) == Qt::Unchecked) {
            continue;
        }

        for (int j = 0; j < winItem->childCount(); ++j) {
            QTreeWidgetItem* tabItem = winItem->child(j);
            if (tabItem->checkState(0) == Qt::Unchecked) {
                continue;
            }
            selectedTabs << qvariant_cast<QWidget*>(tabItem->data(0, WebTabPointerRole));
        }
    }

    ui->treeWidget->clear();

    if (m_groupType == GroupByHost) {
        groupByDomainName(true);
    }
    else if (m_groupType == GroupByDomain) {
        groupByDomainName();
    }
    else { // fallback to GroupByWindow
        m_groupType = GroupByWindow;
        groupByWindow();
    }

    // restore selected items
    for (int i = 0; i < ui->treeWidget->topLevelItemCount(); ++i) {
        QTreeWidgetItem* winItem = ui->treeWidget->topLevelItem(i);

        for (int j = 0; j < winItem->childCount(); ++j) {
            QTreeWidgetItem* tabItem = winItem->child(j);

            if (selectedTabs.contains(qvariant_cast<QWidget*>(tabItem->data(0, WebTabPointerRole)))) {
                tabItem->setCheckState(0, Qt::Checked);
            }
        }
    }

    filterChanged(m_filterText, true);
    ui->treeWidget->expandAll();
    m_isRefreshing = false;
    m_waitForRefresh = false;
}
开发者ID:,项目名称:,代码行数:58,代码来源:


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