[Interest] Qt-12 with Dark Theme on MacOS Mojave

Mike Krus mike.krus at kdab.com
Thu Dec 20 20:33:08 CET 2018


I’ve been tracking QEvent::PaletteChange events, like this:

bool MainWindow::event(QEvent *event)
    if (event->type() == QEvent::PaletteChange) {
        QPalette p = palette();
        m_clearColor = p.color(QPalette::Base);
        emit clearColorChanged(m_clearColor);

    return QMainWindow::event(event);

Event gets sent when switching between themes…

Of course, I’m just using the base colour as is, not trying to figure out if it’s light or dark…

Hope this helps,


> On 20 Dec 2018, at 18:48, coroberti . <coroberti at gmail.com> wrote:
> Hi,
> Qt-12 well manages the colors of QWidgets - great job of Qt-developers. Thank you!
> When some background colors are managed by the application,
> how to figure out whether it's Light or Dark theme currently in use?
> Another question is how to get notification about the switch between the themes?
> Thanks in advance!
> Kind regards,
> Robert
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> https://lists.qt-project.org/listinfo/interest

Mike Krus | mike.krus at kdab.com | Senior Software Engineer
KDAB (UK) Ltd., a KDAB Group company
Tel: UK Office +44 1625 809908   Mobile +44 7833 491941
KDAB - The Qt Experts, C++, OpenGL Experts

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4166 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20181220/f230515b/attachment.bin>

More information about the Interest mailing list