void Test::printOsgGroup(osg::ref_ptr<osg::Group> &groupParam) { qDebug() <<groupParam->getNumChildren(); //std::cout << groupParam->getNumChildren() << std::endl; for (int k = 0; k<groupParam->getNumChildren(); k++) { osg::ref_ptr<osg::Group> group_index = groupParam->getChild(k)->asGroup(); if (group_index->getNumChildren()>1) { printOsgGroup(group_index); } //转换编 //std::string name = w2m1(m2w1(groupParam->getChild(k)->getName(), CP_UTF8)); //std::cout << k << "=" << name << std::endl; qDebug() <<QString::fromStdString(groupParam->getChild(k)->getName()); QString item1 = QString::fromStdString(groupParam->getChild(k)->getName()); QStandardItem* itemProject = new QStandardItem(item1); qStandardItemModel->appendRow(itemProject); //qStandardItemModel->setItem(qStandardItemModel->indexFromItem(itemProject).row(), 1, new QStandardItem(QStringLiteral("项目信息说明"))); //sg->getChild(k)->setNodeMask(1); //std::cout << k << " " << sg->getChild(k)->getName() << " " << sg->getNodeMask() << std::endl; } }
QStandardItemModel* Test::showTreeView() { qStandardItemModel = new QStandardItemModel(this->tesla_manage_ui.treeView); qStandardItemModel->setHorizontalHeaderLabels(QStringList() << QStringLiteral("名称") << QStringLiteral("信息")); return qStandardItemModel; }
原文地址:https://www.cnblogs.com/herd/p/11183283.html
时间: 2024-11-17 16:59:47