How can I theme my Qt app to resemble one written in Gtk?

10,866

Solution 1

Note: this is useful to desktop users, not to developers using Qt.

sudo apt-get install qt4-qtconfig, then go to System / Preferences / Qt 4 settings and select GTK style in the first combobox:

Qt Configuration dialog

Solution 2

Qt apps don't follow the font hinting settings that are set by gnome-appearance-properties. You need to explicitly add an entry to $HOME/.fonts.conf e.g.

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
 <match target="font" >
  <edit mode="assign" name="rgba" >
   <const>rgb</const>
  </edit>
 </match>
 <match target="font" >
  <edit mode="assign" name="hinting" >
   <bool>true</bool>
  </edit>
 </match>
 <match target="font" >
  <edit mode="assign" name="hintstyle" >
   <const>hintfull</const>
  </edit>
 </match>
</fontconfig>

Solution 3

From nagul's SU post https://superuser.com/questions/37444/how-can-i-make-kde-and-other-non-gnome-apps-inherit-the-ubuntu-theme - direct quote:

Check QGtkStyle, a project to create a GTK+ layer for Qt-based applications (like KDE) running on GTK2-based desktops (like Gnome).

There are other ideas and scripts in the discussion on this topic at Ubuntu Brainstorm: Idea #1744: GNOME themes should affect Qt themes, and more of them in this discussion Idea #1714: GNOME QT integration (and the numerous duplicate ideas gathered under this question).

One of the noteworthy attempts is UniformUI, which attempts to automate configuration of Qt settings to match the current Gtk+ style, partially using QtCurve and QGtkStyle to achieve this.

Fourth google result for "skin qt to match gtk"

Share:
10,866

Related videos on Youtube

David Planella
Author by

David Planella

I work at GitLab as Director of Community Relations. Before, I worked for Canonical as the former Ubuntu Community Team Manager. As an Open Source contributor, I am mostly involved in app development and localization: I'm the developer of Qreator, former lead the Ubuntu Catalan Translators team and also a GNOME translator. In the past I've contributed to other projects, such as Debian or Mozilla. Blog Google+ Twitter

Updated on September 17, 2022

Comments

  • David Planella
    David Planella over 1 year

    Mark Shuttleworth recently blogged about the decision to include the Qt libraries in the 11.10 release, with a followup from Jono Bacon. The thing that puts me off Qt apps is that they don't blend in very well with Ubuntu's Gtk-based theme. I recently read an Ars Technica article that mentioned that, with a bit of effort, Qt apps could be make to resemble Gtk apps.

    Is there any documentation that will help me do this, and if not, does anyone at least have any idea how one would go about doing this?

  • Lincity
    Lincity about 13 years
    this is already default since lucid .
  • Mandy
    Mandy over 12 years
    Is there a way to do this that works with GTK3?
  • Forty-Two
    Forty-Two almost 12 years
    This is great except it does nothing to change the icons that the qt apps use. For example, dolphin uses some really ugly icons running on ubuntu unity
  • 71GA
    71GA over 11 years
    It looks like qgtkstyle isn't available anymore on the link you provided. And as i searched for it, i couldn't find it anywhere.
  • RobotHumans
    RobotHumans over 11 years
    @71GA See this: code.google.com/p/qgtkstyle