Fix adding empty tree widget items in performance counter selection

This commit is contained in:
baldurk
2017-11-20 14:33:44 +00:00
parent 0a20a544c7
commit 31b7662db1
2 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -540,7 +540,7 @@ void RDTreeWidgetItem::setData(int column, int role, const QVariant &value)
dataVec.push_back(RoleData(role, value));
if(role < Qt::UserRole)
if(m_widget && role < Qt::UserRole)
m_widget->m_model->itemChanged(this, {role});
}
@@ -281,10 +281,10 @@ void PerformanceCounterSelection::SetCounters(const QVector<CounterDescription>
if(family != currentFamily)
{
currentRoot = new RDTreeWidgetItem();
ui->counterTree->addTopLevelItem(currentRoot);
currentRoot->setText(0, ToString(family));
currentRoot->setCheckState(0, Qt::Unchecked);
currentRoot->setData(0, PreviousCheckStateRole, Qt::Unchecked);
ui->counterTree->addTopLevelItem(currentRoot);
categories.clear();
@@ -299,10 +299,10 @@ void PerformanceCounterSelection::SetCounters(const QVector<CounterDescription>
if(categoryIterator == categories.end())
{
RDTreeWidgetItem *item = new RDTreeWidgetItem();
currentRoot->addChild(item);
item->setText(0, desc.category);
item->setCheckState(0, Qt::Unchecked);
item->setData(0, PreviousCheckStateRole, Qt::Unchecked);
currentRoot->addChild(item);
categories[category] = item;
categoryItem = item;
@@ -313,12 +313,12 @@ void PerformanceCounterSelection::SetCounters(const QVector<CounterDescription>
}
RDTreeWidgetItem *counterItem = new RDTreeWidgetItem();
categoryItem->addChild(counterItem);
counterItem->setText(0, desc.name);
counterItem->setData(0, CounterDescriptionRole, desc.description);
counterItem->setData(0, CounterIdRole, (uint32_t)desc.counterID);
counterItem->setCheckState(0, Qt::Unchecked);
counterItem->setData(0, PreviousCheckStateRole, Qt::Unchecked);
categoryItem->addChild(counterItem);
m_CounterToTreeItem[desc.counterID] = counterItem;
}