Sigil-Ebook / Sigil

Sigil is a multi-platform EPUB ebook editor
GNU General Public License v3.0
5.97k stars 578 forks source link

[Bug]: Qt 6.6.2 all TreeView related widgets no longer autoconvert to dark mode on macOS #751

Closed kevinhendricks closed 7 months ago

kevinhendricks commented 7 months ago

Bug Description

Start Sigil in Light mode then switch to dark (or visa-versa). All TreeView related widgets do not take on the dark theme properties.

This is a Qt bug (as this used to work with earlier Qts) but one that will need a workaround from our (Sigil) end.

Platform (OS)

macOS

OS Version / Specifics

Qt 6.6.2

What version of Sigil are you using?

2.1.0

Any backtraces or crash reports

NA
kevinhendricks commented 7 months ago

This impacts BookBrowser, Clips Window, Validation Window, Table of Contents, and All of the Reports widgets, the MetaDataEditor, and etc.

Pretty much a horrible experience.

dougmassay commented 7 months ago

Do you have a patch, or do we have to com up with our own solution?

kevinhendricks commented 7 months ago

I have added in a bunch of changes to handle this now. I could not find a bug report in Qtbugs that matched it. Unfortunately, Qt changed things so that it is a really bad idea to try to ever set a Palette for the main application (similar to the changes you made). That handled most of the issues. The final step is that none of the QDockWidget title bars ever changed when all of the rest of them did. But this is specific to macOS.

I did notice to Preview (a QDockWidget) did not have this problem, and it turned out that was because of the paintEvent that allowed us to use different titles when tabbed vs when floating. Given we can for tab any of the QDockWidgets (or float them), I had to implement that code in ClipsWindow, BookBrowser, ValidationResultsView, TableOfContents, etc, and now it all apears to work just fine.

Since it all works in a cross platform manner in Preview it should also work just fine in the other QDockWidgets.

Hopefully that is the last change needed to support dark mode to light shifting and back when Sigil is open.

So I am going to close this.

kevinhendricks commented 7 months ago

For the record I generated the following bug report at Qt for this:

https://bugreports.qt.io/browse/QTBUG-124268