LibQxt in QtCreator: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 5: Line 5:
[[Image:https://pvbookmarks.readthedocs.org/en/latest/_images/logo_qxt.png|libqxtlogo]]
[[Image:https://pvbookmarks.readthedocs.org/en/latest/_images/logo_qxt.png|libqxtlogo]]


"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.
"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/
You can find the documentation at http://doc.libqxt.org/
Line 13: Line 13:
== Step 1: Download ==
== 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 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 )
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 ==
== 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:"
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.
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).
"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".
# 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 configure.bat and press enter
# type mingw32-make
# type mingw32-make
Line 37: Line 37:
== Step 3: Header Files Fix ==
== Step 3: Header Files Fix ==


If you were to use the library now(for example #include &lt;QxtCsvModel&amp;gt;), even after you add your dependancy path(C:-Qt5\include\QxtCore) you will come with with errors like<br /><code><br />D:.h:26: error: QxtCsvModel: No such file or directory<br /></code><br />Why is that so? Well, that's because the file QxtCsvModel (with no extensions) only has the line<br /><code><br />#include &quot;qxtcsvmodel.h&amp;quot;<br /></code><br />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 &quot;core&amp;quot; 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
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
<br />Repeat the same process
<code>
<br />C:-Qt5\src\bdb'''&gt;* C:-Qt5\include\Qxtbdb<br />C:-Qt5\src\designer '''&gt;''' C:-Qt5\include\QxtCore<br />C:-Qt5\src\network '''&gt;''' C:-Qt5\include\QxtNetwork<br />C:-Qt5\src\sql '''&gt;''' C:-Qt5\include\QxtSql<br />C:-Qt5\src\web '''&gt;''' C:-Qt5\include\QxtWeb<br />C:-Qt5\src\widgets '''&gt;''' C:-Qt5\include\QxtWidgets<br />C:-Qt5\src\zeroconf '''&gt;''' C:-Qt5\include\QxtZeroconf
D:.h:26: error: QxtCsvModel: No such file or directory
</code>
Why is that so? Well, that's because the file QxtCsvModel (with no extensions) only has the line
<code>
#include "qxtcsvmodel.h"
</code>
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


Execute the below commands if you have cygwin or bash to do this quickly<br /><code><br />cd /path/to/libqxt/<br />cp src/bdb/*.h include/Qxtbdb/<br />cp src/designer/*.h include/QxtCore/<br />cp src/network/*.h include/QxtNetwork/<br />cp src/sql/*.h include/QxtSql/<br />cp src/web/*.h include/QxtWeb/<br />cp src/widgets/*.h include/QxtWidgets/<br />cp src/zeroconf/*.h include/QxtZeroconf/<br /></code>
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
<code>
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/
</code>


I'm not sure if there are other ways… if you know post in my forum post or simply edit this wiki.
I'm not sure if there are other ways… if you know post in my forum post or simply edit this wiki.

Revision as of 09:02, 25 February 2015

h1. How to Use LibQxt with Qt Creator

What is LibQxt?

libqxtlogo

"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).

  1. deselect everything and Shift+Right Click on an empty space in the libqxt directory and select "Open command window here".
  2. type configure.bat and press enter
  3. 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

building-libqxt

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:

http://wiki.qt.io/Handling_CSV

minicsvprogram