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

coroberti . coroberti at gmail.com
Fri Dec 21 08:26:29 CET 2018


On Thu, Dec 20, 2018 at 9:33 PM Mike Krus <mike.krus at kdab.com> wrote:

> 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 . <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?
>
>
Hi Mike,
Thank you for your reply and the proposed direction.

It looks like what's left for me is to explore how to figure out from
QPalette mapping to the standard themes.

BRGS,
Robert
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20181221/df4cb620/attachment.html>


More information about the Interest mailing list