Qt hidden gems

As it happens to me usually, talking on IRC revealed another interesting topic to talk about. One developer was asking a question why part of his application window suddenly became blank after the mouse entered the window. Even though it's not really my area of expertise, I guessed it was related to painting, so after some conversation, I ended up suggesting setting the QT_FLUSH_PAINT environment variable, which causes the Qt painting system to paint the update regions yellow.

That reminded me of a BoF session my good friend Simon Hausmann gave at Akademy 2007 where he was going over a list of hidden gems. So I thought it was high time to rehash that list and tell you about it. By the way, if I'm not mistaken, the first inception of the Qt "tracer" graphics system was created by an audience member during Simon's session (I think it was Mirko Böhm, but I'm not sure now).

So what are the Qt hidden gems? I've collected a list for Qt, Qt Creator and Qt WebKit. Unfortunately, I don't know the Qt Mobility source code that well, so I couldn't create a list for that project.

Qt configure-time options

-developer-build
Enables "developer mode" for Qt, which means unit tests and some extra functionality is built in and exported. This also causes the Qt private headers to be installed. It's meant for testing and developing Qt, so not for the faint of heart. And if you start using the private headers in your applications, I will have to hunt you down.
-fast and -no-fast (Unix only)
Enables fast compilation of Qt, as opposed to slow compilation.
-no-gui (Unix only)
Disables building of any GUI part of Qt. Undocumented and unsupported.
-no-core (Unix only)
Disables building of QtCore and its dependencies. Undocumented and unsupported.

Environment variables (runtime)

QT_FLUSH_PAINT=milliseconds
Causes the Qt painting system to paint the updated region yellow for milliseconds before it does the actual painting. Trivia: the function that does this operation is called QWidgetBackingStore::showYellowThing in src/gui/painting/qwidgetbackingstore.cpp.
QT_SIGNALSLOT_DELAY_MULTIPLIER=number
A factor to be used in multiplying the delivery speed of signals and slots, to aid in debugging signal-slot connections. Values > 1 will cause delivery to be slower.
QT_NET_USE_RFC3514=1
Causes the Qt networking stack to open sockets using the security extensions proposed by RFC 3514 on systems that support it (currently only FreeBSD). See also QTBUG-18517.
QT_HTTP_NO_418=1
Disables support for web servers returning the HTTP 418 status code. Meant for debugging only for broken servers.
QT_NO_FILESYSTEM=1
Allows Qt to run on systems without a filesystem. On systems with a filesystem, this is useful to aid debugging applications that are meant to run on systems without file support.
QT_NO_KIA=1
Disables the Qt extensions to the Automotive segment. This enables only the Mobile segment extensions.
QT_NO_FREE=1
Enable an alternative memory allocation strategy that improves the chances for avoiding dereferencing dangling pointers.
QT_NO_EIEIO=1
This is variable has two meanings, depending on the system you're running. On the Power PC architecture, it disables the in-order execution of I/O. On some other systems, it will also disable catching of fatal system errors.
QT_NO_BUGS=1
Disables Qt quirky behaviour compatibility mode, enables strict-conforming behaviour. This requires the compiler option -fkeep-programmers-inline.
QT_NO_MEMORY=1
Useful for debugging running Qt in out-of-memory situations.
QT_NO_MALLOC=1
Extreme memory conservation, implies QT_NO_FREE but conflicts with QT_NO_MEMORY.
QT_NO_QT=1
Disable all Qt features (implies QT_NO_BUGS).
QT_PREDICT_FUTURE=1
Enables QtConcurrent finishing tasks before the results are calculated.

Qt Creator options (runtime)

QTCREATOR_NO_CODE_INDEXER=1
Disables the Qt Creator code indexer. Useful for low-powered or old workstations with not enough RAM.
QTCREATOR_NO_CODE_EDITOR=1
Disables the Qt Creator code editor. Meant for specialists and hackers who don't need to edit code.
CPLUSPLUS_DEBUG=1
Causes the C++ code analyser to print some debugging information. Meant for debugging the analyser, but the information printed can be used to find out problems in the user's code, especially when the compiler error messages aren't very informative.
CPLUSPLUS_CORRECT_MISTAKES=1
Causes the C++ code analyser to correct flaws and bugs in the user code, not just highlight them. Experimental feature.
CPLUSPLUS_IS_C=1
Makes the C++ code analyser interpret all C++ source files as if they were C, disabling C++-specific keywords.
CPLUSPLUS_IS_B=1
Makes the C++ code analyser interpret all C++ and C source files as if they were B. Experimental.

QtWebKit

WEBKIT2_PAUSE_WEB_PROCESS_ON_LAUNCH=1
Pauses the WebKit 2 worker process on launch, allowing a debugger to be attached.
WEBKIT_PAUSE_WEB_PROCESSING=1
Pauses the WebKit 1 normal processing.
WEBKIT_GOPHER_COMPAT=1
Enables WebKit compatibility for the gopher protocol.
WEBKIT_THIS_IS_1995=1
Disables support for HTML 3 and above.

Blog Topics:

Comments