By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,183 Members | 1,134 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,183 IT Pros & Developers. It's quick & easy.

C++ GUI Beginner - Qt or gtkmm?

P: n/a
Hello.
I do not know whether this really is the right group, but I could not
find any group dealing only with GUIs for C++ so here I am.

I am currently deciding which GUI to use in my program. It should be
able to show
- graphs
- contents of textfiles
- images (ppm or whatever)
- radio buttons, etc (user input elements)

Currently I am thinking of Qt or gtkmm. Although in C++ this is new to
me, I programmed a lot in Java using AWT/Swing.

Oh, furthermore, it is intended to be used in OS X as well as Linux.

Which would be the best choice and why?

Thanks a lot
Tim

Jul 29 '06 #1
Share this Question
Share on Google+
24 Replies


P: n/a
I am in the same dilemma. I am also looking for a GUI that makes my
code portable under Windows (That's life). QT seems a better choice
following what I have read on the internet. It seems more professional.
But I would like to get the opinion of somebody who has trie both.

Cheers

Jul 29 '06 #2

P: n/a
I just found out that my university-research-group was using Qt as
well... my decision is made ;)
Christophe Limbrée schrieb:
I am in the same dilemma. I am also looking for a GUI that makes my
code portable under Windows (That's life). QT seems a better choice
following what I have read on the internet. It seems more professional.
But I would like to get the opinion of somebody who has trie both.

Cheers
Jul 29 '06 #3

P: n/a
Hi,

My company selected Qt over gtk mainly because of ease of use and a
moderate designer was available.

I also found qmake pretty helpful.We can use Gdb too for debugging.

One major limitation was multithreading support of Qt library.

One more difference was in the licensing Qt is GPL and gtk was in LGPL.

Geaves
silversurfer2025 wrote:
I just found out that my university-research-group was using Qt as
well... my decision is made ;)
Christophe Limbrée schrieb:
I am in the same dilemma. I am also looking for a GUI that makes my
code portable under Windows (That's life). QT seems a better choice
following what I have read on the internet. It seems more professional.
But I would like to get the opinion of somebody who has trie both.

Cheers
Jul 29 '06 #4

P: n/a
silversurfer2025 wrote:
I am currently deciding which GUI to use in my program. It should be
able to show
- graphs
- contents of textfiles
- images (ppm or whatever)
- radio buttons, etc (user input elements)
I would use Python and its BLT package. That does perfectly awesome,
interactive charts (which I assume you mean by "graphs").
Which would be the best choice and why?
Why would you use C++ for a non-systemic project? A high-end GUI is about
command-and-control, not about the internal drivers and engines. The latter
are already written, in a C language, and you can just re-use them.

--
Phlip
http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!!!
Jul 29 '06 #5

P: n/a

Phlip schrieb:
silversurfer2025 wrote:
I am currently deciding which GUI to use in my program. It should be
able to show
- graphs
- contents of textfiles
- images (ppm or whatever)
- radio buttons, etc (user input elements)

I would use Python and its BLT package. That does perfectly awesome,
interactive charts (which I assume you mean by "graphs").
Which would be the best choice and why?

Why would you use C++ for a non-systemic project? A high-end GUI is about
command-and-control, not about the internal drivers and engines. The latter
are already written, in a C language, and you can just re-use them.
I might have explained it wrong here.. I already wrote quite a big C++
program, which can currently be started, etc using command line. Now I
wanted to add a GUI for the program because of easier usability and
because I could integrate resulting graphs etc..

Thanks everybode, once more you helped me chossing: it is Qt I am going
to use ;)

Greetings
>
--
Phlip
http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!!!
Jul 29 '06 #6

P: n/a
silversurfer2025 wrote:
I might have explained it wrong here.. I already wrote quite a big C++
program, which can currently be started, etc using command line. Now I
wanted to add a GUI for the program because of easier usability and
because I could integrate resulting graphs etc..
I would rather write a trivial amount of code to adapt a C++ back-end to a
Python front-end, than write the GUI in the same language. The slight cost
of the adapting code is much cheaper than the high cost of maintaining a C++
GUI. Specificially, GUIs reqire callbacks, and C++ typically forces these to
use static typing. That slows down programming.
Thanks everybode, once more you helped me chossing: it is Qt I am going
to use ;)
And, yet, you have chosen the GUI with the best call-back system, with
dynamic typing...

--
Phlip
http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!!!
Jul 29 '06 #7

P: n/a
Tim:

Take a look to wxWidgets at http://www.wxwidgets.org/ .

Some features: It's C++, can use STL, good documentation, Win/Linux/Mac
support, multithreading, Doc/View arq., etc.

Regards.
silversurfer2025 wrote:
Hello.
I do not know whether this really is the right group, but I could not
find any group dealing only with GUIs for C++ so here I am.

I am currently deciding which GUI to use in my program. It should be
able to show
- graphs
- contents of textfiles
- images (ppm or whatever)
- radio buttons, etc (user input elements)

Currently I am thinking of Qt or gtkmm. Although in C++ this is new to
me, I programmed a lot in Java using AWT/Swing.

Oh, furthermore, it is intended to be used in OS X as well as Linux.

Which would be the best choice and why?

Thanks a lot
Tim
Jul 29 '06 #8

P: n/a
Well, Did you read the source of that project? That is a very ugly
code, really. The code is portable, yes, but because of a lot of #ifdef
diretives. The wxLocale part hasn't worked fine with me on some
projects.

I recommend gtkmm. And read about glade. The source-code of GTK+ is
very very professional and intelligent.

Forgive my english.

gethostbyname

flagos wrote:
Tim:

Take a look to wxWidgets at http://www.wxwidgets.org/ .

Some features: It's C++, can use STL, good documentation, Win/Linux/Mac
support, multithreading, Doc/View arq., etc.

Regards.

Jul 30 '06 #9

P: n/a
gethostbyname wrote:
Well, Did you read the source of that project? That is a very ugly
code, really. The code is portable, yes, but because of a lot of #ifdef
diretives. The wxLocale part hasn't worked fine with me on some
projects.
All portable code has the #ifdef disease.
I recommend gtkmm. And read about glade. The source-code of GTK+ is
very very professional and intelligent.
Gtk+ is C with dynamic typing. It is evil incarnate.

--
Phlip
http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!!!
Jul 30 '06 #10

P: n/a

<ge***********@gmail.comwrote in message
news:11********************@i42g2000cwa.googlegrou ps.com...
Well, Did you read the source of that project? That is a very ugly
code, really. The code is portable, yes, but because of a lot of #ifdef
diretives. The wxLocale part hasn't worked fine with me on some
projects.

I recommend gtkmm. And read about glade. The source-code of GTK+ is
very very professional and intelligent.
I would recommend Qt. It's well done, well
documented and the support is excellent.

The only down side that I can see is the price of
the commercial licenses or the restrictions of the
open source license (gpl). FWIW, we have several
commercial Qt licenses and are quite happy with
the product and especially the support.

We looked at wxWidgets but as you say, the code
is fairly ugly. Not just the #ifdef stuff but the excessive
use of macros etc.
Jul 30 '06 #11

P: n/a
RKS

Duane Hebert wrote:
<ge***********@gmail.comwrote in message
news:11********************@i42g2000cwa.googlegrou ps.com...
Well, Did you read the source of that project? That is a very ugly
code, really. The code is portable, yes, but because of a lot of #ifdef
diretives. The wxLocale part hasn't worked fine with me on some
projects.

I recommend gtkmm. And read about glade. The source-code of GTK+ is
very very professional and intelligent.

I would recommend Qt. It's well done, well
documented and the support is excellent.

The only down side that I can see is the price of
the commercial licenses or the restrictions of the
open source license (gpl). FWIW, we have several
commercial Qt licenses and are quite happy with
the product and especially the support.

We looked at wxWidgets but as you say, the code
is fairly ugly. Not just the #ifdef stuff but the excessive
use of macros etc.

I would recommend QT over GTK+, simply because its easier to place the
widgets using an user interface like QT designer. I think in GTK+, you
have to write code to make a widget move it to a specific location,
connect signals etc. All of which you can do using QT designer without
typing a line of code.
you can check http://doc.trolltech.com/. You can read more about QT.

Jul 30 '06 #12

P: n/a
But there is a 'designer' for GTK+ too! The glade! The incoming version
3 is fantastic! And you don't need to type nothing because you can load
the interface directly from the xml output files from glade using the
libglade ou libglademm for C++.

"For large projects libglade is recommended over generated C code. You
can keep each window or dialog in a separate XML file, which makes it
more manageable for large projects with multiple developers."

You should try!

About Qt, I never tried because license issues.

Forgive my english.

gethostbyname

RKS wrote:
I would recommend QT over GTK+, simply because its easier to place the
widgets using an user interface like QT designer. I think in GTK+, you
have to write code to make a widget move it to a specific location,
connect signals etc. All of which you can do using QT designer without
typing a line of code.
you can check http://doc.trolltech.com/. You can read more about QT.
Jul 31 '06 #13

P: n/a
Phlip wrote:
gethostbyname wrote:

>>Well, Did you read the source of that project? That is a very ugly
code, really. The code is portable, yes, but because of a lot of #ifdef
diretives. The wxLocale part hasn't worked fine with me on some
projects.


All portable code has the #ifdef disease.
crap
Aug 1 '06 #14

P: n/a
Matt wrote:
crap
Plonk.

Good luck learning how to program.

--
Phlip
http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!!!
Aug 1 '06 #15

P: n/a

silversurfer2025 wrote:
Hello.
I do not know whether this really is the right group, but I could not
find any group dealing only with GUIs for C++ so here I am.

I am currently deciding which GUI to use in my program. It should be
able to show
- graphs
- contents of textfiles
- images (ppm or whatever)
- radio buttons, etc (user input elements)

Currently I am thinking of Qt or gtkmm. Although in C++ this is new to
me, I programmed a lot in Java using AWT/Swing.

Oh, furthermore, it is intended to be used in OS X as well as Linux.

Which would be the best choice and why?
I am not going to say one is better than the other, but I will say what
I think you should use. GTK--. The reason being that Qt adds
extensions to C++ in order to implement signals and slots whereas GTK--
does not. I believe, I do not know, that GTK-- implements signals and
slots with something very much like what you find in boost. So since
you are learning C++ it seems to me that you should use a GUI framework
that uses C++, and just C++, to do its job.

On the other hand, Qt was written in C++ and the way it does things may
be a little more C++y. I haven't studied the C++ gtk wrapper's source
but the Objective-C version was just that, a wrapper, and you couldn't
extend widgets through inheritance. I've never used GTK-- though I was
about to in a hoby project that I never got around to implementing.

Aug 1 '06 #16

P: n/a

ge***********@gmail.com wrote:
About Qt, I never tried because license issues.
What license issues?

Aug 1 '06 #17

P: n/a
It is not under GPL ;-)

gethostbyname
Noah Roberts wrote:
ge***********@gmail.com wrote:
About Qt, I never tried because license issues.

What license issues?
Aug 2 '06 #18

P: n/a

ge***********@gmail.com wrote:
gethostbyname
Noah Roberts wrote:
ge***********@gmail.com wrote:
About Qt, I never tried because license issues.
What license issues?
It is not under GPL ;-)
[top posting fixed]

Really? Guess you better inform trolltech that for the past 10 years
they have been putting the wrong license on their product.

Aug 2 '06 #19

P: n/a
Noah Roberts wrote:
I am not going to say one is better than the other, but I will say what
I think you should use. GTK--. The reason being that Qt adds
extensions to C++ in order to implement signals and slots whereas GTK--
does not.
I am thinking of using Qt. In what sense does Qt extend C++? I don't
think you mean that they are building their own compiler. If Qt
requires its own libraries for signals and slots and if those libraries
are licensed the same as the rest of Qt, then where is the problem?
Maybe those libraries can't coexist with the boost or other libraries?
Maybe you're thinking that supplantation of Qt signals-and-slots code by
the corresponding parts of boost will be problemmatic when/if those
parts of boost become Standard C++?

I hope Trolltech isn't trying to become the Microsoft of Linux (in the
anti-standard, anti-interoperability sense). That would be nasty, and I
don't see how they can, since the main selling point of Qt is
cross-platform utility.
I believe, I do not know, that GTK-- implements signals and
slots with something very much like what you find in boost. So since
you are learning C++ it seems to me that you should use a GUI framework
that uses C++, and just C++, to do its job.
So you're saying in some sense that GTK-- and boost are C++ and that Qt
is not. I guess I am ignorant of the details, but your post generates
FUD (whether justified or not) in prospective GUI developers. Please
clarify.
Aug 3 '06 #20

P: n/a
The Qt is under GPL, I would like mean the LGPL. I forgot the "L".
Sorry, english is not my native language. I forgot the "Lesser" part.

That is a important advantage for GTK+/Gtkmm.

gethostbyname

Noah Roberts wrote:
ge***********@gmail.com wrote:
gethostbyname
Noah Roberts wrote:
ge***********@gmail.com wrote:
>
About Qt, I never tried because license issues.
>
What license issues?
It is not under GPL ;-)

[top posting fixed]

Really? Guess you better inform trolltech that for the past 10 years
they have been putting the wrong license on their product.
Aug 3 '06 #21

P: n/a
Matt wrote:
Noah Roberts wrote:
>I am not going to say one is better than the other, but I will say what
I think you should use. GTK--. The reason being that Qt adds
extensions to C++ in order to implement signals and slots whereas GTK--
does not.

I am thinking of using Qt. In what sense does Qt extend C++? I don't
think you mean that they are building their own compiler.
No and yes (in that order). They have build something they call moc, meta
object compiler which has to run over all Qt Objects before compiling them.
It is however misnamed, since it is a pre-processor, which produces
standard c++ code.

If Qt
requires its own libraries for signals and slots and if those libraries
are licensed the same as the rest of Qt, then where is the problem?
Maybe those libraries can't coexist with the boost or other libraries?
Maybe you're thinking that supplantation of Qt signals-and-slots code by
the corresponding parts of boost will be problemmatic when/if those
parts of boost become Standard C++?
There were some clashes, because Qt uses "signal" and "slot" like a keyword
in their moc, which can of course clash. However both boost and Qt are
aware of this problem, and IIRC have provided workarounds.
>
I hope Trolltech isn't trying to become the Microsoft of Linux (in the
anti-standard, anti-interoperability sense).
Hardly. The moc compiler was a way of providing a weakly typed signal/slot
mechanism with a plain syntax. (in a time where template support was patchy
at best). Now Qt has the same problem as the standard, there is just too
much legacy code out there to radically change the infrastructure. Besides
providing weakly typed signals is difficult. (Whether it is a good idea is
a question for endless academic discussion, since each has their own set of
strengths and weaknesses)
>
>I believe, I do not know, that GTK-- implements signals and
slots with something very much like what you find in boost. So since
you are learning C++ it seems to me that you should use a GUI framework
that uses C++, and just C++, to do its job.
AFAIK both use strong typing for signals. In a way that is more C++, but as
stated above it has its own set of problems.
So you're saying in some sense that GTK-- and boost are C++ and that Qt
is not. I guess I am ignorant of the details, but your post generates
FUD (whether justified or not) in prospective GUI developers. Please
clarify.
The moc compiler from Qt is certainly an addition, and in a way "taints"
the "pure" c++. However it is very well done, and gets in the way very
little.

I've made very good experiences with Qt. The only drawback is that you have
to pay license fees if you are doing closed source development, but you get
great support, too. (Also its seldom needed, since their documentation is
great.)

Regards

Fabio

Aug 3 '06 #22

P: n/a
On Sat, 29 Jul 2006 02:46:05 -0700, silversurfer2025 wrote:
Hello.
I do not know whether this really is the right group, but I could not
find any group dealing only with GUIs for C++ so here I am.

I am currently deciding which GUI to use in my program. It should be
able to show
- graphs
- contents of textfiles
- images (ppm or whatever)
- radio buttons, etc (user input elements)

Currently I am thinking of Qt or gtkmm. Although in C++ this is new to
me, I programmed a lot in Java using AWT/Swing.

Oh, furthermore, it is intended to be used in OS X as well as Linux.

Which would be the best choice and why?

Thanks a lot
Tim

A lot has been said already, and decisions have been made, but
I'll reply anyway.

I've been doing gui programming in C++ for some 5 years. I
did try both qt and gtkmm and I liked both. I did settle on
gtkmm, because I use gnome as my desktop, and I'm trying to
not overload my system with kde libraries (which qt would require).
Had I been using kde, I would have avoided the gnome libraries.
I also liked gtkmm a bit more, because it used the gnu auto tools,
and nothing more, no other specific tools.

But about 2 years ago I also found fltk (fulltick), which I
found MUCH easier to use than either gtkmm and qt, and it's
pure C++ (no wrapper ad gtkmm) nor does it extend C++ (as qt),
and has a gui builder too. At the time, I was already too much
into gtkmm to switch to fltk, but had I been starting GUI
programming now, I'd give fltk a serious try. Otherwise,
just use the kit designed for your desktop.
Aug 3 '06 #23

P: n/a

Fabio Fracassi wrote:
The moc compiler from Qt is certainly an addition, and in a way "taints"
the "pure" c++. However it is very well done, and gets in the way very
little.
Yeah, it's pretty clean. Makes using autoconf and friends more
difficult though. Qt expects you to use qmake and doing otherwise
requires a bunch of files from KDE devel. You can do it, its just more
difficult. I managed it with a program I was developing for Qtopia a
while back.

Looking back at the OP they said "GUI Beginner" and I was assuming
beginner in general. Qt is good, but if a person is just learning C++
I wouldn't do it using a GUI library that adds things to the language;
could get in the way of learning the language itself and that is the
only library that works in that particular way. If the OP is not a
novice C++ developer then it doesn't really matter as they will not
develop assumptions about how the language is supposed to work based on
an extended version of it.

Aug 3 '06 #24

P: n/a
Noah Roberts wrote:
Fabio Fracassi wrote:

>>The moc compiler from Qt is certainly an addition, and in a way "taints"
the "pure" c++. However it is very well done, and gets in the way very
little.


Yeah, it's pretty clean. Makes using autoconf and friends more
difficult though. Qt expects you to use qmake and doing otherwise
requires a bunch of files from KDE devel. You can do it, its just more
difficult. I managed it with a program I was developing for Qtopia a
while back.
If moc and qmake are included with Qt and are under the same licensing,
then does it reduce to the problem(s) related to autoconf and friends?

hy did you not use qmake and moc?
Aug 4 '06 #25

This discussion thread is closed

Replies have been disabled for this discussion.