QTreeWidgetItem::setForeground no longer works with latest KF5

Albert Astals Cid aacid at kde.org
Fri Dec 30 18:07:10 GMT 2022


El divendres, 30 de desembre de 2022, a les 16:14:02 (CET), Robin Atwood va 
escriure:
> I have a current Gentoo system with Qt5.15 and KDE 5.26 and I have just
> rebuilt some RYO apps I originally wrote back in 2010 and updated to
> KF5 in 2018. The affected apps use a QTreeWidget and highlight various
> rows using QTreeWidgetItem::setForeground. This has always worked
> until I rebuilt the apps with current Qt/KF5 libraries. Now the
> setForeground still gets called correctly but has no effect. A bit of
> searching revealed that foreground/background functions are disabled if
> a Qt stylesheet is in use. My code doesn't call any setStyleSheet
> functions and using a Qt sample (https://forum.qt.io/topic/131729) I
> get the expected behaviour: the functions work until you call
> setStyleSheet. But the functions never work with my KF5 apps. I assume
> that KF5 theming (or some such) is using style sheets? I checked with
> qtconfig and that has none set. I have tried calling
> QTreeWidget::setStyleSheet("") but that has no effect.
> So how do I get row highlighting working with the latest KF5?

Can we get an example that we can build and test?

Cheers,
  Albert

> 
> TIA
> Robin






More information about the kde-devel mailing list