Hi

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,

Mike

> On 20 Dec 2018, at 18:48, coroberti . <corobe...@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@qt-project.org
> https://lists.qt-project.org/listinfo/interest

--
Mike Krus | mike.k...@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

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

Reply via email to