Brno Hat

Jiri Eischmann's Blog

Dark Adwaita and HighContrast Themes for Qt

One of our goals for Fedora Workstation is to run Qt applications in GNOME as seamlessly as possible. Their look should be as close to their GTK+ counterparts as possible, you shouldn’t have to set things on two different places just to make the change in both GTK+ and Qt applications.

A while back, we introduced the Adwaita theme for Qt and QGnomePlatform which makes sure all settings get translated from the GTK+ world to the Qt one. The original Adwaita theme was written from scratch. To write a theme for Qt is pretty complex and the look of Adwaita for Qt was close to Adwaita for GTK+, but not close enough. Then Martin Bříza, who is working on this, decided to change the approach and based the new version on the default KDE theme and kept changing it until he got a theme that is very similar to Adwaita for GTK+. And indeed it’s now much closer than the first version.

Martin also worked on the dark variant of Adwaita for Qt, so that if you switch to this variant, Qt apps still don’t look out of place. Or if there is a Qt app that uses a dark theme it can have a look that fits into GNOME.

Martin didn’t stop there. GNOME also offers a high contrast theme for those with visual impairment which prevents them from using standard themes. They’re also not left behind. If you switch to the HighContrast theme in GNOME Qt apps will switch to it, too.

On the video below, you can see a mix of Qt and GTK+ apps and how they change when you switch between different themes:

[youtube https://www.youtube.com/watch?v=sZ9vcHVoyEA&w=560&h=315]

These changes should land in Fedora 26 Workstation, but you can already try them out. Martin created a Copr repository. Keep in mind it’s work in progress. If you’d like to report bugs or help with tuning the themes, all the code is on Github.

5 responses to “Dark Adwaita and HighContrast Themes for Qt”

  1. st (@habloconminas) Avatar

    Wouldn’t porting QGtkStyle to GTK+ 3 be a more effective approach? Then QT would blend with any GTK+ theme.

    1. Martin Bříza Avatar
      Martin Bříza

      Considering how QGtkStyle works (by loading the dynamic library and looking for functions by their name) and how stable are the GTK releases, it’s possible to write such a theme, although it wouldn’t be functional for very long. On every next GTK update, it would break.
      I know there’s GTK4 now but then it’d be the same story, you’d either have an obsolete GTK3-based theme or a GTK4-based one which breaks every half a year. I chose having to update the look itself manually over risking crashes periodically.

      1. st (@habloconminas) Avatar

        Won’t there be stable GTK+ versions?

  2. […] of mine from Red Hat so if you meet him in person somewhere buy him a beer for that he cares about Qt integration in Gnome :). Now coming to a question how to install this and make it work. Basically all you need to do is […]

  3. […] of mine from Red Hat so if you meet him in person somewhere buy him a beer for that he cares about Qt integration in Gnome :). Now coming to a question how to install this and make it work. Basically all you need to do is […]

Leave a Reply

Your email address will not be published. Required fields are marked *