Qt wiki will be updated on October 12th 2023 starting at 11:30 AM (EEST) and the maintenance will last around 2-3 hours. During the maintenance the site will be unavailable.
LibQxt in QtCreator
This article may require cleanup to meet the Qt Wiki's quality standards. Reason: Auto-imported from ExpressionEngine. Please improve this article if you can. Remove the {{cleanup}} tag and add this page to Updated pages list after it's clean. |
h1. How to Use LibQxt with Qt Creator
What is LibQxt?
"LibQxt":http://dev.libqxt.org/libqxt/wiki/Home is an extension library for Qt providing a suite of cross-platform utility classes to add functionality not readily available in the Qt toolkit by Qt Development Frameworks, Digia.
You can find the documentation at http://doc.libqxt.org/
For this guide I'm using windows 7 32bit, Qt 5.0.2 with MinGW, but it should be fairly straight forward for other platforms as well.
Step 1: Download
If you want to compile for Qt 4, the current version would suffice(as of this writing - 26/4/2013 - the most recent stable version of libqxt is v6.0.7). You can download it from "here":http://dev.libqxt.org/libqxt/wiki/Home
If you are using Qt 5, you'll need to download from the latest branch as the commit for Qt 5 compatibility only came in Febuary 2013. Go to "this link ":http://dev.libqxt.org/libqxt/downloads , select the Branches tab and download the master branch. Or you can just "directly download here":http://dev.libqxt.org/libqxt/get/master.zip (http://dev.libqxt.org/libqxt/get/master.zip )
Step 2: Build
Extract the contents of your file to your hard disk. Make sure the directory doesn't have any spaces(e.g "C:Outdoors\Documentsquot;) otherwise it will fail and you probably won't be able to figure our why. For this guide I extract the folder "libqxt-libqxt-7c83e1694ed5" to "C:"
I will also rename "libqxt-libqxt-7c83e1694ed5" to "libqxt-Qt5" because I can't remember a bunch of random numbers and letters.
"Original instructions are here":http://dev.libqxt.org/libqxt/overview . So… you can't just open the pro file in Qt Creator just yet. In windows you will run "configure.bat" in your libqxt directory(in this case it will be located in C:-libqxt-Qt5).
- deselect everything and Shift+Right Click on an empty space in the libqxt directory and select "Open command window here".
- type configure.bat and press enter
- type mingw32-make
If the above steps doesn't work, or if you get an error such as You don't seem to have 'qmake' in your PATH, either make sure you have Qt 5 bin(C:5.0.2\5.0.2\mingw47_32\bin) and mingw(C:5.0.2\Tools\MinGW\bin) folder in your environment paths or that you don't have both Qt 4 and Qt 5 in your environment paths. Mine looks like this: C:5.1.0\5.1.0\mingw48_32\binC:5.1.0\Tools\mingw48_32\bin
Now wait for about 10-15 minutes. After that you will find the library files in the lib folder in the libqxt directory(in our case C:-Qt5\lib) and the header files(C:-Qt5\include).
Step 3: Header Files Fix
If you were to use the library now(for example #include <QxtCsvModel>), even after you add your dependancy path(C:-Qt5\include\QxtCore) you will come with with errors like
D:.h:26: error: QxtCsvModel: No such file or directory
Why is that so? Well, that's because the file QxtCsvModel (with no extensions) only has the line
#include "qxtcsvmodel.h"
When the header file itself is not present! if you go now to Qt 5 directory in C:5.0.2\5.0.2\mingw47_32\include\QtCore there are both blank files and header files side by side. To fix this for libqxt, navigate to the source folder in C:-Qt5\src and open "core" there the header files for qxtcore are located. Arrange the files by type and copy paste all the header files(.h) from C:-Qt5\src\core to C:-Qt5\include\QxtCore
Repeat the same process
C:-Qt5\src\bdb>* C:-Qt5\include\Qxtbdb C:-Qt5\src\designer > C:-Qt5\include\QxtCore C:-Qt5\src\network > C:-Qt5\include\QxtNetwork C:-Qt5\src\sql > C:-Qt5\include\QxtSql C:-Qt5\src\web > C:-Qt5\include\QxtWeb C:-Qt5\src\widgets > C:-Qt5\include\QxtWidgets C:-Qt5\src\zeroconf > C:-Qt5\include\QxtZeroconf
Execute the below commands if you have cygwin or bash to do this quickly
cd /path/to/libqxt/
cp src/bdb/*.h include/Qxtbdb/
cp src/designer/*.h include/QxtCore/
cp src/network/*.h include/QxtNetwork/
cp src/sql/*.h include/QxtSql/
cp src/web/*.h include/QxtWeb/
cp src/widgets/*.h include/QxtWidgets/
cp src/zeroconf/*.h include/QxtZeroconf/
I'm not sure if there are other ways… if you know post in my forum post or simply edit this wiki.
Step 4: Using LibQxt in Your Qt Creator Projects
The best way to learn is by example. Here is a CSV reader and writer made with Qt 5 and the QxtCsvModel: