diff options
Diffstat (limited to 'doc/html/commonproblems.html')
-rw-r--r-- | doc/html/commonproblems.html | 217 |
1 files changed, 217 insertions, 0 deletions
diff --git a/doc/html/commonproblems.html b/doc/html/commonproblems.html new file mode 100644 index 0000000..709d5d6 --- /dev/null +++ b/doc/html/commonproblems.html @@ -0,0 +1,217 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/doc/misc.doc:37 --> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> +<title>Brief Technical FAQ</title> +<style type="text/css"><!-- +fn { margin-left: 1cm; text-indent: -1cm; } +a:link { color: #004faf; text-decoration: none } +a:visited { color: #672967; text-decoration: none } +body { background: #ffffff; color: black; } +--></style> +</head> +<body> + +<table border="0" cellpadding="0" cellspacing="0" width="100%"> +<tr bgcolor="#E5E5E5"> +<td valign=center> + <a href="index.html"> +<font color="#004faf">Home</font></a> + | <a href="classes.html"> +<font color="#004faf">All Classes</font></a> + | <a href="mainclasses.html"> +<font color="#004faf">Main Classes</font></a> + | <a href="annotated.html"> +<font color="#004faf">Annotated</font></a> + | <a href="groups.html"> +<font color="#004faf">Grouped Classes</font></a> + | <a href="functions.html"> +<font color="#004faf">Functions</font></a> +</td> +<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>Brief Technical FAQ</h1> + + +This document describes how to use more than one Qt version on one +machine and how to use Qt on X11 without a window manager. In addition +it explains the most common source of link errors with Qt. +<p> Other frequently asked questions can be found in the +<a href="http://www.trolltech.com/developer/faqs/">FAQ index</a> and +in the <a href="http://www.trolltech.com/developer/faqs/technical.html">Technical FAQ</a>. +<p> <ul> +<li> <a href="#linkerror">Link error, complaining about a lack of +<tt>vtbl</tt>, <tt>_vtbl</tt>, <tt>__vtbl</tt> or similar</a> +<li> <a href="#diffver">Using different versions of Qt on the same +machine</a> +<ul> +<li> <a href="#qtbin">Developers building for a single version of Qt on Unix - Qt binary packages</a> +<li> <a href="#qtsrc">Developers building for two versions of Qt on Unix - Qt sources</a> +</ul> +<li> <a href="#nowinman">Using Qt on X11 without a window manager</a> +<li> <a href="distributingqt.html">Distributing Qt Applications</a> +</ul> +<p> <a name="linkerror"></a> +<h2> Link error, complaining about a lack of <tt>vtbl</tt>, <tt>_vtbl</tt>, <tt>__vtbl</tt> or similar +</h2> +<a name="1"></a><p> This indicates that you've included the <a href="metaobjects.html#Q_OBJECT">Q_OBJECT</a> macro in a class +declaration and probably also run the <a href="moc.html#moc">moc</a>, but forgot to link the +moc-generated object code into your executable. See <a href="moc.html">Using the Meta Object Compiler</a> for details on how to use moc. +<p> <a name="diffver"></a> +<h2> Using different versions of Qt on the same machine +</h2> +<a name="2"></a><p> Qt programs need the following components of a Qt distribution: +<p> <dl> +<p> <dt>Header files - Compile time +<p> <dd>Programmers need to include the Qt header files. The Qt header files +are usually located in the <tt>include</tt> subdirectory of Qt distributions. +Care must be taken to include the header files of the relevant release of +Qt. Those with a command-line compiler will typically use options such as +<tt>/I%QTDIR%\include</tt> + +the relevant release of Qt. +<p> <dt>Meta Object Compiler and other tools - Compile time +<p> <dd>Programmers need to run <em>moc</em> and other tools such as <em>uic</em>. These +tools are usually located in the <tt>bin</tt> subdirectory of Qt distributions. +Either run <tt>"$QTDIR"/bin/moc</tt> and <tt>"$QTDIR"/bin/uic</tt> or add <tt>"$QTDIR"/bin</tt> +to your <tt>PATH</tt> and run <a href="moc.html#moc">moc</a> and <tt>uic</tt>. If you use <tt>qmake</tt> the +appropriate lines will be added to your Makefiles so that <em>uic</em> and +<em>moc</em> will be executed as required. +<p> <dt>Static or shared libraries - Link time +<p> <dd>Programmers need to link with the Qt static or shared libraries. The Qt +libraries are usually located in the <tt>lib</tt> subdirectory of Qt distributions. +Care must be taken to link with the libraries of the relevant release of +Qt. Those with a command-line compiler will typically use options such as +<tt>/L%QTDIR%\lib\qt.lib</tt> or <tt>-L"$QTDIR"/lib</tt> <tt>-lqt</tt> provided <tt>QTDIR</tt> +specifies the relevant release of Qt. +<p> <dt>Shared libraries - Run time +<p> <dd>Users of programs linked with shared Qt libraries need these same +shared libraries to run these programs. The Qt libraries are usually +located in the <tt>lib</tt> subdirectory of Qt distributions. Shared libraries +are made available to programs in places such as <tt>C:\windows\system</tt> on +Windows platforms, directories listed in file <tt>/etc/ld.so.conf</tt> on Linux, +standard <tt>lib</tt> directories on Unix, or directories listed in environment +variables <tt>LD_LIBRARY_PATH</tt>, <tt>SHLIB_PATH</tt>, or <tt>LIBPATH</tt> on various Unix +flavours. Make the relevant Qt libraries available using one of these +mechanisms. +<p> </dl> +<p> Qt distributions consist of different files needed at compile time, +link time, or run time. Trolltech distributes Qt in the form of a +source package that contain all these files once they have been built. +<p> Other vendors distribute Qt in the form of binary packages. Binary packages +usually consist of two parts: +<p> <ul> +<li> shared libraries in the run time package, usually called <tt>qt3</tt>. +<p> <li> header files, static libraries, the moc and other tools in the developers' +kit, usually called <tt>qt3-dev</tt>. +<p> </ul> +<p> Depending on how you are using Qt, you need to make specific parts of +the Qt distribution available to your programs. Typical situations are +described below. +<p> <a name="qtbin"></a> +<h3> Developers building for a single version of Qt on Unix - Qt binary packages +</h3> +<a name="2-1"></a><p> You build programs with a single version of Qt, but you still need +to run programs linked with another version of Qt. You are typically +a Linux developer who builds programs for Qt 3.x on a KDE desktop based +on Qt 2.x. Qt packages are usually split into a shared library +package with a name like <tt>qt</tt> and a developer package with a name +like <tt>qt-dev</tt>. You will need the appropriate packages: +<p> <ul> +<p> <li> To build programs you will need the header files, the libraries, +the moc and other tools from Qt 3.x. They are included in the developer +package of Qt 3.x (<tt>qt3-dev</tt> or similar). +<p> <li> To run programs you will need the shared libraries of Qt 3.x and +Qt 2.x. They are included in the regular packages of Qt 3.x (<tt>qt3</tt> +or similar) and Qt 2.x (<tt>qt2</tt> or similar). +<p> </ul> +<p> Just install the packages, <tt>qt2</tt>, <tt>qt3</tt>, and <tt>qt3-dev</tt>. You may +need to set the environment variable <tt>QTDIR</tt> to point to Qt 3.x. +<p> <a name="qtsrc"></a> +<h3> Developers building for two versions of Qt on Unix - Qt sources +</h3> +<a name="2-2"></a><p> You build and run programs for Qt 2.x and Qt 3.x. You will need: +<p> <ul> +<p> <li> the header files, the libraries, the moc and other tools from Qt 3.x +and Qt 2.x to build programs, +<p> <li> the shared libraries of Qt 3.x and Qt 2.x to run programs. +<p> </ul> +<p> Get the source distributions of both Qt 2.x and Qt 3.x. +<p> <ol type=1> +<p> <li> Install and build Qt 2.x and Qt 3.x, usually in <tt>/opt</tt> or +<tt>/usr/local</tt>. In the case of <tt>/opt</tt>: +<p> <pre> +$ cd /opt +$ gunzip -c \c qt-x11-2.3.1.tar.gz | tar xf - +$ cd qt-2.3.1 +$ setenv QTDIR /opt/qt-2.3.1 +$ configure [options] +$ make + +$ cd /opt +$ gunzip -c qt-x11-free-3.0.0.tar.gz | tar xf - +$ cd qt-3.0.0 +$ setenv QTDIR /opt/qt-3.0.0 +$ configure [options] +$ make +</pre> + +<p> <li> Make shared libraries available to programs at run time. Either +add both <tt>/opt/qt-2.3.1/lib</tt> and <tt>/opt/qt-3.0.0/lib</tt> to your environment +variable <tt>LD_LIBRARY_PATH</tt> or file <tt>/etc/ld.so.conf</tt> or whataver mechanism +you're using, or make links to the libraries in a standard directory like +<tt>/usr/local/lib</tt>: +<p> <pre> +cd /usr/local/lib +ln -s /opt/qt-2.3.1/lib/libqt.so.2 . +ln -s /opt/qt-2.3.1/lib/libqt-mt.so.2 . +ln -s /opt/qt-2.3.1/lib/libqutil.so.1 . +ln -s /opt/qt-3.0.0/lib/libqt.so.3 . +ln -s /opt/qt-3.0.0/lib/libqui.so.1 . +</pre> + +<p> </ol> +<p> To develop with Qt 2.x use: +<p> <pre> +setenv QTDIR /opt/qt-2.3.1 +setenv PATH ${QTDIR}/bin:${PATH} +</pre> + +<p> To develop with Qt 3.x use: +<p> <pre> +setenv QTDIR /opt/qt-3.0.0 +setenv PATH ${QTDIR}/bin:${PATH} +</pre> + +<p> Setting <tt>QTDIR</tt> ensures that the proper resources are used, such as the +documentation appropriate to the version of Qt you're using. Also +your Makfiles may refer to <tt>"$QTDIR"/include</tt> and <tt>"$QTDIR"/lib</tt> to +include the proper header files and link with the proper libraries. +Setting the <tt>PATH</tt> ensures that the proper version of moc and other +tools is being used. +<p> <a name="nowinman"></a> +<h2> Using Qt on X11 without a window manager +</h2> +<a name="3"></a><p> When using Qt without a window manager on Unix/X11, you will most +likely experience focus problems. Without a window manager, there is +no focus handling on X11, and no concept of an active window +either. If you want your application to work in such an environment, +you have to explicitly mark a window as active <em>after</em> showing it: +<p> <pre> + yourWindow->show(); + yourWindow->setActiveWindow(); +</pre> + +<p> Note that setActiveWindow() won't work if the widget does not become +physically visible during this event cycle. However, without a window +manager running, this is guaranteed to happen. For the curious reader: +setActiveWindow() emulates a window manager by explicitly setting the +X Input Focus to a widget's top level window. +<p> +<!-- eof --> +<p><address><hr><div align=center> +<table width=100% cellspacing=0 border=0><tr> +<td>Copyright © 2007 +<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a> +<td align=right><div align=right>Qt 3.3.8</div> +</table></div></address></body> +</html> |