本文整理汇总了C++中QTreeWidgetItem::clone方法的典型用法代码示例。如果您正苦于以下问题:C++ QTreeWidgetItem::clone方法的具体用法?C++ QTreeWidgetItem::clone怎么用?C++ QTreeWidgetItem::clone使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTreeWidgetItem
的用法示例。
在下文中一共展示了QTreeWidgetItem::clone方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadCallTree
void VSPTree::LoadCallTree(QString callTreeSummary)
{
Log("Reading : " + callTreeSummary);
QDomDocument doc = readXML( callTreeSummary );
QTreeWidgetItem* root = new QTreeWidgetItem(m_callTreeWidget);
root->setText(0,"CallTree");
m_callTreeWidget->insertTopLevelItem(0, root);
QTreeWidgetItem* flatroot = new QTreeWidgetItem(m_flatCallTreeWidget);
flatroot->setText(0,"FlatCallTree");
m_callTreeWidget->insertTopLevelItem(0, flatroot);
QDomNodeList functionList = doc.elementsByTagName("CallTree");
QHash<int, QTreeWidgetItem*> levelHash;
levelHash.insert(0,root);
QStringList fields;
fields << "FunctionName" << "InclSamples" << "ExclSamples" << "InclSamplesPercent"
<< "ExclSamplesPercent" << "SourceFile" << "LineNumber" << "ModuleName" << "ModulePath"
<< "FunctionAddress" << "Level" << "ProcessName" << "PID";
m_callTreeWidget->setColumnCount(fields.count());
m_callTreeWidget->setHeaderLabels(fields);
m_flatCallTreeWidget->setColumnCount(fields.count());
m_flatCallTreeWidget->setHeaderLabels(fields);
for ( int i = 0; i < functionList.count(); i++ )
{
QTreeWidgetItem* tempWidgetItem = new QTreeWidgetItem();
for ( int j = 0; j < fields.count(); j++ )
{
QString cellText = functionList.at(i).toElement().attribute( fields.at(j) );
if ( fields.at(j) == "ExclSamplesPercent" && cellText.count() < 5)
{
cellText.prepend('0');
}
if ( fields.at(j) == "InclSamplesPercent" && cellText.count() < 5)
{
cellText.prepend('0');
}
if ( fields.at(j) == "Level" && cellText.count() < 2)
{
cellText.prepend('0');
}
tempWidgetItem->setText( j, cellText );
}
int level = functionList.at(i).toElement().attribute("Level").toInt();
levelHash.value(level)->addChild(tempWidgetItem);
QTreeWidgetItem* flatTreeWidgetItem = tempWidgetItem->clone();
flatroot->addChild(flatTreeWidgetItem);
m_flatHash.insert(flatTreeWidgetItem,tempWidgetItem);
levelHash.insert(level+1,tempWidgetItem);
}
m_callTreeWidget->expandAll();
m_callTreeWidget->setAlternatingRowColors(true);
m_flatCallTreeWidget->expandAll();
m_flatCallTreeWidget->setAlternatingRowColors(true);
m_flatCallTreeWidget->setSortingEnabled(true);
}