- 
    Bug 
- 
    Resolution: Won't Do
- 
    P2: Important 
- 
    None
- 
    6.5
- 
    None
- 
    macos Qt 6
On macOS, if you switch from dark to light or light to dark mode while a Qt app is open and that app loads a qss stylesheet and uses QDockWidgets, the titlebar of the QDockWidgets never get properly updated.
This only happens when the app loads a stylesheet.
I have created a standalone test case from your official dockwidgets example.
It uses qmake to build.
unzip dockwidget_bug.zip
cd dockwidget_bug
qmake
make
open ./dockwidgets.app
When open, simply go to macOS System Settings Appearance and change light to dark mode or visa-versa.
You will see the QDockwidget titlebars are not properly repainted.
The only way around this I have found is to use something like the following in the QDockWidget subclass to override the paintEvent and force the titlebar to be painted properly:
```
void BookBrowser::paintEvent(QPaintEvent *event)
{
    QStylePainter painter(this);
    if (isFloating()) {
        QStyleOptionFrame options;
        options.initFrom(this);
#ifdef Q_OS_MAC
        // This is needed for Qt6 but works on Qt5 as well
        options.palette = QApplication::palette();
#endif
        painter.drawPrimitive(QStyle::PE_FrameDockWidget, options);
    }
    QStyleOptionDockWidget options;
    initStyleOption(&options);
    options.title = windowTitle();
#ifdef Q_OS_MAC
    // This is needed for Qt6 but works on Qt5 as well
    options.palette = QApplication::palette();
#endif
    painter.drawControl(QStyle::CE_DockWidgetTitle, options);
}
```