PDA

View Full Version : QT 4.4: CLI apps?



Hossie
17th May 2008, 20:04
QT 4.4 has become modular as far as I can see. Does that mean we can create pure CLI apps with QT, only using QRegExp for example? QTGui is a "module", too.

This is probably possible in < QT 4.4, but does that mean we can link such programs without any X11 libraries, if we only use non-gui modules?

marcel
17th May 2008, 20:15
All modules depend on QtCore, which implements all base functionality and classes.
I assume you could marshall a Qt module to a managed application just as you do with a normal library...

Hossie
17th May 2008, 20:29
So, does QtCore depend on X11 libraries?

jpn
17th May 2008, 20:47
Nope, QtCore doesn't depend on X11.

totycro
19th May 2008, 11:13
I'm currently writing a CLI application using Qt4, and it works fine.
You just have to put "QT -= gui" in your .pro file and use QCoreApplication instead of QApplication.

Hossie
19th May 2008, 11:19
Does this already work with QT 4.3?

jpn
19th May 2008, 11:37
Yes, it works since Qt 4.0. QtCore and QtGui modules are enabled by default. To change included modules, change contents of the QT variable (notice: "QT", not "Qt") in the .pro file. There are different ways to change the variable, for example:

QT -= gui # remove gui which is turned on by default
or

QT = core network # set modules to core and network
For more details, take a look at qmake manual (http://doc.trolltech.com/4.4/qmake-manual.html).