Hi everybdy,
I'm now developping with Qt since 2010, I think (something like that), my last project has been developped with Qt 5.15.7 and I now need to convert it to Qt 6.7.0 for some reasons.
The problem I got is wit the QTreeWidget, and especially the items.
A simple example :
tree->setColumnCount(2);
setCentralWidget(tree);
item->setText(0, "blablabla");
item->setText(1, "blablabla");
tree->addTopLevelItem(item);
item
->setForeground
(0,
QBrush(Qt
::red));
item
->setBackground
(1,
QBrush(Qt
::red));
QTreeWidget* tree = new QTreeWidget(this);
tree->setColumnCount(2);
setCentralWidget(tree);
QTreeWidgetItem *item = new QTreeWidgetItem;
item->setText(0, "blablabla");
item->setText(1, "blablabla");
tree->addTopLevelItem(item);
item->setForeground(0, QBrush(Qt::red));
item->setBackground(1, QBrush(Qt::red));
To copy to clipboard, switch view to plain text mode
is giving me this :
testFG.jpg
As you can see, the background is set in red (setBackground ok), but not the text (setforeground nok).
Of course, it was working flawlessly with Qt 5.15.7 (and it's a very basic thing, so...). Do I miss something? Did you find thins kind of problem and do you have any idea how to solve it? I've fixed all the other inconveniances I've found, due to the upgraded Qt, but this one...
Thanks everyone!
Qt 6.7.0 / Windows / MSVC2019
Bookmarks