QTreeWidgetItem *rootItem = new QTreeWidgetItem(treeWidget); rootItem->setBackgroundColor(0, QColor(255, 0, 0));
for(int i=0; iThe examples use the Qt library package.topLevelItemCount(); i++){ QTreeWidgetItem *item = treeWidget->topLevelItem(i); if(i%2 == 0){ item->setBackgroundColor(0, QColor(0, 0, 255)); } }