LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-19-2010, 03:34 PM   #1
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723
Thumbs up GTK+ vs. Qt


I seriously started to wonder, which is better to write programs in?

Things I like about Qt:

First of all, is the language. GTK+ is in C, with this strange object-oriented system, and all the methods have such long, redundant names. Qt is written in an OO language, so it avoids this completaly.

Also, when learning how to use them I found that Qt code is cleaner and seems easier to work with, while GTK+ seems a bit messy, probably as a side effect of it's OO C code.

Qt itself doesn't seem to be strongly tied to a certain desktop environment (even though it's use is often associated with KDE), while GTK+ is developed as part of GNOME. Will GTK+ ever become somehow GNOME-biased?

Qt has signals and slots, I think it's a nice system. GTK+ uses callbacks.

Things I like about GTK+:

GTK+ is far more popular than Qt, and seems to be more customizable and have more themes.

I was always under the impression that GTK+ is more "FOSS-oriented" than Qt. AFAIK GTK+ is open-source all the way, while Qt was proprietary and was forced to be put under a FOSS license just because KDE used it. It just seems to have more of a "open-source hacker" that "big corporation" feel

It's just a plain, small GUI toolkit.

It has Perl bindings. I wasn't able to find a full, popular, supported Perl Qt4 binding.

Anyway, I wonder if any of my ideas above are wrong, and what should I probably use?

Last edited by MTK358; 07-19-2010 at 03:35 PM.
 
Old 07-19-2010, 03:35 PM   #2
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,219

Rep: Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309
Quote:
Originally Posted by MTK358 View Post
GTK+ is developed as part of GNOME.
Are you sure about this?

Quote:
I found that Qt code is cleaner and seems easier to work with
That should be the deciding factor. Maintainability should always be one of your top priorities.

Choosing a toolkit that you enjoy using less, for silly reasons such as a) it being used by projects you're not involved in, or b) the way its license was written before it was changed ten years ago, is not something you do unless someone forces you to.

Last edited by dugan; 07-19-2010 at 03:54 PM.
 
Old 07-19-2010, 03:47 PM   #3
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443

Original Poster
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723
A lot of GTK+ development info is on GNOME's website, also this thread worries me somewhat:

http://www.linuxquestions.org/questi...-3-0-a-820085/
 
Old 07-19-2010, 03:57 PM   #4
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,219

Rep: Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309
It's too early to start worrying about GTK 3. When you use any library at all, you always take the risk that a new version will contain API changes that will break your existing work. You deal with that when it happens.

Last edited by dugan; 07-19-2010 at 04:00 PM.
 
Old 07-19-2010, 04:26 PM   #5
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by MTK358 View Post
...
GTK+ is far more popular than Qt, and seems to be more customizable and have more themes.
...
I don't think gtk+ has more themes - visit http://kde-look.org/ .
 
Old 07-19-2010, 04:27 PM   #6
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by dugan View Post
Are you sure about this?



That should be the deciding factor. Maintainability should always be one of your top priorities.
...
Yes.
 
Old 07-19-2010, 06:06 PM   #7
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by MTK358 View Post
...
It has Perl bindings. I wasn't able to find a full, popular, supported Perl Qt4 binding.
...
That's exactly the sad reason I have to use gtk+ rather than Qt.
 
Old 07-19-2010, 06:59 PM   #8
exvor
Senior Member
 
Registered: Jul 2004
Location: Phoenix, Arizona
Distribution: Gentoo, LFS, Debian,Ubuntu
Posts: 1,537

Rep: Reputation: 87
One of the main issues with QT is that you have to have almost all of KDE installed to be able to use programs with it. GTK is not this way, many of the programs do not require you to have most of GNOME installed. I am able to write a GTK program that only requires gtk+ cairo and maybe 2 other libraries installed. Of course I am looking at this from a LFS or compiled source point of view and not a distro point of view. Last time I attempted to install qt from source it was a bit of a nightmare so I have yet to try and install it again. This is why I cannot run QT programs.

BTW I don't use gnome either as it is a nightmare of dependencies so I only install what is minimally required to get gtk programs to function. I will also admit I have only written small programs in GTK and have no experience with writing qt programs at all.
 
Old 07-19-2010, 07:04 PM   #9
Kenny_Strawn
Senior Member
 
Registered: Feb 2010
Location: /usa/ca/orange_county/lake_forest
Distribution: ArchBang, Google Android 2.1 + Motoblur (on Motortola Flipside), Google Chrome OS (on Cr-48)
Posts: 1,791
Blog Entries: 62

Rep: Reputation: 56
Quote:
Originally Posted by dugan View Post
Are you sure about this?
Code:
git clone git://git.gnome.org/gtk+
This is ultimately where you would download GTK+ to develop it, and it's on the GNOME website!

Please note that there is a gtk3 branch already:

Code:
git clone git://git.gnome.org/gtk+ gtk3
GTK+ currently is at its 2.90 version, a.k.a. GTK3 Beta.

For more information:

http://live.gnome.org/TwoPointThirtyone

http://live.gnome.org/GTK%2B/Roadmap

Last edited by Kenny_Strawn; 07-19-2010 at 07:06 PM.
 
Old 07-19-2010, 07:25 PM   #10
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443

Original Poster
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723
Quote:
Originally Posted by exvor View Post
One of the main issues with QT is that you have to have almost all of KDE installed to be able to use programs with it. GTK is not this way, many of the programs do not require you to have most of GNOME installed.
That's because most Qt programs use KDE libs.

You can write a Qt app that doesn't rely on KDE just as easy as you can write a GTK+ app that doesn't rely on GNOME.
 
Old 07-19-2010, 07:31 PM   #11
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by exvor View Post
...I am able to write a GTK program that only requires gtk+ cairo and maybe 2 other libraries installed. ...
Well, it depends on how you interpret "couple".

Do you know that, for example. gtk+ depends on 'openssl' ? And on 'pcre' ?

Should I continue ?
 
Old 07-19-2010, 07:36 PM   #12
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443

Original Poster
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723
Quote:
Originally Posted by Sergei Steshenko View Post
Do you know that, for example. gtk+ depends on 'openssl' ? And on 'pcre' ?
Really? Why would it?
 
Old 07-19-2010, 07:41 PM   #13
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by MTK358 View Post
Really? Why would it?
See the "unrolled" dependency tree:

Code:
$scalar_path=gtk+
$scalar_path=gtk+ -> atk
$scalar_path=gtk+ -> atk -> glib
$scalar_path=gtk+ -> atk -> glib -> gettext
$scalar_path=gtk+ -> atk -> glib -> gettext -> libiconv_pre
$scalar_path=gtk+ -> atk -> glib -> gettext -> libiconv_pre -> libtool
$scalar_path=gtk+ -> atk -> glib -> gettext -> libiconv_pre -> libtool -> automake
$scalar_path=gtk+ -> atk -> glib -> gettext -> libiconv_pre -> libtool -> automake -> autoconf
$scalar_path=gtk+ -> atk -> glib -> gettext -> libiconv_pre -> libtool -> automake -> autoconf -> texinfo
$scalar_path=gtk+ -> atk -> glib -> libiconv
$scalar_path=gtk+ -> atk -> glib -> libiconv -> gettext
$scalar_path=gtk+ -> atk -> glib -> libiconv -> gettext -> libiconv_pre
$scalar_path=gtk+ -> atk -> glib -> libiconv -> gettext -> libiconv_pre -> libtool
$scalar_path=gtk+ -> atk -> glib -> libiconv -> gettext -> libiconv_pre -> libtool -> automake
$scalar_path=gtk+ -> atk -> glib -> libiconv -> gettext -> libiconv_pre -> libtool -> automake -> autoconf
$scalar_path=gtk+ -> atk -> glib -> libiconv -> gettext -> libiconv_pre -> libtool -> automake -> autoconf -> texinfo
$scalar_path=gtk+ -> atk -> glib -> pcre
$scalar_path=gtk+ -> atk -> glib -> pcre -> readline
$scalar_path=gtk+ -> cairo
$scalar_path=gtk+ -> cairo -> fontconfig
$scalar_path=gtk+ -> cairo -> fontconfig -> freetype
$scalar_path=gtk+ -> cairo -> libpng
$scalar_path=gtk+ -> cups
$scalar_path=gtk+ -> cups -> libjpeg
$scalar_path=gtk+ -> cups -> libjpeg -> libtool
$scalar_path=gtk+ -> cups -> libjpeg -> libtool -> automake
$scalar_path=gtk+ -> cups -> libjpeg -> libtool -> automake -> autoconf
$scalar_path=gtk+ -> cups -> libjpeg -> libtool -> automake -> autoconf -> texinfo
$scalar_path=gtk+ -> cups -> libpng
$scalar_path=gtk+ -> cups -> libtiff
$scalar_path=gtk+ -> cups -> libtiff -> libjpeg
$scalar_path=gtk+ -> cups -> libtiff -> libjpeg -> libtool
$scalar_path=gtk+ -> cups -> libtiff -> libjpeg -> libtool -> automake
$scalar_path=gtk+ -> cups -> libtiff -> libjpeg -> libtool -> automake -> autoconf
$scalar_path=gtk+ -> cups -> libtiff -> libjpeg -> libtool -> automake -> autoconf -> texinfo
$scalar_path=gtk+ -> cups -> openssl
$scalar_path=gtk+ -> cups -> openssl -> bc
$scalar_path=gtk+ -> cups -> openssl -> bc -> flex
$scalar_path=gtk+ -> cups -> openssl -> bc -> flex -> bison
$scalar_path=gtk+ -> jasper
$scalar_path=gtk+ -> jasper -> libjpeg
$scalar_path=gtk+ -> jasper -> libjpeg -> libtool
$scalar_path=gtk+ -> jasper -> libjpeg -> libtool -> automake
$scalar_path=gtk+ -> jasper -> libjpeg -> libtool -> automake -> autoconf
$scalar_path=gtk+ -> jasper -> libjpeg -> libtool -> automake -> autoconf -> texinfo
$scalar_path=gtk+ -> libjpeg
$scalar_path=gtk+ -> libjpeg -> libtool
$scalar_path=gtk+ -> libjpeg -> libtool -> automake
$scalar_path=gtk+ -> libjpeg -> libtool -> automake -> autoconf
$scalar_path=gtk+ -> libjpeg -> libtool -> automake -> autoconf -> texinfo
$scalar_path=gtk+ -> libtiff
$scalar_path=gtk+ -> libtiff -> libjpeg
$scalar_path=gtk+ -> libtiff -> libjpeg -> libtool
$scalar_path=gtk+ -> libtiff -> libjpeg -> libtool -> automake
$scalar_path=gtk+ -> libtiff -> libjpeg -> libtool -> automake -> autoconf
$scalar_path=gtk+ -> libtiff -> libjpeg -> libtool -> automake -> autoconf -> texinfo
$scalar_path=gtk+ -> pango
$scalar_path=gtk+ -> pango -> cairo
$scalar_path=gtk+ -> pango -> cairo -> fontconfig
$scalar_path=gtk+ -> pango -> cairo -> fontconfig -> freetype
$scalar_path=gtk+ -> pango -> cairo -> libpng
$scalar_path=gtk+ -> pango -> glib
$scalar_path=gtk+ -> pango -> glib -> gettext
$scalar_path=gtk+ -> pango -> glib -> gettext -> libiconv_pre
$scalar_path=gtk+ -> pango -> glib -> gettext -> libiconv_pre -> libtool
$scalar_path=gtk+ -> pango -> glib -> gettext -> libiconv_pre -> libtool -> automake
$scalar_path=gtk+ -> pango -> glib -> gettext -> libiconv_pre -> libtool -> automake -> autoconf
$scalar_path=gtk+ -> pango -> glib -> gettext -> libiconv_pre -> libtool -> automake -> autoconf -> texinfo
$scalar_path=gtk+ -> pango -> glib -> libiconv
$scalar_path=gtk+ -> pango -> glib -> libiconv -> gettext
$scalar_path=gtk+ -> pango -> glib -> libiconv -> gettext -> libiconv_pre
$scalar_path=gtk+ -> pango -> glib -> libiconv -> gettext -> libiconv_pre -> libtool
$scalar_path=gtk+ -> pango -> glib -> libiconv -> gettext -> libiconv_pre -> libtool -> automake
$scalar_path=gtk+ -> pango -> glib -> libiconv -> gettext -> libiconv_pre -> libtool -> automake -> autoconf
$scalar_path=gtk+ -> pango -> glib -> libiconv -> gettext -> libiconv_pre -> libtool -> automake -> autoconf -> texinfo
$scalar_path=gtk+ -> pango -> glib -> pcre
$scalar_path=gtk+ -> pango -> glib -> pcre -> readline
I've been building gtk+ automatically since 2006.
 
Old 07-19-2010, 07:50 PM   #14
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,219

Rep: Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309
Quote:
Originally Posted by Kenny_Strawn View Post
This is ultimately where you would download GTK+ to develop it, and it's on the GNOME website!
The GNOME project's repository is also hosting GIMP, and GIMP is not "developed as part of GNOME."

Last edited by dugan; 07-19-2010 at 08:20 PM.
 
Old 07-19-2010, 08:30 PM   #15
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Quote:
Originally Posted by exvor View Post
One of the main issues with QT is that you have to have almost all of KDE installed to be able to use programs with it.
Where did that one come from?

On Slackware64 13.1 no part of Qt is linked against
any KDE libraries. Why would I need "almost all of
KDE installed" to use any program?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Inhibit GTK verbose messages when running GTK/Gnome applications from terminal d1s4st3r Linux - Software 1 11-10-2009 10:33 PM
gtk-qt-engine causes white border on gtk tray icons tdtooke Linux - Desktop 0 08-08-2008 12:25 PM
GTK+ programs on Windows without having to install GTK+, GLib, etc Nylex Programming 2 02-19-2006 01:33 PM
Freerock uninstall stole GTK looking for up-to-date pango, atk, gtk, glib and xft tgz Oholiab Slackware 8 09-18-2005 11:57 AM
cant find gtk-config file or gtk-devel to install happychappy Linux - Software 2 02-16-2005 12:46 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:31 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration