QGroupHeaderView *ghv = new QGroupHeaderView(Qt::Horizontal, treeWidget); treeWidget->setHeaderLabels(QStringList() << "test1" << "test2" << "group|test3" << "group|test4" << "test5"); treeWidget->setHeader(ghv);
setSectionColor(int section, int row, const QColor &color)
QGroupHeaderView *ghv = new QGroupHeaderView(Qt::Horizontal, treeWidget); treeWidget->setHeaderLabels(QStringList() << "test1" << "test2" << "group|test3" << "group|test4" << "test5"); treeWidget->setHeader(ghv); ghv->setSectionColor(2, 0, QColor(128, 128, 255)); ghv->setSectionColor(2, 1, QColor(255, 160, 115)); ghv->setSectionColor(3, 1, QColor(10, 230, 250)); ghv->setSectionColor(0, 0, QColor(40, 215, 120));
QGroupHeaderView *vh, *hh; vh = new QGroupHeaderView(Qt::Vertical); hh = new QGroupHeaderView(Qt::Horizontal); tableWidget->setRowCount(5); tableWidget->setHorizontalHeader(hh); tableWidget->setVerticalHeader(vh); QStringList l = QStringList() << "test1" << "test2" << "group|test3" << "group|test4" << "test5"; tableWidget->setHorizontalHeaderLabels(l); tableWidget->setVerticalHeaderLabels(l); hh->setSectionColor(2, 0, QColor(128, 128, 255)); hh->setSectionColor(2, 1, QColor(255, 160, 115)); hh->setSectionColor(3, 1, QColor(10, 230, 250)); hh->setSectionColor(0, 0, QColor(40, 215, 120)); vh->setSectionColor(2, 0, QColor(255, 128, 128)); vh->setSectionColor(1, 0, QColor(255, 90, 170)); vh->setSectionColor(4, 0, QColor(100, 30, 250)); vh->setSectionColor(0, 0, QColor(220, 15, 80));