Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Qt or Gtk? (from an Ada perspective)

1,190 views
Skip to first unread message

alb...@gmail.com

unread,
Sep 17, 2012, 7:34:41 AM9/17/12
to
Which of the two is better supported in Ada, Qt or Gtk?

Also, which of the two is easier to use? (for a beginner)

Note: what I actually need to use is a very small subset of the functionality offered by these toolkits, in that I will only use some basic GUI functions like text edit boxes, as well as file I/O and text processing. But not much beyond that.

Thanks in advance

Alby

Patrick

unread,
Sep 17, 2012, 8:55:27 AM9/17/12
to
I hope I don't upset anyone with this...

I am new to Ada and don't really know anything....

but I would recommend coding in the native API and then linking in your Ada code.

Both of these toolkits are huge and mind crushingly complex. If anything goes wrong, documentation and internet posts are pretty much the only way to solve the issue. I don't think there are enough posts for either of the bindings for these toolkits and not enough documentation and examples to learn them well.

If something goes wrong there are mailing list but I suspect you would have to wait for answers rather then looking up posts from peoples previous problems.

-Patrick

alb...@gmail.com

unread,
Sep 17, 2012, 11:41:18 AM9/17/12
to
On Monday, September 17, 2012 2:55:27 PM UTC+2, Patrick wrote:

> Both of these toolkits are huge and mind crushingly complex. If anything goes wrong, documentation and internet posts are pretty much the only way to solve the issue. I don't think there are enough posts for either of the bindings for these toolkits and not enough documentation and examples to learn them well.
>
> If something goes wrong there are mailing list but I suspect you would have to wait for answers rather then looking up posts from peoples previous problems.

That may be so, but unless you are on Windows, I do not see much alternative to Qt/Gtk. As far as I know, most Linux/Unix apps rely on either Qt or Gtk.

QtAda and GtkAda, from the cursory look I gave to them, appear to have been developed to a professional level. But then, as you say, the complexity might crush you. That why I was asking which one is easier to use.





Ludovic Brenta

unread,
Sep 17, 2012, 11:50:52 AM9/17/12
to
On comp.lang.ada:
> QtAda and GtkAda, from the cursory look I gave to them, appear to
> have been developed to a professional level. But then, as you say,
> the complexity might crush you.

Correct and in addition, the Windows API is just as mind-boggingly
complex as either Qt or GtkAda. GUI programming is complex no
matter how you look at it.

> That why I was asking which one is easier to use.

I think there is not much difference between them in terms of "ease of
use", performance or completeness. There is however a big difference
in "ease of installation and deployment": GtkAda is packaged in
Debian, Qt is not. Qt requires C++ in addition to C and Ada, GtkAda
does not.

So, I'd vote for GtkAda.

--
Ludovic Brenta.
Streamlined values influence the sales manager; nevertheless the
community addresses our long-established, emerging, executions.

alb...@gmail.com

unread,
Sep 17, 2012, 11:54:23 AM9/17/12
to
On Monday, September 17, 2012 5:50:52 PM UTC+2, Ludovic Brenta wrote:
> Qt requires C++ in addition to C and Ada, GtkAda
> does not.

Do you mean that the programmer is required to know and use C++ code as well? Or just that in the back-end C++ will be used?

Dmitry A. Kazakov

unread,
Sep 17, 2012, 11:58:49 AM9/17/12
to
On Mon, 17 Sep 2012 08:41:18 -0700 (PDT), alb...@gmail.com wrote:

> That why I was asking which one is easier to use.

To get an answer you would need somebody who extensively used both. I did
only GTK. GTK is not simple by any measure, though I doubt that Qt could be
much better/worse. But that is only a guess.

As for me, I took GTK merely because AdaCore did.

P.S. There are at least two Ada Qt bindings, AFAIK.

--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

J-P. Rosen

unread,
Sep 17, 2012, 12:21:31 PM9/17/12
to
Le 17/09/2012 17:58, Dmitry A. Kazakov a �crit :
> On Mon, 17 Sep 2012 08:41:18 -0700 (PDT), alb...@gmail.com wrote:
>
>> That why I was asking which one is easier to use.
>
> To get an answer you would need somebody who extensively used both. I did
> only GTK. GTK is not simple by any measure, though I doubt that Qt could be
> much better/worse. But that is only a guess.
>
Also, GTK has a GUI builder, Glade. Simple interfaces like the ones you
need can be developed with it. And looking at the generated code is a
good way to start with GTKAda.

Disclaimer: some people on this list hate Glade, but that's how I
started with GTKAda personnally.

--
J-P. Rosen
Adalog
2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX
Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00
http://www.adalog.fr

Dmitry A. Kazakov

unread,
Sep 17, 2012, 12:22:52 PM9/17/12
to
On Mon, 17 Sep 2012 08:50:52 -0700 (PDT), Ludovic Brenta wrote:

> Correct and in addition, the Windows API is just as mind-boggingly
> complex as either Qt or GtkAda.

Windows GDI is much lower level comparing to GTK, but surprisingly simpler
to use, especially because it is natively multi-tasking. Though some things
are simpler with GTK, e.g. containers.

> GUI programming is complex no
> matter how you look at it.

That is because of design faults. There are many contradictory
requirements. Plus, in the case of GTK and Win32, the API become extremely
messy when defined using pure procedural decomposition, which is the only
way to get it in C.

I think that modern languages are immature to deal with GUI programming.
That includes Ada, alas. Typically a GUI is decomposed along multiple axes:
visual containment, events handling, application logic constraints, to name
few. No language supports multiple hierarchies of types needed to describe
such relationships sanely and to reuse the corresponding code.

> So, I'd vote for GtkAda.

That makes two of us. (:-)) But the be honest the choice was quite
arbitrary in my case.

Brian Drummond

unread,
Sep 17, 2012, 4:49:18 PM9/17/12
to
Like some of the other answers, I cannot say which is easier, having only
used GTKAda. However I would have to say that using GTKAda for simple
purposes is not especially difficult.

Just posted this evening is a basic tutorial on using the GTKAda-Builder
tool with Glade...

http://wiki.ada-dk.org/building_gui_with_glade_3

- Brian

Stephen Leake

unread,
Sep 17, 2012, 9:52:14 PM9/17/12
to
alb...@gmail.com writes:

> Which of the two is better supported in Ada, Qt or Gtk?

I think GtkAda is better supported than QtAda; GtkAda is supported by
AdaCore, which provides excellent support. I don't know of a commercial
company offering support for QtAda.

But maybe you meant something else by "support"?

> Also, which of the two is easier to use? (for a beginner)

I seem to be one of the few that has used both.

Neither is "easy" :(.

I liked the widget composition and structured message handling in QtAda
better than the equivalent in GtkAda. But the added complexity to define
all of that pretty much makes up for it.

I'm currently useing GtkAda, simply because it is supported by AdaCore,
and I use their compilers as well.

> Note: what I actually need to use is a very small subset of the
> functionality offered by these toolkits,

That is true for almost any project

--
-- Stephe

Dirk Heinrichs

unread,
Sep 18, 2012, 1:41:31 AM9/18/12
to
Ludovic Brenta wrote:

> GtkAda is packaged in Debian, Qt is not.

BTW: Are there any plans to do this?

Bye...

Dirk
--
Dirk Heinrichs <dirk.he...@altum.de>
Tel: +49 (0)2471 209385 | Mobil: +49 (0)176 34473913
GPG Public Key C2E467BB | Jabber: dirk.he...@altum.de

Thomas Løcke

unread,
Sep 18, 2012, 2:28:26 AM9/18/12
to
Hey Alby,

If you only need a "very small subset", then maybe it is worth
considering going down the AWS (Ada Web Server) and HTML5 route
for your GUI needs? With the more sane Dart [1] language on the
rise, you no longer have to muck about with the horrible beast
called Javascript.

We at AdaHeads are currently building a fairly complicated GUI
application and we've chosen the browser as a carrier for our
program, as all the functionality we require of our GUI can be
delivered just as well by a browser as by the more complicated
and heavy GUI toolkits. Also our program suddenly works on all
platforms: Tablets, smartphones, Windows, Linux and Mac. If the
user can conjure up a browser that suppors WebSockets (Firefox,
Chrome and Opera all do), the application will work.

I'm not saying that a browser and HTML5 can replace Gtk/Qt in
all cases, but for some GUI programs it actually makes a lot of
sense.

Just a thought. :o)

[1] http://www.dartlang.org/

--
Thomas L�cke | tho...@12boo.net | http://12boo.net

Vadim Godunko

unread,
Sep 18, 2012, 2:38:10 AM9/18/12
to
C++ is required to build QtAda, but not to develop Ada applications.

Ludovic Brenta

unread,
Sep 18, 2012, 3:16:38 AM9/18/12
to
Dirk Heinrichs wrote on comp.lang.ada:
> Ludovic Brenta wrote:
>> GtkAda is packaged in Debian, Qt is not.
>
> BTW: Are there any plans to do this?

Not that I know of. As usual, if someone volunteers to do that, they
will find help and support on debia...@lists.debian.org_removethis
and they will become rich and famous :)

In theory, whenever someone plans to make a new package for Debian,
they open a "bug" report to say so. Look for "Ada" on the (long!)
list of "Work-Needing and Prospective Packages" at
http://bugs.debian.org/wnpp to get an idea of what's planned.

--
Ludovic Brenta.
A successful execution drives our dotted lines, while our competent
controls drive the community.

Brian Drummond

unread,
Sep 18, 2012, 4:47:25 AM9/18/12
to
On Mon, 17 Sep 2012 04:34:41 -0700, alb348 wrote:

> Note: what I actually need to use is a very small subset of the
> functionality offered by these toolkits, in that I will only use some
> basic GUI functions like text edit boxes, as well as file I/O and text
> processing. But not much beyond that.

Another option, if your GUI needs are simple enough, might be to build
Zenity command lines in Ada, and run them using System.OS_Lib, capturing
their stdout and return codes.

http://library.gnome.org/users/zenity/stable/

http://rosettacode.org/wiki/Execute_a_system_command

I have used Zenity to "rapid prototype" things in BASH scripts, but it
would be nice to do the actual programming in Ada.

You can test the GUI parts from the command line without compiling
anything. It would certainly be quicker to learn than GTKAda!

- Brian

alb...@gmail.com

unread,
Sep 18, 2012, 5:43:15 AM9/18/12
to
Zenity looks interesting indeed. Only, it does not seem to support text edit boxes (unless I am mistaken), which I really need.


alb...@gmail.com

unread,
Sep 18, 2012, 5:49:33 AM9/18/12
to
> Zenity looks interesting indeed. Only, it does not seem to support text
> edit boxes (unless I am mistaken), which I really need.

I can now confirm it, after checking more thoroughly: no text edit boxes in Zenity. Too bad, because otherwise it would have been perfect for my needs.
I am afraid that for a decent text edit box, the compelled choice will be either Qt or Gtk, after all.


Brian Drummond

unread,
Sep 18, 2012, 6:14:30 AM9/18/12
to
On Tue, 18 Sep 2012 02:49:33 -0700, alb348 wrote:

>> Zenity looks interesting indeed. Only, it does not seem to support text
>> edit boxes (unless I am mistaken), which I really need.
>
> I can now confirm it, after checking more thoroughly: no text edit boxes
> in Zenity. Too bad, because otherwise it would have been perfect for my
> needs.

Did you notice the text-info dialog has an --editable option?

> I am afraid that for a decent text edit box, the compelled choice will
> be either Qt or Gtk, after all.

for short text entry (single string, not necessarily single line)
zenity --entry \
--title="Add new profile" \
--text="Enter name of new profile:" \
--entry-text "NewProfile"

for text from file
zenity --text-info \
--title="Edit Me" \
--editable \
--width=640 \
--height=480 \
--filename=fred.txt

May not be fancy enough but they certainly exist and they work.

- Brian


Brian Drummond

unread,
Sep 18, 2012, 6:29:44 AM9/18/12
to
On Tue, 18 Sep 2012 10:14:30 +0000, Brian Drummond wrote:

Minor correction required:
> for short text entry (single string, not necessarily single line)
> zenity --entry \
> --entry-text "NewProfile"
does appear to be single line only. My apologies.

zenity --text-info --editable
is probably what you want.

- Brian

alb...@gmail.com

unread,
Sep 18, 2012, 7:00:12 AM9/18/12
to
Cool. Thanks a lot, Brian.

Dirk Heinrichs

unread,
Sep 18, 2012, 10:35:52 AM9/18/12
to
Ludovic Brenta wrote:

> Not that I know of. As usual, if someone volunteers to do that, they
> will find help and support on debia...@lists.debian.org_removethis
> and they will become rich and famous :)

As of now, I didn't even succeed in compiling ANY version of QtAda on Debian
:(

tonyg

unread,
Sep 19, 2012, 7:14:18 AM9/19/12
to
My Vote is for gtkada. Make sure you can use the GTKbuilder object so you can decouple layout design and coding.

Rego, P.

unread,
Sep 19, 2012, 12:13:01 PM9/19/12
to
> Note: what I actually need to use is a very small subset of the functionality offered by these toolkits, in that I will only use some basic GUI functions like text edit boxes, as well as file I/O and text processing. But not much beyond that.

Hello Alby,

The John English Window Library (JEWL) can help you to do this. You can make simple GUIs easily with it, just a few lines of code.

Check it out.
http://www.radford.edu/~nokie/classes/320/JEWL/docs/windows.htm
http://www.radford.edu/~nokie/classes/320/JEWL/docs/

Regards

leonid...@gmail.com

unread,
Sep 20, 2012, 11:53:18 AM9/20/12
to
Hi
Try VTKADA and QTADA from http://users1.jabry.com/adastudio/index.html
It's easy. Leonid

J-P. Rosen

unread,
Sep 24, 2012, 1:32:31 AM9/24/12
to
Le 18/09/2012 10:47, Brian Drummond a écrit :
> Another option, if your GUI needs are simple enough, might be to build
> Zenity command lines in Ada, and run them using System.OS_Lib, capturing
> their stdout and return codes.
>
> http://library.gnome.org/users/zenity/stable/
>
> http://rosettacode.org/wiki/Execute_a_system_command
>
> I have used Zenity to "rapid prototype" things in BASH scripts, but it
> would be nice to do the actual programming in Ada.
>
> You can test the GUI parts from the command line without compiling
> anything. It would certainly be quicker to learn than GTKAda!

If you go the way of interpreted languages, you can also use Tcl/TK with
the Tash interface. I used it on an application, and it went quite well.

Patrick

unread,
Sep 24, 2012, 4:07:23 PM9/24/12
to
Hi JP

I am checking out TASH too. It sound like it is a thin/medium binding now due to changes with Tcl/Tk. Did you use it before 8.5 ?

Pascal Obry

unread,
Sep 24, 2012, 4:30:46 PM9/24/12
to Patrick
Patrick,

> I am checking out TASH too. It sound like it is a thin/medium binding
> now due to changes with Tcl/Tk. Did you use it before 8.5 ?

I did use TASH well before Tk/Tcl 8.5... Don't remember the exact
version though...

Pascal.

--

--|------------------------------------------------------
--| Pascal Obry Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--| http://www.obry.net - http://v2p.fr.eu.org
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver keys.gnupg.net --recv-key F949BD3B

J-P. Rosen

unread,
Sep 24, 2012, 4:42:18 PM9/24/12
to
Le 24/09/2012 22:07, Patrick a écrit :
> Hi JP
>
> I am checking out TASH too. It sound like it is a thin/medium binding now due to changes with Tcl/Tk. Did you use it before 8.5 ?
>
I've been using it for years, and I don't remember what the version was
when I started... I had some difficulties with installation (especially
since I use it in a multi-tasking environment), but once it was
installed, it worked very well.

Simon Wright

unread,
Sep 24, 2012, 5:11:57 PM9/24/12
to
(pardon me for butting in)

I don't believe there's much, if anything, in the TASH.* hierarchy that
isn't supported either by Ada2005 (Arrays, Lists, Strings) or by GNAT
extensions (File, Regexp, Platform, System).

For those with only a passing interest -- these Tcl features were made
private at Tcl 8.5, so it was no longer possible to provide a binding to
them.

Come to that, there's an awful lot of the Tcl binding in TASH that you
really won't need! Write the GUI in Tcl/Tk and provide the minimum
additional commands (exporting of Ada application interfaces to the Tcl
domain) for your needs.

One thing I never got round to doing is working out how to tell the Tcl
side that a variable had changed so as to avoid polling. I have a
feeling this is possible, but I didn't _have_ to do it. Perhaps use
Tcl_SetVar & trace??? (but there will probably be threading issues).

Patrick

unread,
Sep 24, 2012, 6:56:17 PM9/24/12
to
Hi Simon

I was really hoping you would butt in !

Thanks for your feedback
0 new messages