GTK-- vs. QT 325
spirality asks: "The company I work for is getting ready to decide on a GUI Toolkit for
our Computational Modeling Toolkit (CoMeT, www.cometsolutions.com). We would like C++ compatibility and ports to various Unices and Win32 platforms. Not supprisingly we've come up with two choices, GTK-- and QT. I've attempted to compare the two by doing alot of web surfing and searching, but I've come up with things that are consistently one or more years old. So, the question I pose is what are the (dis)advatages of GTK-- and QT, and why would I choose one of these toolkits over the other? Overall functionality, momentum for future growth, ease of use, licensing, and pretty much anything else is relevant to our decision." With QT now at version 3.0 and GTK now in the 1.2.x revisions, maybe it's time to give the two libraries some fair comparison and discuss the new features, advantages, and disadvantages of each?
QT seems to rule (Score:2, Interesting)
I'm not experienced, but as a lay-man, I'd have to say go for QT.
Re:QT seems to rule (Score:2, Insightful)
If I had a Mac, I'd port it to that.
Re:QT seems to rule (Score:5, Funny)
Links: (Score:2)
GTK [gtk.org]
QT [trolltech.com]
Post Comment Lameness filter encountered. Post aborted! Reason: Don't use so many caps. It's like YELLING.
More complete list of links: (Score:5, Informative)
GTK:
GTK [gtk.org]
QT:
QT [trolltech.com]
Excellent QT Tutorial [trolltech.com]
wxWindows:
wxWindows [wxwindows.org]
wxPython [wxpython.org]
Mozilla:
Mozilla [mozilla.org]
Cross-platform implementation of COM [mozilla.org]
develop your UI's in an XML dialect called XUL [mozilla.org]
Others:
FLTK [fltk.org]
Fox Toolkit [fox-toolkit.org]
Side-by-side comparison of GUI Toolkits:
The GUI Toolkit and Framework Page [geocities.com]
I needed this list for my own use. Maybe it will be of interest to you.
Qt if you need Win32 (Score:5, Informative)
I actually prefer GTK+ and I think it's a better bet long-term, but I don't think the cross-platform aspect of the library gets much developer attention.
Being cross-platform is a major selling point for commerical Qt users, however, so if you need your apps to work on Windows then it's clearly the way to go.
What about gimp? (Score:2, Interesting)
gimp is THE flagship gtk application, bar none.
Re:What about gimp? (Score:5, Informative)
It exists, but I don't think it's maintained as well. The primary developers don't really care about Win32, so maintaining it is left to a few masochists :-).
Re:What about gimp? (Score:2, Informative)
GTK porting was mainly done by one single person.
I think, there are a few other GTK based apps, which Windows Users would like. But without a stable GTK on Windows?
Bye egghat.
Re:What about gimp? (Score:3, Insightful)
Re:Qt if you need Win32 (Score:4, Insightful)
Absolutely.
One important thing to note about Qt is the fact that it ain't a wrapper around existing GUI APIs. It emulates the different GUIs out there, so it does the drawing itself, avoiding going through some additional API layers. That translates into a fast and responsive GUI.
I tried it on both Windows and Linux using the platform's native GUI and GUIs from other platforms, i.e. the Motif or CDE style on Windows, the Windows style on Linux. It is very convincing and very fast.
When performance matters, I definitely go with Qt.
Watch out for that "non-commercial" license on Windows though. It might not be appropriate for what you are doing. Your company will probably have to acquire a Qt license for Windows.
Re:Qt if you need Win32 (Score:5, Informative)
QT has an easier to program API, is quick to program in, has great documentation, has support, has a huge wealth of existing code examples, and is supported on Windows. GTK is not supported on Windows, and is a one-man port job. Fine for free software like the gimp, but not for a commercial application. Don't save a couple of grand on the GUI toolkit and get yourself a lot more costs in support that you have to provide because of problems.
GTK2 might solve a lot of the problems in the current GTK of course, but I am not qualified to comment about that. And do you really want to program using a just finalised API?
QT just does things right. 'nuff said.
Gtk+ on Win32 is NOT a one-man job (Score:2, Insightful)
Re:Gtk+ on Win32 is NOT a one-man job (Score:2)
Re:Qt if you need Win32 (Score:3, Interesting)
I've worked on two 1 million+ line sourcebases that were cross platform. One used a commercial porting library that was closed source but we had the source license for it. This was a losing proposition. If there was a bug, we could fix it in the library. However, that was a poor long-term solution because we were just patching the library rather than building a long-term cross platform infrastructure for our product.
The second sourcebase I worked on used a home-grown UI abstraction. This one is a lot better because we have the ability to add or remove emulation as we wish. If we have an OS that doesn't support the services we need, we emulatate it. If the OS does support the services we need, we go directly to the OS and gain native look and feel with much less effort.
For this reason, I recommend libraries that
a) Provide a platform-neutral interface
b) Implement the functionality by eventually calling the OS calls required to implement the functionality
c) Is provided in source form so that you basically "own" the library. That way, any changes you make to the library improve your own long term situation.
The only library I've seen that fits that requirement recently is wxWindows but I haven't used it for a real application so I can't comment on its suitability.
Good luck
Re:Qt if you need Win32 (Score:2)
wxWindows (slightly OT) (Score:5, Informative)
Mozilla (slightly OT too) (Score:5, Informative)
An example is the Komodo IDE [activestate.com] by ActiveState, which uses XUL.
XUL [xulplanet.com] is the next generation browser application platform. Simply speaking, the Mozilla [mozilla.org] team chose an approach very similiar to JAVA [sun.com] to come closer to a platform independent graphical user interface:
XUL goes one step farther, as there is no compilation step.
The XUL application implementation language is a XML language that together with cascading style sheets and JavaScript glue will yield an application one starts in the browser by opening the .xul document.
A possible advantage of XUL might become the relative ease of application development, change and distribution.
Possible problems will be similiar to the ones known from JAVA. The qualitiy of XUL applications will stand and fall with the quality of the XUL implementation for a specific platform, which right now means the quality of its Mozilla or Netscape implementation.
Of course, compared to JAVA, which has underwent several larger development cycles and now features mighty libraries, XUL is a bleeding edge technology at its beginnings.
However it is still possible to make direct use of the various Mozilla widgets as well from C++.
Re:Mozilla (slightly OT too) (Score:2)
Re:Mozilla (slightly OT too) (Score:3, Interesting)
2. If you actually needed a UI that was as rich and powerful as XUL can provide, why woulld you want to go off an write it al yourself?
3. Are you thinking in terms of writing web pages and CGI that acts as an application, or are you thinking in terms of building your UI into the XUL interface of Mozilla? These are very different things (and both actually have a place in different applications).
Re:Mozilla (slightly OT too) (Score:2)
Re:wxWindows (slightly OT) (Score:2)
Which Qt does as well. I find wxWindows too MFC-y too use tho, although it is quite a viable alternative to Qt, especially for open software on Windows.
However, If you want a high quality professional toolkit, stick with Qt. gtk--? no way, it's not in any good shape.
Re:wxWindows (slightly OT) (Score:2)
Since I can't afford the megabucks for a QT Windows license, I guess I'm stuck with GTK, wxWindows, FLTK or FOX. So which one to go for?
Also, do any of these make it easy to do user-customisation of menus, toolbars etc, similar to current MS Office apps? Or docking windows?
Grab.
Re:wxWindows (slightly OT) (Score:2)
You can always use Qt non commercial on Windows for free without spending the megabucks.
I've used FLTK, but it's a bit too light for my tasts.
So, I think either wxWindows or Qt is your best bet.
Qt does docking windows. Both Qt and wxWindows have good toolbar classes.
Re:wxWindows (slightly OT) (Score:5, Informative)
The license it's under is acceptable (to me), and there are working large apps such as Audacity [sourceforge.net] out there.
When I discovered all of this, I decided to look into the technology side of things. To throw more goodness at you, let me say reiterate that the toolkit looks native to your environment which is a big win. On top of that, it lets you do things which aren't lowest common denominator and exist in only one or more environments, such as toolbar icons in Windows.
I also like the class hierarchy. I had never done GUI programming before but everything came across rather clearly when I started reading the documentation.
Additional to all the "low level" GUI junk, it also contains some routines for networks and a portable wxString class which is a lot like stl::string with more methods added. I found myself using this almost immediately and I haven't looked back.
It's worth learning this stuff just to get away from MFC without taking the speed hit of learning Java/Swing and having to learn a whole new language and culture. There is even some boasting about how 'the Java honeymoon is over' on the page, stating that wxWindows is actually a more portable toolkit. :) ymmv.
There are both Python and Perl bindings for it. I haven't looked into either really, but at least the Python ones seem to be of high quality as a number of people on the mailing list are Python programmers.
Check it out [wxwindows.org] before coming to a conclusion of what toolkit to use. It's worked for me.
Re:wxWindows (slightly OT) (Score:2)
QT is excellent on both counts.
Re:wxWindows (slightly OT) (Score:5, Informative)
Al Stevens took a look at both Qt and Gtk-- in the September and October issues of Dr Dobbs Journal.
What he didn't like with Qt:
The last (I think. I only have October) refers to that Qt takes ownership of objects instantiated on the heap i.e. new without a corresponding delete. Which means you have to do all instantiating on the heap because there is no portable way for Qt to know if it is on the stack, external, or static memory.
He thinks Gtk-- remedy all these problems and he actually found the tutorial funny albeit a work in progress.
GTK Seems solid, but slow on Solaris (Score:2, Informative)
--
Dooferlad
licensing (Score:5, Informative)
To pick up your point on licensing, Qt is either GPL or pay. So if your application will also be GPL, it's free, if your application will not be GPL you will have to pay up for Qt. GTK is LGPL AFAIK (enough acronyms for you? ;-) so that will not stand in the way of making your app non-free.
BTW, if you know C++ and want to get to know a bit about Qt, they have a pretty good tutorial online here [trolltech.com]. Just walking through the examples made me realize just how cool it is, and how much you can do in just a few lines of code.
Re:licensing (Score:3, Informative)
Just remember that you only need to give your source to any entity you give the binary to. Being GPL/LGPL doesn't mean you can't use it for business use; the license is entirely transparent for apps which will only be used internally.
Re:licensing (Score:2)
Correct me if I'm wrong; I believe that Qt is dual-licensed. The TrollTech license is the one you quoted, but it's also under LGPL which doesn't permit the kind of restriciton you mention.
So for internal proprietary use, you're 100% clear, so long as you're using the LGPL version, not a straight download from TrollTech.
Re:licensing Qt == dangerous (Score:2, Flamebait)
Go away, troll.
Re:licensing Qt == dangerous (Score:3, Informative)
No, it's not. All the free licenses have that. non-commercial, free, educational, etc. Check the TrollTech General FAQ [trolltech.com]
That, along with the FAQs, statements, etc. from Trolltech's past seem to make it clear. Go check their site yourself. Perhaps have a lawyer check the mentioned Professional and Enterprise Edition licenses and let us know if you're right and Trolltech is wrong.
I'm not trolling, just trying to point out issues with the Qt licenses. If you start with a commercial license and never want to ship shareware with it, or if you start with the proper free license of your project and keep it open-source forever, then it's not bad.
Re:Qt Locks You In (Score:2)
You're neglecting the fact that he's not just working with Linux/X11, but rather a variety of platforms.
> which is completely open source (LGPL)
RMS himself considers the LGPL to be less open sourceed than the GPL. In fact, he really discourages use. Qt is more pure open sourced in X11.
Re:Qt Free needs X11 (Score:2)
Heard of Qt non-commercial on windows?
Licencing (Score:3, Insightful)
an open licence, then it's of minor importance.
(Qt requires licencing fees if you want to keep
your sources closed).
Re:Licencing (Score:2, Informative)
Re:Licencing... and support (Score:2)
Re:Licencing... NOT (Score:2)
Actually, this is one point where Qt comes out way behind. Gtk++ is LGPL, which frees you to build commercial apps using it with no cost. Qt has a very infectious license where if you at any time use a free version of Qt on your project, then you can never release your project commercially.
And Trolltech dismisses shareware completely. They consider it to not be a viable approach, and so Qt can't be used for it.
Re:Licencing... NOT (Score:2)
Huh, what FUD. Qt has nothing of the sort.
> And Trolltech dismisses shareware completely. They consider it to not be a viable approach, and so Qt can't be used for it.
No they don't. If you have a commercial license, you can sell as much properitary, close source shareware as you want. If you use free Qt, you can sell as much of open sourced shareware as you want.
Qt has better documentation (Score:5, Interesting)
Another observation is that GTK-- is much more low-level than QT. If you want to extend it's components you might have to delve into the depths of the gdk library (which, in my view is only a thin wrapper around the X11-libs). QT on the other hand has a very good abstraction of windowing system details. Being mostly a Java programmer, I found the QT model very easy to use.
Of course, YMMV.
Re:Qt has better documentation (Score:2)
Yup, this is because Qt is not a gui-toolkit but rather an application framework. It provides classes that work equally on all platforms that Qt supports, saving the user from writing a bunch of #ifdefs for particular platforms. It works really well
GTK+ C++ wrappers (Score:5, Informative)
I worked on a rushed project earlier this year, and used the gtk-- C++ wrapper for GTK, as well as the gnome-- wrapper (then still very much under development) for the Gnome libraries, specifically the canvas.
Personally, I found it frustrating to use. As these wrappers are still being worked on, the documentation is sketchy. The object-owning semantics are confusing (at least to me) - I was forever leaking memory or prematurely destroying objects. Trying to destroy something from within a menu callback I recall was particularly noisome. The gnome-- canvas wrappers were a moving target, though they may have since stabilised, and didn't fully expose the canvas API. Writing one's own canvas items is done in C, and then wrapped.
Perhaps with more persistance I might have figured out how to set up keyboard acceleration, but it is at anyrate a real battle to find documentation that explains what is going on with it. AFAIK, there is no straightforward way of making a multiple file selection in GTK+ 1.2. In gnome canvas (not GTK+, but a close cousin) there is promised functionality that is simply not implemented - I'm thinking here of smoothed lines, for which the code reads:
I haven't used QT yet. It certainly looks pretty, and a quick glance at the example code and docs provided seems to indicate that it's not too complicated, and well documented. I'd certainly shy away from GTK+ if a C++ interface is required.
The new version of GTK under development should address many of the shortcomings of the current toolkit, and includes goodies such as Pango. It is not yet in a stable state, however, with the API still undergoing final tweaking I believe.
A third alternative... :) (Score:3, Informative)
If you want cross platform compatibilty with C++, then check out wxWindows [wxwindows.org]. It has ports to Windows, MacOS (9 & X), UNIX + Motif, UNIX + GTK. It also has a very well developed Python binding [wxpython.org] -- so well developed that quite a few people want it adopted as the official Python GUI instead of TKinter.
Re:A third alternative... :) (Score:2)
Nah, Qt itself is probably the best choice for a commercial project. I'd use wxWindows for free software that targets many platforms tho, and Qt for X11-only free software.
> wxPython
Yeah, wxPython's really nice.
Before the flame wars start... (Score:5, Insightful)
Come up with a few small use cases and let your developers loose on everything you can get your hands on. Both Qt and GTK+ are freely available enough for that to be a useful exercise.
You might find that, while Qt has nicer abstractions, and provides a familiar set of classes which are (IMO) far superior to MFC... perhaps GTK has a slight edge for lower level work (which it sounds like you might get involved in). Also, see which interface builder tools your team feels most comfortable with.
The problem with this question is that the replies are likely to degenerate quickly into a C vs. C++ rant-a-thon. Yes, GTK is entirely written in C. But it *is* object oriented. It seems strange to everyone at first, but just because a language doesn't support particular features, doesn't mean that you can't use a particular programming style. OO methodology is just as relevant to C programmers as to C++ or Java programmers.
If your programmers are good, they'll write good code whatever the toolkit. Just make sure everyone thinks that they got a say in the decision.
Re:Before the flame wars start... (Score:2, Interesting)
Portability to Win32 (Score:4, Redundant)
In addition, Qt now has a Mac OS X port.
Add this to the excellent commercial support from Trolltech.
Design and language issues not taken into account.
Re: OS X port (Score:2, Interesting)
The HUGE disadvantage is that QT programs will never be as fast as "real" Mac programs, because all the UI stuff (bitmaps for buttons, for instance) will eat up memory space and disk access time. The other programs get the UI for free.
It's also a practice Apple doesn't like. At all. Remember the Mozilla port?
There's also the danger that OS X will pick up some new feature, like for instance voice-controlled mouse movement to UI elements or whatever. Every program will magically work with them, except for QT-based programs which will just sit there and look stupid until Troll gets around to update their (closed-source!) Mac port.
Re: OS X port (Score:2)
No, in fact, quite the opposite is true. It'd be faster than solutions that simply wrap around native API calls.
It is like in the Java world between AWT (Java 1.0.x) and Swing (Java 1.2.x). AWT tried to simply wrap around the native toolkits. As a result, it was quite slow. Swing does it like Qt, and provided an API for drawing widgets, much like Qt does with QStyle.
> eat up memory space and disk access time.
I think they alleviated this by using QPixmapCache. It should be only a tad bit slower, if not the same speed as regular OSX apps. Either way, an user would not know the difference in speed.
Re: OS X port (Score:2)
Re: OS X port (Score:2)
Re: OS X port (Score:2)
Some REAL points (Score:5, Insightful)
Developing for a professional product I would always go with as many professional tools as possible.
To me QT seems to be the FAR better decision. It has true interoperablity between Win32, MacOS X and X11.
QT is C++ from the ground up, GTK-- is wrapping GTK++.
Furthermore with GTK you definitely write more code to accomplish the same.
QT 3 gives you access to SQL-databases from its widgets.
QT comes with a very good interface builder.
QT based programes feel snappier than GTK based ones.
One drawback might be that you have to preprocess (actually your Makefile has to) your code before its ready for the compiler, but that's not a big deal.
With Kdevelop you have access to a very good IDE.
One thing I don't know is how QT works in terms of different GUI threads, but I neither know for GTK.
So please, go with QT and be happy
A much harder decision would be: What should I use for my Web-Frontend, mod_perl or PHP... but that's a different story!
Re:Some REAL points (Score:2, Insightful)
What does having Kdevelope have anything to do with Qt? Regardless of whether you use Qt or gtk based systems you can use Kdevelope. Looks like you are grasping a bit here.
Why do I care that the widgets provide SQL? I may consider that bloatware and more that I want for my development needs.
I know lots of professionals that go with products that are open source and not termed "professional" because they are not backed by a company. A good number of professionals use tools that they can modify and see the internals. (Both available for Qt and gtk, so no harm no foul.)
Qt feels "snappier"? Puh-lease. Lets live in the land of the subjective here. You are obviously lost. Look into the role of the WM.
BTW, I am not endorsing either product. Just playing the "Devil's Advocate". I hate to see biased, pointless, not clearly thought through arguments used to push someones view.
Re:Some REAL points (Score:2)
You may not care. Many application developers in the world need both rapid development and database access. This feature is something they would care for very much. Yours is a poorly thought through argument.
Qt feels "snappier"? Puh-lease. Lets live in the land of the subjective here.
He was being subjective, so are you.
You are obviously lost. Look into the role of the WM.
If the same functionality under the same WM has a feel of faster feedback with a Qt application than with a GTK-- application, that kind of eliminates the role of the WM, doesn't it?
Re:Some REAL points (Score:2)
Re:Some REAL points (Score:4, Insightful)
So?
QT is OO by design. GTK-- is OO by kludge.
> QT 3 gives you access to SQL-databases from its widgets.
Why?
To make it easier to build database-driven applications without having to twiddle between two libraries.
> QT comes with a very good interface builder.
Use vim.
> With Kdevelop you have access to a very good IDE.
Use Vim.
Look, I love g/vim as much as (or more than) the next guy, but it is not an IDE designed for QT, and it is NOT an interface builder at all.
> QT based programes feel snappier than GTK based ones.
Opinionated
An opinion many people, myself included, share. GTK feels sluggish, slow, laggy. QT actually feels like you're interacting with the program.
> Furthermore with GTK you definitely write more code to accomplish the same.
Maybe, maybe not.. and if so, who cares? Maybe some people like to have a lot of options/power at their disposal.
It's not a matter of options/power, it's a matter of more code to do the exact same thing for no reason. GTK is godawful ugly. I can't speak for QT, but everyone I talk to who's used it agrees. You can do more with less and better.
Gtk is more commonly used then any other brand.
That's because when QT started out, it wasn't Free as in Speech, so GTK was used instead. Now, GTK is ugly, bloated, and slow, and QT is fast. KDE still sucks, but QT works, and well.
Sure it sucks, but it sucks less.
No, it just sucks in more places at once. MS is more commonly used than GTK, doesn't mean it's better, just that it's more common. Same with GTK. It's better than a lot of options, but it's still #2 in my book.
Don't get me wrong, I love GTK and I hate KDE, but QT just feels nicer and works nicer, and as much as I'm loathe to, I have to admit that.
--Dan
Re:Some REAL points (Score:2)
The original poster was slightly mistaken. Qt 3.0 has a few SQL enabled widgets in its new SQL module library. see trolltech [trolltech.com].
An object-oriented database layer can be helpful though, for you weaklings, hehe.
[...]
Sorry, but you're a fucking troll.
hmmmmm....
Re:Some REAL points (Score:2)
And gtk-- is barely used at all.
Re:Some REAL points (Score:3, Insightful)
>> QT is C++ from the ground up, GTK-- is wrapping GTK++.
>So?
So QT is also well-written C++, which means it's much easier to write for. C++ wrappers over C libs almost always end up having to deal with Cisms that aren't an issue when using C++.
>> QT 3 gives you access to SQL-databases from its widgets.
>Why?
Because if you want any company that is developing internal applications to use QT instead of VB, it had better have direct access to SQL databases, because about 90% of "enterprise" apps are souped-up database forms strung together in a meaningful manner.
>> QT comes with a very good interface builder.
>Use vim.
And painters should write down specific instructions for a machine to render their paintings. I'm sorry, but being a UI designer, I'd say that most of us, when designing UIs, think visually, not textually. This isn't better or worse, just different. I use emacs and the command line whenever I'm developing backend code, but any time I need to develop a UI, I need to see it, and I'll be damned if I'm going to wait even 3 seconds for a program to compile and run if all I'm doing is checking if I got the constraints on some widget set right. It just interrupts the flow of work.
>> QT based programes feel snappier than GTK based ones.
> Opinionated
Yes, but valid. The response time of a UI is crucial to user acceptance. Anything that takes longer than 1/10th of a second is not instant.
>> With Kdevelop you have access to a very good IDE.
> Use Vim.
See above. Kdevelop also makes it easy to set up automake/autoconf build methods, even for people who aren't familiar with them.
>> Furthermore with GTK you definitely write more code to accomplish the same.
>Maybe, maybe not.. and if so, who cares? Maybe some people like to have a lot of options/power at their disposal.
I care. My time is valuable, and it takes me the same amount of time to write 100 lines of QT code as it does 100 lines of GTK code. If I can get more done with 100 lines of QT code, guess which I'm going to use? The best situation is where the library gives you access to powerful abstractions (like QT does), but then also gives you access to lower level details if you need it. There's nothing to slow you down like dealing with details that don't even matter.
Re:Some REAL points (Score:2)
Uhm, gtk--?
> Just as many people have the exact oposite opinion, QT is a piece of trash on MY system, while Gtk runs really snappy.
Both run pretty snappy here. People who say "GTK is faster than Qt" and "Qt is faster than GTK" are pretty much trolls. Both are about the same speed.
> Anjuta DevTools is easily as featureful as nice as KDevelop. http://anjuta.sourceforge.net/ Glade is a terrific GUI builder.
Anjunta's cvs version isn't as advanced as KDevelop's cvs version. Although Anjunta's cvs version seems to be less broken at this time than KDevelop's (I've tried both within the last month).
You might want to try Qt Designer as well. It's the Qt equivalent of Glade, but has a pretty nice code editor in version 3
Mozilla? (Score:3, Insightful)
Re:Mozilla? (Score:2)
Grab.
New GTK+ (Score:4, Informative)
/Janne
Re:New GTK+ (Score:2, Insightful)
If they're redesigning the toolkit with every major release, that's a bad sign. Qt has not changed substantially since 1.x, the main difference is that functionality has been added to a rock solid infrastructure.
BTW, when is the GTK documentation going to be available ? IMO if there isn't any documentation, it doesn't even deserve to be called "1.0".
Well.. (Score:2, Insightful)
If you're writing commercial, proprietary software, then you have to pay to use Qt - but Trolltech provide a thoroughly professionally supported toolkit to you for your money.
The Qt class library is actually more akin to the standard set of Java classes than just a widget set - there's decent cross-platform support for sockets, xml, threads, unicode, etc. It really makes C++ programming very easy.
OF course, there's other cross-platform C++ tollkits like FLTK [fltk.org]... The gui toolkit page [geocities.com] lists many more.
Re:Well.. (Score:2)
That's purely a command line switch to the compiler. You can compile FLTK so that it doesn't do that. But I agree with you about the sparse widget set aspect of it.
Re:Well.. (Score:2)
QT comes 2nd IMNSHO. Better widget set, but not as fast or flexible.
As for the DOS window - do shut up, your ignorance is showing. Compile the 50 or so
example programs that come with fltk in release mode and observe the lack of any dos windows. For those too slow to type "fltk dos window" into google:
> For MSVC++ the switch to the linker is:
>
>
If internationalisation matters... (Score:3, Insightful)
Re:If internationalisation matters... (Score:2)
However, Gtk2's win32 port will likely remain a very unsupported port. While qt's win32 port is as important if not more important (because of commercial licenses), than their X11 port.
ACtually, Gtk2 *is* designed for Win32 (Score:2)
GTK 1.x was always portable -- designed so -- because the GDK was an abstraction layer that allowed porting to nearly anything someone had a desire to port onto (win32, framebuffer, whatever). I've used GTK under Python, and while it's slower than native Windows UI, it's more than acceptable for GIMP.
This fellow really needs to prototype some stuff using *each* of the closest candidates. If his schedule does not include time for prototypes, the software will be ready for a code rewrite MUCH sooner than they expect. I do Software QA, and I've seen the effects of rushing a project without proper homework up front. You *always* throw away some code, like it or not...
>However, Gtk2's win32 port will likely remain a very unsupported port.
Opinion presented as fact. There are *many* projects using GTK on Windows... just like there are many Qt projects on Windows. They're just ot very prominent (aside from GIMP).
.. And from what I read on the mailing lists, GTK 2.0 will be "officially supported on Windows (whatever that means), and the rendering rewrite has eliminated that "slow redraw" problem of GTK 1.x.
Cheers..
I switched from Gtk-- to Qt (Score:3, Insightful)
However, Qt is simple to use, well documented, and have stable API's. In practice, these make it much easier to use than Gtk--.
As an extra plus, Qt is GPL and therefore more gnulitically correct than Gtk--, which is only LGPL.
Re:I switched from Gtk-- to Qt (Score:3, Informative)
The LGPL was written specifically to get around the 'viral' aspects of the GPL. Meaning that while Gtk-- gives you the option to GPL your product, QT does not. With QT you MUST use the GPL... unless you pay Troll Tech an arbitrary, although currently quite reasonable sum.
Re:I switched from Gtk-- to Qt (Score:2)
I'm not saying that Stallman wouldn't like it. But isn't it ironic that the GPL is being used as a tool to create a market for the commercial version of the toolkit?
As an end-user however, QT is superior. I've tried to learn Gtk--, but I couldn't wrap my head around the lack of documentation and the obtuse artifacts left over from the C origins of Gtk+.
I hope they clean it up. The next time I delve into it, I will be trying to document-as-I-go.
If somebody can understand how to create a reliable and quick UI in pure C, that's good for them. I can't touch it until it is wrapped in C++, and I am not skilled enough to do it myself. I really think you need somebody who eats, sleeps, dreams and breathes both Gtk and C++ to be able to write an effective wrapper.
QT forces non standard c++ use (Score:2, Interesting)
QT has reimplemented all those things as a rather dodgy set of proprietry classes, which lock you into, for example using QString rather than std::string throughout your application, or doing a lot of extraneous conversions every time you need to talk to the GUI.
In its favour, QT does have much better documentation than gtk--, but all the same, I prefer the standards based gtk--.
Re:QT forces non standard c++ use (Score:2)
It's an application framework.
> QT has reimplemented all those things as a rather dodgy set of proprietry classes.
Dodgy? How do you figure? They are very high quality, and are actually more cross platform than many std:: classes are. Ever try to compile large non=Qt C++ code in HP/UX with quite broken compilers? I have, it's not pretty.
Besides, if you knew anything about Qt, you'd see that Qt3 has stl support.
So Qt tries to become QT? (Score:2)
it also is a cross platform development platform. So it provides cross platform facilities for many activities - file access, sockets, database access
Just MySQL and PostgreSQL, or does it also talk to common proprietary DBMS such as oracle, sybase/mssql, etc?
printing, font handling, Unicode and internationalisation
How big does a distribution have to be to include glyphs for all 50,000 or so Unicode UCS-2 characters?
preference handling, XML support including SVG, various image formats
How much of the price of a Qt license covers the Unisys royalty [burnallgifs.org] for a popular "various image format"?
regexps, data and time classes, multimedia classes
Multimedia as in video playback? Is Qt [trolltech.com] trying to become like the other QT [apple.com]?
Does it handle press/release semantics for keypresses, or just press/repeat? Does it handle joysticks (erm, "industrial control devices")? Does it handle reading mouse motion not limited by the four walls of the screen (necessary for object manipulation in a 3D environment)? Does it handle sound?
Yes, I'm getting into the domain of Allegro or SDL, but only to show that Qt isn't the be-all and end-all of application toolkits.
Re:So Qt tries to become QT? (Score:2)
Yes it does.
> Yes, I'm getting into the domain of Allegro or SDL, but only to show that Qt isn't the be-all and end-all of application toolkits.
Allegro and SDL aren't application toolkits.
Re:QT forces non standard c++ use (Score:2)
When it comes to QString it is far superior to std::string since it is unicode which is really a boon when writing internationalized application.
std::wstring is generally (?) Unicode. And, you can always write your own char_traits for Unicode if you want.
Re:QT forces non standard c++ use (Score:2)
Re: QT forces non standard c++ use (Score:2)
You're sort of right. There's no free lunch, there's a tradeoff, which is to sacrifice inlining for a reduction in template bloat, and coupling. I disagree that one wants everything inlined for "most applications". For applications that involve containers of pointers of widgets, the extra indirection does not pose an enormous problem (you are already choosing indirection by using pointers and not values) IMO performance bottlenecks in a GUI application are more likely to appear in drawing methods, network overhead, and back-end computation. I've never found looking up a widget in a list to be a performance bottleneck in a GUI application.
Qt does have value based containers for the rare occasion that you simply can't afford the indirection of the pointer based containers.
If the object in the container inherits from multiple base classes, you are guaranteed that multiple pointers to the same object (of different pointer type) will have different values on almost all C++ platforms. When you cast from derived to base class type, the compiler adjusts the pointer value if necessary to ensure that it's pointing to the right vtable.
I don't see why this is a problem. The exposed interface does not accept void* pointers, it would only accept base class pointers. The derived to void class never happens. You get a derived* to base* conversion (because the function prototype wants type base*), then a base* to void* conversion. I agree that it would be a problem if the exposed interface accepted void* or derived* pointers though.
BTW, this idiom isn't terribly revolutionary. Stroustrup recommends it, Lakos (large scale C++ design) recommends it, and Metrowerks actually use iit to implement pointer classes in their STL.
So when multiple inheritance is involved, you can easily take a pointer of derived class type, cast it to void*
No. The derived pointer would get converted to a base class pointer first.
Cheers,
Easy! (Score:4, Funny)
Gtk is 1.2.x
Sure it's friday, but come on, thats easy 3.0>1.2, so the choice must be Qt!
Same reasoning shows that Windows 2000 are MUCH better than Windows 98 which in turn is slightly (by 3 point) better than Windows 95, which again are MUCH better than windows 3.11.
Sigh. Does you youngsters not learn anything today?
Re:Easy! (Score:4, Funny)
Some points from using Qt. (Score:5, Informative)
The advantages I can see from using Qt is:
* Superb design. The OO design of Qt is really thought out. There are virtual function to do all the basic things you can think of and if you think of something really clever there are lowlevel routines to do that too.
* Superb documentation. A comprehensive, hypertext help and in Qt3 an included help browser. This is really an advantage since GTK+ not really being supported by a commercial entity suffer from lots of "I'll rather code than document" in the libraries.
* Good migration path to new versions. I have a program consisting of ~100000 lines of code (An Oracle client http://www.globecom.net/tora) which I migrated to Qt3.0 in about 2 hours, some of that time was spent using Qt3 specific features also like docked windows where appropriate.
* Not only a GUI toolkit. It also includes primitives for handling threading, I/O (files and sockets), UNICODE conversions and also some basic template classes made mostly obsolete now that STL is starting to actually work in GCC.
* Truly multiple platform. The application above was ported to Windows in about a day, all of the problems related to the fact that Visual C++ understands a different dialect of C++ than most of us are used to and that took some time write around, none of it was Qt specific. The extra thread and I/O classes really helps here as well.
/Mauritz
GlobeCom AB
Re:Some points from using Qt. (Score:2)
You can use those with Qt as well.
> Threads
You can't with most toolkits (with the nature of event queues).
> QFileDialog
What's so wrong with QFileDialog? It's a pretty good example of OO-design. It inherits a QDialog which inherits a QWidget which inherits a QObject. That's all very clear and easy to understand. What's so wrong with it?
Clearly an unfair comparison... (Score:4, Funny)
(Score:-1, Sarcastic)
If you want better cross platform support.. (Score:3, Insightful)
Don't lock yourself into one gui and hope that it will cover all the platforms you need, most of them don't. Allow any kind of gui to work with your program, not only is it more cross platform compatible, but other people can create guis for your application without ever have to touch the applications code.
Re:If you want better cross platform support.. (Score:2)
A better idea might be to use #defines and #ifdefs and other magical compiler directives, write some wrapper functions if necessary, and then at compile time, decide which toolkit you're compiling for.
#define TOOLKIT gtktk
#include
Or something of the sort.
--Dan
GLOW, cross-platform toolkit for 3D apps (Score:2)
GLUT, the widely used cross-platform wrapper for OpenGL, has problems when used in a multi-window application, and those problems affect GLOW programs. I've been documenting the problems and sending them to the current maintainer of GLUT, and they may eventually get fixed. Supported platforms are Win32 and X.
These alternatives are only useful if you're writing a 3D application. Otherwise, use one of the 2D toolkits.
My company went through this... (Score:5, Informative)
Now that we have been using Gtk--, we have relatively few regrets. The documentation was poor, for a time, but they have semi-recently improved the documentation, and it is quite workable. There are some small things that you would think would be done differently, but overall they are very minor and easy to live with.
Since we aren't concerned (yet) with porting our software, that wasn't much of an issue. Of course, your situation may be different there.
Finally, echoing what other people have said here, Gtk-- can be quite low level at times. I would recommend that if you decide upon Gtk--, you do what our company has done. We created our own set of libraries that provide standard looks to things with minimal hassle, derived from the Gtk-- classes. An example of this would be windows. We have our own window class that sets up standard options that Gtk-- allows to vary considerably. (Additionally, it automatically checks for certain keystrokes, like the F1 key, and signals that fact.) Making a button class would be similar, so all of your buttons are approximately the same size, have the same shading, etc. We were late in figuring this out, but it has greatly simplified our code and made our program look much more consistent.
Dr. Dobbs articles. (Score:2, Interesting)
Al Stevens provides a column in Dr Dobbs Journal titled "C Programming". In the Sept-Oct 2001 columns he described issues he ran into testing both the Qt and GTK-- class libraries. I do not have the articles here but Al gave some pretty good C++ aesthetical reasons for staying away from Qt. Specifically he mentions having to re-compile some of the Qt libraries so that he could extent their class to properly convert from a STL String to their Qt string class.
He had many other reasons for not using Qt. When I get back to work from this long holiday I will post an outline of his specific reasonings.
Just to clarify. I am not an Al Stevens "fan". The man really seems off his rocker sometimes. However, the articles on Qt and GTK-- were very informative. And yes, I did investigate a few of the items for myself. (Do not trust my word though, get the article, read the article, try it out for yourself!)
I have experience with both... (Score:2)
Others wrote there are other toolkits as well but IMO they are nowhere near the usability of Qt. The often mentioned wxWindows is a wrapper around native widgets meaning that things like widget alingment issues become a pain in the butt as each platform will have widgets drawn in their native size. Also widget toolkits that wrap native widgets are diffucult to extend (by class derivation) so if you need to create your EnhancedComboBox from their ComboBox it's sometimes difficult to accomplish with wrapping toolkits. Personally I think going with an emulating toolkit is better than using a wrapping toolkit (fewer headaches). If you don't agree think for a minute why Swing in Java is considered an improvement over AWT. Same reasons.
FLTK is sweet if you don't need advanced widgets and i18n. They finally got their issues with keyboard focus fixed so it begins to look more and more like a real alternative. However, they use char* for text handling all over the place so it's certainly a disadvantage if you need unicode support. However, it is small and it is fast but it's only good enough for simple UIs.
You can't go wrong with Qt it gives you the power of something like MFC in a more digestible form with cross platform portability to boot! Also the sheer number of widgets available for it is pretty amazing. Oh, and the slot/signal thing isn't half as bad as some people here make it out to be.
1 vote for QT here.
GTK-- is not GTK+ (Score:5, Interesting)
Well, nearly. If you're from a standard C++ background (as I am), you will find gtkmm preferable, as they don't reinvent parts of the standard library (eg QList vs std::list), they use namespaces and templates (including giving familiar, STL-style interfaces to container widgets etc), and it's implemented entirely in C++ (whereas Qt is in a C++ like language that must be first preprocessed to produce C++).
But, as someone before me said; get both, try them, see which you prefer - there are obviously people who disagree with me, as KDE and Qt are popular.
Re:GTK-- is not GTK+ (Score:2, Informative)
First of all that is a serious exageration! Second it does not matter even if from a esthetical point if view the preprocessing of the headers is not nice. Why? Because the decision for a specific product/venor leads to vendor lock (see Anti Patterns) in any case.
You rely on a library. Your code will not compile if that library is not there! In the case of Qt you also rely on a little preprocessor program --- so what? If you use GTK or Win32 or MFC that don't need the preprocessor what is the difference? You cannot take your MFC program and compile it using say GTK.
The only thing you can do is to try to introduce clear layers that separate you program logic from the GUI to contain and localize the damage in case you have to go from one GUI library to another.
This is also my answer to the criticism that Qt (which was started in pre STL times if I am not completely wrong) uses non-STL containers. Separation of GUI and core program allow you to use more approprate/modern/protable technologies in the core. It is the architect's/designer's/programmer's choice where to use these non-standard constructs and how deep you will move into vendor lock.
Especially tricky in the case of Qt is that Troll Tech also offers a Qt specific abstraction layer for low-level constructs like threads/locks/sockets, etc. This means that if you are not carefull your software is locked at the top and at the bottom. If these low level services are used I would recommend to wrap them into a platform isolation layer. In the case you want to change you can replace these services using the native OS constructs or libraries like ACE, etc.
GTK--/Qt are not the only choices (Score:3, Informative)
> Not supprisingly we've come up with two choices,
> GTK-- and QT.
This surely is surprizing to me. I wouldn't consider GTK-- a serious choice for writing Win32 programs - sure, it "works", but have you seen it and/or used any GTK+ programs under Windows? But I would consider FOX, FLTK and wxWindows as serious contenders to Qt.
I can't speak of the others but let's compare wxWindows and Qt:
1. wxWin has almost all of the features Qt has
(it doesn't have some, but then it has some extras)
2. wxWin is free (as in beer too) for all uses
3. wxWin has native LNF, even under Windows XP
(which can be a serious advantage if you
target this platform).
But try it for yourself - wxWindows 2.3.2 is scheduled for Dec, 2 and has quite a few interesting new features. And see www.wxwindows.org for more info.
GTK+ and Objective C (Score:2, Interesting)
Try FLTK (Score:2, Interesting)
Try FLTK { www.fltk.org }
You won't be disappointed with the Fast and Light Tool Kit.
For download, go to ftp://ftp.fltk.org
Cuz it's crap (examples failed when I tried them) (Score:2, Informative)
Re:Use QT (Score:2)
Qt3 was already released over a month ago
> Qt is mfcish
I don't think so. I find wxWindows much more mfc-ish.
But I agree with the rest of your post, use Gtk+ if you like C and Qt if you like C++. gtk-- is a rather poor hack. hopefully inti will be much better