LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   GTK+ vs. Qt (https://www.linuxquestions.org/questions/programming-9/gtk-vs-qt-820783/)

MTK358 07-19-2010 03:34 PM

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?

dugan 07-19-2010 03:35 PM

Quote:

Originally Posted by MTK358 (Post 4038535)
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.

MTK358 07-19-2010 03:47 PM

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/

dugan 07-19-2010 03:57 PM

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.

Sergei Steshenko 07-19-2010 04:26 PM

Quote:

Originally Posted by MTK358 (Post 4038535)
...
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/ .

Sergei Steshenko 07-19-2010 04:27 PM

Quote:

Originally Posted by dugan (Post 4038537)
Are you sure about this?



That should be the deciding factor. Maintainability should always be one of your top priorities.
...

Yes.

Sergei Steshenko 07-19-2010 06:06 PM

Quote:

Originally Posted by MTK358 (Post 4038535)
...
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.

exvor 07-19-2010 06:59 PM

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.

Kenny_Strawn 07-19-2010 07:04 PM

Quote:

Originally Posted by dugan (Post 4038537)
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

MTK358 07-19-2010 07:25 PM

Quote:

Originally Posted by exvor (Post 4038759)
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.

Sergei Steshenko 07-19-2010 07:31 PM

Quote:

Originally Posted by exvor (Post 4038759)
...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 ?

MTK358 07-19-2010 07:36 PM

Quote:

Originally Posted by Sergei Steshenko (Post 4038797)
Do you know that, for example. gtk+ depends on 'openssl' ? And on 'pcre' ?

Really? Why would it?

Sergei Steshenko 07-19-2010 07:41 PM

Quote:

Originally Posted by MTK358 (Post 4038802)
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.

dugan 07-19-2010 07:50 PM

Quote:

Originally Posted by Kenny_Strawn (Post 4038771)
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."

Tinkster 07-19-2010 08:30 PM

Quote:

Originally Posted by exvor (Post 4038759)
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?


All times are GMT -5. The time now is 06:44 AM.