Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.14.2, 5.15
-
None
Description
Setting a QItemDelegate on a QTreeWidget columns ends up with selection blue color being different and also text being white instead of black.
See sample program:
#include <QApplication> #include <QMainWindow> #include <QTreeWidget> #include <QItemDelegate> #include <QVBoxLayout> int main(int argc, char *argv[]) { QApplication app(argc, argv); QMainWindow w; QWidget* centralWidget = new QWidget(&w); w.setCentralWidget(centralWidget); centralWidget->setLayout( new QVBoxLayout() ); QTreeWidget* tree = new QTreeWidget(); tree->setColumnCount(2); centralWidget->layout()->addWidget( tree ); QTreeWidgetItem* item = new QTreeWidgetItem(); item->setText( 0, "No QItemDelegate" ); item->setText( 1, "With QItemDelegate" ); tree->addTopLevelItem( item ); tree->setItemDelegateForColumn( 1, new QItemDelegate() ); w.show(); return app.exec(); }
See resulting display in attached image. The whole row should be highlighted with the same color.
It not not look nice in the end when the whole line is selected and also it leads to problems if you try to use delegate to display html (because your black text is almost invisible whith the dark blue background bsing used).