 |
Benefits of the Qt Object Model
by Johan Thelin, in Tutorials - Sat, May 10th 2003 00:00 PDT
Qt is known as a cross-platform graphical user interface toolkit. It
is that, but it's also a toolkit for dealing with databases, file
access, sockets, and much more. This article concerns the Qt object
model and why it is an improvement over the classic C++ model.
Copyright notice: All reader-contributed material on freshmeat.net
is the property and responsibility of its author; for reprint rights, please contact the author
directly.
The Qt Object Model
The classic C++ object model has data and methods which can be either
private, protected, or public. When designing a GUI (or any other
event-driven task), we want to tie a method implemented by us to a
specific event. To do this, we inherit the event-generating class,
overload the virtual method, and re-implement it to do what we want it
to do. This gives us two problems:
- We will have a new class for each action.
- If there was any functionality in the original virtual method,
we will have to re-implement it or make an explicit call to the
original function.
Qt solves this problem by introducing signals and slots. A method can
be defined as a slot that is either private, protected, or
public. Slots are ordinary methods, but they are listed in the slot
table of the meta object. Each class utilizing the Qt object model has
an automatically-generated meta object containing type information,
inheritance information, and a list of signals, slots, and properties.
A signal is declared as if it were a usual method, but it may not be
implemented. Signals cannot be called, but emitted. Let's go back to
the event-driven GUI example. Instead of inheriting the
event-generating class, we can implement a slot which fits the signal
emitted at the interesting event.
A Code Example
Let's demonstrate this by looking at a small example. We will put two
buttons in a dialog and let them alter the text of the title bar. We
will let the functionality (i.e., the slots) be a part of our dialog,
and simply connect the "clicked" signals from the buttons to the
appropriate slots.
We begin by looking at the main function that simply initializes the
application. It is very simple, and should not pose any problems.
#include "example1dialog.h"
int main( int argc, char** argv )
{
// Initialize Qt
QApplication app( argc, argv );
// Create an instance of our dialog
example1Dialog dialog( 0, 0, TRUE );
// Set it as the main widget (as we do not have a main window)
app.setMainWidget(&dialog);
// Execute
dialog.exec();
return 0;
}
Notice that Qt is accompanied by a great documentation set to which
you can refer if you want to know any details. It is available online
from http://doc.trolltech.com/,
and contains reference material, examples, and in-depth tutorials. In
this tutorial, I use the free 2.3 version for win32, just to demonstrate
that the Windows version is also freely available. The code I present
here is fully compatible with any Unix or Mac version of Qt (it is, as
I mentioned, a cross-platform toolkit).
Now, we can continue by looking at the class declaration of the
example1Dialog class. This is where the Qt object model comes into
play.
class example1Dialog : public QDialog
{
Q_OBJECT
public:
example1Dialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags f = 0 );
protected slots:
void fooClicked( void );
void barClicked( void );
};
First, notice that we inherit a descendant of QObject. This is
necessary; the QObject class holds much of the object model
functionality. The first line in the actual body of the class
declaration must be Q_OBJECT. This macro has two purposes: It declares
the things needed to get the object model running and works as a
marker that the meta object compiler triggers on (more about this
later).
The slots are declared in an intuitive way. Signals are declared in a
similar way, but in the "signals:" section of the declaration.
We continue by looking at the implementation of the slots:
void example1Dialog::fooClicked()
{
setCaption( "Foo" );
}
void example1Dialog::barClicked()
{
setCaption( "Bar" );
}
This is pretty straightforward, as slots are simply ordinary methods
that can be connected to signals. As these calls are made from inside
a descendant of a QDialog, we can set the caption as easily as shown
in the code.
We will now show the method which takes care of setting things up, the
implementation of the creator of our example1Dialog class. This method
creates a layout and buttons, and sets up the connections between the
signals and the slots.
example1Dialog::example1Dialog( QWidget* parent, const char* name, bool modal, WFlags f ) : QDialog( parent, name, modal, f )
{
setCaption( "Click!" );
// The layout
QVBoxLayout *vb = new QVBoxLayout( this, 8 );
vb->setAutoAdd( vb );
// The buttons
QPushButton *pbFoo = new QPushButton( "Foo", this );
QPushButton *pbBar = new QPushButton( "Bar", this );
// The connections
connect( pbFoo, SIGNAL(clicked()), this, SLOT(fooClicked()) );
connect( pbBar, SIGNAL(clicked()), this, SLOT(barClicked()) );
}
The layout is created with a spacing of eight pixel margins between
the edges and each widget. The call to setAutoAdd means that all
widgets created with example1Dialog as a parent will be automatically
inserted into the layout.
The buttons are created with a text and the dialog as the parent. This
means that Qt will delete them from memory the moment the dialog is
deleted. Thus, we do not need to care about any complex memory
management issues. Each parent will take care of its children through
the QObject heritage.
The last thing we do is set up the connections. This is where the
magic takes place. Here, we connect each of the button's clicked
signals to the slots we created. Notice that we can send parameters
between signals and slots (almost) without any restrictions. There's
no need to declare special POD (plain old data) classes to carry
parameters; just emit the signals, and do not bother.
The Meta Object Compiler
If you try to compile the above code, you will run into problems. The
tool that is needed is the meta object compiler, the moc. It creates
code for signals and the meta object of the class. You might think
that this is an "ugly" solution. This is actually the most common
objection to using Qt. However, I have never, during three years of
usage, run into any serious problems caused by the moc or the object
model. If I encounter any problems, they are always easily solved,
thanks to good documentation and good debugging support. The biggest
benefit, however, is the syntactical clarity that the moc
provides. Anyone who knows C++ will be able to read and understand
code with signals and slots after just 1-2 minutes of introduction.
The output from the moc will be stored in the file
moc_example1dialog.cpp. Simply include this file in your makefile, and
you're ready to go!
qmake
Since version 3.0, Qt has shipped with the qmake tool. This completely
removes the makefile hell that Qt could lead to in earlier versions. A
project file (.pro) is translated into a proper makefile by qmake. For
our example, the project file would look something like this:
SOURCES = main.cpp example1dialog.cpp
HEADERS = example1dialog.h
CONFIG += qt want_on release
As you can see, the need to explicitly handle the moc_*.cpp files is
removed. Do not let the simplicity of this example fool you; qmake is
a powerful tool which can handle pretty much all the things that a
makefile can do. Through fine tuning, qmake can even handle platform
differences in, for example, third party support libraries.
Conclusions
Qt offers an extended object model which makes it easier to reuse
code. The object model introduces new syntax elements and a new
compilation stage (the moc). To remove the introduced complexity, Qt
also supplies the qmake tool, which makes it easier to build projects.
The syntax of Qt-extended code integrates nicely with C++, and makes
the code readable and easy to understand. The extensions are
transparent to the programmer, and do not introduce any new things to
think about, besides inheriting QObject or any of its descendants and
including the Q_OBJECT macro first in the class declaration.
This tutorial does not cover many of the capabilities of the Qt object
model or of Qt. It's worth mentioning that the object model introduces
supports for named properties and lots of runtime information. By
using Qt Scripting for Application (QSA), Qt objects can be scripted
in Javascript.
Author's bio:
Johan Thelin has a degree
in electrical engineering and has worked as a software developer since
1995. He lives in a town just outside Gothenburg, Sweden. His
interests cover the whole software spectrum from database design to
low level operating system hacking, and he has professional experience
in both areas and many in between. He also has an interest in hardware
design, and has implemented a 32-bit pipelined RISC CPU in an FPGA.
T-Shirts and Fame!
We're eager to find people interested in writing articles on
software-related topics. We're flexible on length, style, and
topic, so long as you know what you're talking about and back up
your opinions with facts. Anyone who writes an article gets a
t-shirt from ThinkGeek
in addition to 15 minutes of fame. If you think you'd like to try
your hand at it, let jeff.covey@freshmeat.net
know what you'd like to write about.
[Comments are disabled]
Comments
[»]
Aspects
by Bruce Ingalls - Sep 11th 2003 18:22:57
There is another way for functions or messages to be shared amongst diverse
classes:
Aspect Oriented Programming.
You can read more at
http://www.prakinf.tu-ilmenau.de/~czarn/aop/
You should be able to pass around a callback, or pointer to a function
through an Aspect.
Anyone try comparing Aspects to Signals or Slots? Aspects seem easier,
more standard, and it should be easier to create
inter-(programming)language portability with Aspects.
One of the biggest shortcomings of QT compared to the GTK family, is that
it is not as nice about multiple programming language support.
-- http://emacro.sourceforge.net/
[reply]
[top]
[»]
Re: Aspects
by e8johan - Sep 16th 2003 23:16:18
> One of the biggest shortcomings of QT
> compared to the GTK family, is that it
> is not as nice about multiple
> programming language support.
Please check your facts:
http://kdemyths.urbanlizard.com/viewMyth.php?mythID=18
-- /e8johan
[reply]
[top]
[»]
Qt advertisement?...
by antrik - May 12th 2003 03:43:25
> Qt is known as a cross-platform graphical user interface toolkit. It
is that,
> but it's also a toolkit for dealing with databases, file access,
sockets, and
> much more.
> In this tutorial, I use the free 2.3 version for win32, just to
demonstrate
> that the Windows version is also freely available. The code I present
here is
> fully compatible with any Unix or Mac version of Qt (it is, as I
mentioned, a
> cross-platform toolkit).
Reading such sentences I wonder, wouldn't that article fit better in the
advertisement section?...
[reply]
[top]
[»]
I like Qt
by reduz - May 10th 2003 14:51:04
After around 4 years of using Gtk and Gtkmm, I decided
to switch to Qt. My reasons in short:
-Shorter development time (Qt is not as flexible, but
proovides 90% of what I need instead of forcing me
to do it myself, like in gtk) As a result, my Qt code
is around 4 times smaller than my Gtkmm code.
-Clean api. It may be "bloated" for many, but
proovides few big components instead of many small ones,
this is good because its easier to look for the feature you
need.
-Excelent documentation, even if Qt has dedicated people for
this, I find it on par with the KDE documentation. VERY
complete.
-Autoformatting: Qt gives my app default formatting, and
performs default spacing on many widgets by default. This
is an ENORMOUS timesaver over Gtk, which puts all the
widgets together with zero pixel space by default.
-Has both simple/complex widgets for diefferent uses, instead
of a huge swiss-army-knife-widget like Gtk. A great example
of this is that in Qt you have a simpe list widget, a
ListView(with tree support) and a Table. In gtk you have
to do all this using the GtkTreeView, which may be really
flexible but requiers a lot of code for simper things. Gtk
used to have simpler widgets (GtkList and GtkCList), but they
were removed in 2.0
-Qt makes it much easier to make my own widgets where
custom drawing is needed, the QPainter class takes care
of everything, and it can also be used to print! Gtk forces you
to do a more X11ish approach by creating colors/GCs and
drawing to "windows", and even taking care of event masks
to be able to draw. Despite what you might think, On LAN at
least, over X11 both seem to use the same bandwith.
-Gtk forces you to manage all X11 eventmasks yourself,
(despite if signals are connected or not being a pretty good
way to check in most cases) While Qt simply gives you an
eventfilter. Pretty much the same happens with the drawing,
as stated in the previous point.
-Widget completness, Qt widgets are usually way more
complete than Gtk ones, they proovide a lot of useful
functionality, which in Gtk you are asked to do yourself,
like completion, undo, subitem indexing, decorations,etc.
-Layout system, Qt has a _very_ advanced layout system,
and even if I find Gtk's a bit easier to use for common things
(just pack_start/end with shrink and expand by default), Qt
gives me the results closer to what I want things to look like
with less work. This is because Gtk uses the "parent
resizes-child with parent rules" approach, while Qt uses the
"Helper resizes child inside parent, with child rules" one.
And those are the main reasons so far, of course, I miss
some things from gtk/Gtkmm too like:
-Flexibility: Gtk widgets are a lot more prepared for
embedding one into another, this is handy sometimes
like in buttons, viewports (I found GtkViewport to be more
useful than QScrollView) or tables. (I like GtkTable better than
QGrid).
-Basing events: Gtk treats ALL events as signals, this can be
a lot more practical than using eventfilters/overrides in many
cases.
-Signal System, Gtkmm's libsigc++ is much, much nicer to me
than the system in Qt (despite the latest having
introspection/messages). sigc++ is typesafe, gives you errors
at compile time, has proxies, and the awesome bind<>
template which lets you bind parameters to slots of different
types. It is also distributed as a separate library, so I can still
use it in my projects while using Qt ;)
-Gtk compiles native on Windows, Qt is commercial
for such platform unless you use CygWin. A port
of Qt GPL is being done, but very slowly developed:
http://kde-cygwin.sourceforge.net/qt2-win32/
Well I guess I could write an artiicle with it with more
demonstration on each point.. But in short, I have
to say I am happy after my switch to Qt.
Nice article!
[reply]
[top]
[»]
Re: I like Qt
by Teemu Voipio - May 21st 2003 15:52:20
> Well I guess I could write an artiicle
> with it with more
> demonstration on each point.. But in
> short, I have
> to say I am happy after my switch to Qt.
Your comment was already about 10 times as helpful as the article :)
-- -teemu
[reply]
[top]
[»]
Re: I like Qt
by janet - Jan 27th 2004 04:58:09
I have to agree. I am happy with Qt, too.
janet - zomilla.org
[reply]
[top]
[»]
Suggested code changes
by rikkus - May 10th 2003 14:49:36
Use a QMainWindow. That's what they're for. The example
will work, but using a QDialog as your app's main widget is
not good practice.
example1Dialog should be renamed Example1Dialog, to
match the Qt naming convention. Names of classes,
structs, enums and constants start with a capital letter.
Names of variables and methods start with a lowercase
letter.
If you use Example1Dialog as the name, then you can do
this, with no ambiguity:
Example1Dialog example1Dialog(...
It's common practice to name slots with a prefix, to remind
you that they're slots. For example, slotFooClicked().
All user-visible strings should be wrapped in tr() for future
translation.
You call vb->setAutoAdd with a pointer to a QVBoxLayout
as its parameter. setAutoAdd takes a bool parameter. Your
code will work, but this is bad form. You're relying on the
fact that pointers auto-convert to bool. Use bool to avoid
confusing people reading your code and to ease future
porting to another language.
Don't elide variable names. pbFoo should be called
pushButtonFoo. You might know your own naming
convention, but when I come to read your code later and
I'm halfway down a source file, I'm going to have to check
back to see what the pb prefix means.
There's a typo in your CONFIG line (in your .pro file) - it
should be warn_on, not want_on.
As a general comment, this is a disappointingly short, badly
written, badly thought out article. I'm a big fan of Qt, using
it all day every day for commercial and free projects. A
pointer to the Qt signals and slots documentation would
have been worth much more than this article, I'm afraid.
Rik
[reply]
[top]
[»]
err, what are the benefits, actually ?
by Momchil Velikov - May 10th 2003 12:48:24
In an article with title "Benefits of the Qt Object Model" I
would expect to read about (surprise, surprise) the
benefits of the Qt object model, i.e., a description and a
justification, or at least some rationale. What we get
instead ? Two claims (i.e. hypotheses):
"1. We will have a new class for each action."
FIrst, this is a way too broad and vague statement. What
is an "action" ? Is ``QButton::clicked'' [1] an action ? Is
``QTree::clicked'' [2] a different action or the same ?
Does the C++ object model require a new class for each
of these actions ? What kind of class does it require ?
Maybe it requires an abstract class, i.e. an interface ?
And, second, of course, if it requres a new interface,
so what ? I'd tend to claim that it's exactly how it should
be, making explicit in the the design the type (implemented by various
classes) of the objects being
capable of reacting to clicks.
"2. If there was any functionality in the original virtual method,
we will have to re-implement it or make an explicit call to the original
function. "
What is the alternative in the Qt object model ? I can't
find it in the article. And, of course, in which way this is
bad ? (Ah, and what is "original virtual method" ?)
~velco
[1] I suppose ``clicked'' is some member of QButton
[2] Likewise, I suppose there's some kind of tree control
in Qt, not necessarily named QTree, where one can click
on its items.
[reply]
[top]
[»]
Delphi/Kylix do the same but simpler
by Samuel Liddicott - May 10th 2003 01:47:23
Subject says all: Delphi/Kylix do the same but simpler
And therefore http://www.freepascal.org/prog.html too
[reply]
[top]
[»]
Signals and Slots without QT
by NevF - May 10th 2003 01:32:45
There are a number of implementations of signals and slots available which
anyone can use in there progams, without having to use QT.
eg.
http://libsigc.sourceforge.net/ (which I use in ED)
http://www.boost.org/doc/html/signals.html
http://sigslot.sourceforge.net/
If you are a MS VC++/MFC developer signals and slots provide a refreshing
alternative to message maps.
Neville Franks, Author of ED for Windows www.getsoft.com
[reply]
[top]
[»]
Comparisons?
by Sam - May 10th 2003 01:23:44
How does it compare with say boost::signals?
[reply]
[top]
[»]
Re: Comparisons?
by aki - May 10th 2003 02:36:18
> How does it compare with say
> boost::signals?
Well, I use Qt on a daliy basis and the Object System is
certainly very convenient to use within the framework. But
I would thing using Qt only to get the object system is not
generally a good idea. Compared to specialized signal-slot
systems like libsig++ and boost::signals, it is quite heavy
weight. I do not like the idea that every object which has
signals or slots has to be derived from QObject. QObject
does many things beside signal-slot stuff, like ownership
management (QObjects for a tree), scriptability and so on.
Generally, I prefer less monolithic approaches, like having
a signal to be an object on its own which I can aggregate
in my class and a slot beeing any function object. On
another note, AFAIK libsig++ achieves all the things the
Qt System can do with signals and slots, adds return
values from slots, marshallers, possibilities to influence
the calling order, and all that without requiring a special
preprocessor, entirely withint the bounds of standard c++,
even at (last that I checked) a significantly higher
performance. I do not want do bash the Qt System, since
when it was developed, the mechanisms used by libsig++
(heavy template use and so on) where not commonplace
in compilers and Qt focuses on cross-platform
development. It is a very nice cross-platform gui toolkit.
But if I only needed the signal slot system, personally I
would go for libsig++ or boost::signals.
[reply]
[top]
[»]
Re: Comparisons?
by Tim Jansen - May 10th 2003 03:39:38
> How does it compare with say
> boost::signals?
As the other replier wrote, it is heavy-weight compared to
boost signals. This useful for the purpose of Qt, because
features like introspection of signal and slots are needed
by Qt Designer (GUI dialog editor&more) and QSA/KJS
(ECMAScript engines that can access QObjects). But if you
dont want to write a full Qt application and use the C++
stdlib instead, boost signals are the better choice.
IMHO Qt is its own world. When you work with Qt you
usually don't use stdlib or boost, but only Qt classes. I
definitely prefer it, it is better integrated, better
documented and feels like it has been designed to produce
programmer productivity.
[reply]
[top]
[»]
Pitfalls ?
by linux - May 10th 2003 00:42:44
Is there any pitfall for the use of QT ?
I've heard too many complaints and such, mostly from the gnome camp, that
some kind of "patent worry" keeps them from totally embrace
anything from trolltech.
I dunno if what they are saying is the truth. So I'm just posting my
question here.
[reply]
[top]
[»]
Re: Pitfalls ?
by existi - May 10th 2003 07:19:29
> Is there any pitfall for the use of QT
> ?
>
> I've heard too many complaints and such,
> mostly from the gnome camp, that some
> kind of "patent worry" keeps
> them from totally embrace anything from
> trolltech.
>
> I dunno if what they are saying is the
> truth. So I'm just posting my question
> here.
> Is there any pitfall for the use of QT
> ?
True, Qt is not GNU http://www.gnu.org/ so any developer who wants to get
completely into the heart/source, change and publish a patch/bug and or
make improvements to the libraries are s.o.l. Many GNU apps are built with
QT, its like building GNU apps without GNU tools.
Gtk is a alternative to Qt which IS GNU
[reply]
[top]
[»]
Re: Pitfalls ?
by Rick Copeland - May 10th 2003 07:59:57
>
> % Is there any pitfall for the use of
> QT
> % ?
> %
> % I've heard too many complaints and
> such,
> % mostly from the gnome camp, that some
> % kind of "patent worry"
> keeps
> % them from totally embrace anything
> from
> % trolltech.
> %
> % I dunno if what they are saying is
> the
> % truth. So I'm just posting my
> question
> % here.
>
>
> > Is there any pitfall for the use of
> QT
> > ?
>
> True, Qt is not GNU http://www.gnu.org/
> so any developer who wants to get
> completely into the heart/source, change
> and publish a patch/bug and or make
> improvements to the libraries are s.o.l.
> Many GNU apps are built with QT, its
> like building GNU apps without GNU
> tools.
>
> Gtk is a alternative to Qt which IS GNU
Actually, there has been a GPL version of QT available since 2000. See
the announcement. Both the embedded and X11 versions of QT are
available under the GPL, and the windows port is available gratis
for non-commercial use.
-- Rick Copeland
ConsulTracker.com
www.consultracker.com
[reply]
[top]
[»]
Re: Pitfalls ?
by Michael Torrie - May 10th 2003 18:29:36
>
>
> Actually, there has been a GPL version
> of QT available since 2000. See
> the announcement. Both the embedded and
> X11 versions of QT are available under
> the GPL, and the windows port is
> available gratis for non-commercial use.
Actually that is the pitfall right there. The GPL. There's nothing wrong
with it, but you need to be aware of it. *All* programs that are linked to
qt/free must be GPL. Whereas GTK+, (or the GTKMM/libsigc++ bindings) are
all LGPL which greatly enhances your freedom to use the libraries while
still mainting the open-source nature of the libraries themselves. It's a
good compromise between OSS/Freedom issues and proprietary concerns.
Michael
[reply]
[top]
[»]
Re: Pitfalls ?
by Eric Laffoon - May 10th 2003 20:19:06
>
> %
> %
> % Actually, there has been a GPL
> version
> % of QT available since 2000. See
> % the announcement. Both the embedded
> and
> % X11 versions of QT are available
> under
> % the GPL, and the windows port is
> % available gratis for non-commercial
> use.
>
>
> Actually that is the pitfall right
> there. The GPL. There's nothing wrong
> with it, but you need to be aware of it.
> *All* programs that are linked to
> qt/free must be GPL. Whereas GTK+, (or
> the GTKMM/libsigc++ bindings) are all
> LGPL which greatly enhances your freedom
> to use the libraries while still
> mainting the open-source nature of the
> libraries themselves. It's a good
> compromise between OSS/Freedom issues
> and proprietary concerns.
>
> Michael
>
And here is the real pitfall... arguments about licenses
and commercial use. Originally QT was "evil" because it
was not GPL. Because Trolltech also makes money
selling QT under a commercial license they were initially
nervous about releasing it GPL. This commercial aspect
was considered "evil", in fact RMS issued the LGPL as a
concession to commercial interests. Now you will note
that instead of being too commercial QT is too GPL.
(Never mind that a year of MSN Developer network is
more than a QT license, forgetting .NET etc...)
If you are committed to free software then stick to the
technical questions so even handedly discussed in
previous posts. If you are interested in commercial
development then look at them even harder because
time is money. QT is a good choice on technical merit
for productive use... though I agree with comments that
the actual article leaves a something to be deisred.
[reply]
[top]
[»]
Re: Pitfalls ?
by Michael Torrie - May 10th 2003 21:15:45
> And here is the real pitfall...
> arguments about licenses
> and commercial use. Originally QT was
> "evil" because it
> was not GPL. Because Trolltech also
> makes money
> selling QT under a commercial license
> they were initially
> nervous about releasing it GPL. This
> commercial aspect
> was considered "evil", in fact RMS
> issued the LGPL as a
> concession to commercial interests. Now
> you will note
> that instead of being too commercial QT
> is too GPL.
> (Never mind that a year of MSN Developer
> network is
> more than a QT license, forgetting .NET
> etc...)
Actually the problem was that Trolltech released a "free" qt under the QPL
license, which was more or less compatible with the GPL, except that it
didn't guarrantee that the license wouldn't be revoked or changed in the
future. This was compounded by the fact that KDE developers wanted to GPL
KDE, which they did, but by using the QPL'd QT toolkit, there was some
question as to whether or not this coupling was possible. The relicensing
of QT under the GPL was a good move, as it allowed a truly free environment
o be created, but it preserved the ability of Trolltech to still sell their
toolkit to developers who were developing proprietary software. I like the
GPL, and GPL any programs I write. However in the case of KDE or QT/Free,
you must be aware that the GPL is the only license you can use. No BSD,
no public domain, etc.
I imagine that most people here who are debating the merits of QT are
professional programmers and would like to use it to accellerate their
development process. To any developer, the license is always of grave
concern, whether you are dealing with Microsoft's msvcrt.dll or qt.
>
> If you are committed to free software
> then stick to the
> technical questions so even handedly
> discussed in
> previous posts. If you are interested in
> commercial
> development then look at them even
> harder because
> time is money. QT is a good choice on
> technical merit
> for productive use... though I agree
> with comments that
> the actual article leaves a something to
> be deisred.
[reply]
[top]
[»]
Re: Pitfalls ?
by Johan Thelin - May 14th 2003 21:48:01
>
> %
> %
> % Actually, there has been a GPL
> version
> % of QT available since 2000. See
> % the announcement. Both the embedded
> and
> % X11 versions of QT are available
> under
> % the GPL, and the windows port is
> % available gratis for non-commercial
> use.
>
>
> Actually that is the pitfall right
> there. The GPL. There's nothing wrong
> with it, but you need to be aware of it.
> *All* programs that are linked to
> qt/free must be GPL. Whereas GTK+, (or
> the GTKMM/libsigc++ bindings) are all
> LGPL which greatly enhances your freedom
> to use the libraries while still
> mainting the open-source nature of the
> libraries themselves. It's a good
> compromise between OSS/Freedom issues
> and proprietary concerns.
>
> Michael
>
Since when it it a problem that non-free software cannot use a free
library? Isn't it more right that those who charge for their products get
charged by the developers of the libraries upon which their products are
built? I do not understand this argument. Earlier, Qt wasn't free, now it
is too free?
[reply]
[top]
[»]
Re: Pitfalls ?
by gurensan - Jan 12th 2004 20:42:36
>
> %
> % %
> % %
> % % Actually, there has been a GPL
> % version
> % % of QT available since 2000. See
> % % the announcement. Both the
> embedded
> % and
> % % X11 versions of QT are available
> % under
> % % the GPL, and the windows port is
> % % available gratis for non-commercial
> % use.
> %
> %
> % Actually that is the pitfall right
> % there. The GPL. There's nothing
> wrong
> % with it, but you need to be aware of
> it.
> % *All* programs that are linked to
> % qt/free must be GPL. Whereas GTK+,
> (or
> % the GTKMM/libsigc++ bindings) are all
> % LGPL which greatly enhances your
> freedom
> % to use the libraries while still
> % mainting the open-source nature of
> the
> % libraries themselves. It's a good
> % compromise between OSS/Freedom issues
> % and proprietary concerns.
> %
> % Michael
> %
>
>
> Since when it it a problem that non-free
> software cannot use a free library?
> Isn't it more right that those who
> charge for their products get charged by
> the developers of the libraries upon
> which their products are built? I do not
> understand this argument. Earlier, Qt
> wasn't free, now it is too free?
I don't get this guy's objection either.
switch (use QT for a commercial app){
case TRUE: get a commercial license;
break;
case FALSE: GPL your program;
break;
case SCARED: use another library;
break;
default: develop your own;
break;
}
It's a pretty easy thing to understand.
(This used to be K&R formatted).
[reply]
[top]
[»]
Re: Pitfalls ?
by norman robinson - Jan 29th 2004 22:40:47
% Actually, there has been a GPL version
> of QT available since 2000. See
> the announcement. Both the embedded and
> X11 versions of QT are available under
> the GPL, and the windows port is
> available gratis for non-commercial use.
Actually, it isn't clear that the *windows* port is available for
non-commercial use without exception. It seems that if you are on windows
*at all* you have to pay, although there has been some discussion that you
can freely use the windows port only if the application is GPL licensed.
You'll note the link you provided doesn't mention the windows port at all
- and an hour or so on a search engine will find no clear answer ;)
[reply]
[top]
|
 |