Install Qgtkstyle

Since I haven’t found any proper debs of qgtkstyle around, I’m just going to tell how to compile it from source.

If you don’t know what Qgtkstyle is, Qgtkstyle is a Qt theme engine that uses your GTK theme directly.

First thing to do is to enable the Backports repository since you need Qt 4.4 which is in the Backports in Hardy.  You can do this by going System→Administration→Software Sources, then going to the Updates tab and enabling the “Unsupported updates (hardy-backports)” repository.

Software Sources
Software Sources

Click Close and then click the Reload button when prompted.  Now to install all the development packages needed to compile Qgtkstyle.

sudo apt-get install build-essential libqt4-dev libgtk2.0-dev subversion qt4-qtconfig

This is optional if you want to install with Checkinstall

sudo apt-get install checkinstall

Now to get the code

svn co svn://labs.trolltech.com/svn/styles/gtkstyle

There should be a folder in your home directory called gtkstyle. Now enter that directory

cd gtkstyle/

Now compile it

qmake qgtkstyle.pro

Now here you have a choice. You can either just install it directly with

sudo make install

Or you may like to build a deb out of it for easy removal later if need be.  In that case do

sudo checkinstall

and follow the instructions.  They’re pretty self explanitory.

Now if you go under System→Preferences→Qt 4 Settings you can choose GTK from the drop down menu.

Qt 4 Settings
Qt 4 Settings

Then do a File→Save and enjoy Qt applications with a nice GTK integration. 🙂

Also if you want to see a little Easter Egg move that preview window around. Yes you can actually move that. I won’t spoile the surprise. It gave me a little laugh when I first found it. 😉

16 thoughts on “Install Qgtkstyle”

  1. Hmm. I just check to see and it worked fine here. Are you sure you have all the development packages installed and the Backports enabled? If so then maybe try deleting the gtkstyle directory and re-check out the code again.

  2. zmjjmz: you are using qmake from qt-3. Make sure you have Qt 4.4 installed. You might have to call “qmake-qt4” instead of just “qmake”.

  3. Ok, using qmake-qt4 worked, but it when I try to compile it either through make or sudo make install, I get a load of errors.
    In file included from main.cpp:24:
    qgtkstyle.h:35: error: expected constructor, destructor, or type conversion before ‘typedef’
    In file included from /usr/include/qt4/QtCore/qplugin.h:48,
    from /usr/include/qt4/QtGui/qstyleplugin.h:47,
    from /usr/include/qt4/QtGui/QStylePlugin:1,
    from main.cpp:25:
    /usr/include/qt4/QtCore/qpointer.h:51: error: expected constructor, destructor, or type conversion before ‘typedef’
    make: *** [main.o] Error 1

    Should I edit the source code in order to prevent this from happening? Is there anything I can do?

  4. My best guess is that you are using Qt 4.3 at the moment. Try to run “qmake-qt4 –version” and see what that returns.

  5. Yeah, it’s 4.3.4, in the Ubuntu repos.
    I don’t think this is worth compiling Qt, but I understand that I won’t be able to do it until an update rolls along.

  6. The Qt that comes with Hardy is too old. However 4.4 is in the Backports.
    libqt4-core:
    Installed: 4.4.0-1ubuntu5~hardy1
    Candidate: 4.4.0-1ubuntu5~hardy1
    Version table:
    *** 4.4.0-1ubuntu5~hardy1 0
    500 http://us.archive.ubuntu.com hardy-backports/main Packages
    100 /var/lib/dpkg/status
    4.3.4-0ubuntu3 0
    500 http://us.archive.ubuntu.com hardy/main Packages

  7. Hi, great tip! Thanks for share it 🙂

    I installed it, all fine, but when i turn to GTK on QT4 Config, it gets a strange font with weird symbols, someone know how to fix it please?

  8. Hi again, i solved the problem.
    It was just a problem of compatibility with the Dingbats font i was using, i switched it to Bitstream Vera Sans on the system fonts and QT4 Config and all works fine now.

Leave a reply to kernel_script Cancel reply