LibQxt in QtCreator: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
No edit summary
 
No edit summary
Line 1: Line 1:
=How to Use LibQxt with Qt Creator=
h1. How to Use LibQxt with Qt Creator


==What is LibQxt?==
== What is LibQxt? ==


[[Image:logo_qxt.png|libqxtlogo]]
[[Image:https://pvbookmarks.readthedocs.org/en/latest/_images/logo_qxt.png|libqxtlogo]]


[http://dev.libqxt.org/libqxt/wiki/Home LibQxt] ''[dev.libqxt.org]'' 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/


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.
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==
== 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 [http://dev.libqxt.org/libqxt/wiki/Home here] ''[dev.libqxt.org]''
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 [http://dev.libqxt.org/libqxt/downloads this link] ''[dev.libqxt.org]'' , select the Branches tab and download the master branch. Or you can just [http://dev.libqxt.org/libqxt/get/master.zip directly download here] ''[dev.libqxt.org]'' (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:\Users\Bruce Outdoors\Documents\”) 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:\Qt”
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.


[http://dev.libqxt.org/libqxt/overview Original instructions are here] ''[dev.libqxt.org]'' . 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:\Qt\libqxt-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


If the above steps doesn’t work, or if you get an error such as You don’t seem to have ‘qmake’ in your <span class="caps">PATH</span>, either make sure you have Qt 5 bin(C:\Qt\Qt5.0.2\5.0.2\mingw47_32\bin) and mingw(C:\Qt\Qt5.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:\Qt\Qt5.1.0\5.1.0\mingw48_32\bin\;C:\Qt\Qt5.1.0\Tools\mingw48_32\bin'''
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'''


[[Image:_2013-04-26_12-02-02.png|building-libqxt]]
[[Image:https://lh5.googleusercontent.com/-lrK3bKiWyJ0/UXn8zLLiYwI/AAAAAAAABPo/I7kQ75VkATk/w540-h418/_2013-04-26_12-02-02.png|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:\Qt\libqxt-Qt5\lib) and the header files(C:\Qt\libqxt-Qt5\include).
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==
== Step 3: Header Files Fix ==


If you were to use the library now(for example #include &lt;QxtCsvModel&gt;), even after you add your dependancy path(C:\Qt\libqxt-Qt5\include\QxtCore) you will come with with errors like <br /> Why is that so? Well, that’s because the file QxtCsvModel (with no extensions) only has the line<br /> When the header file itself is not present! if you go now to Qt 5 directory in C:\Qt\Qt5.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:\Qt\libqxt-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:\Qt\libqxt-Qt5\src\core to C:\Qt\libqxt-Qt5\include\QxtCore
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
<br />Repeat the same process
<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


Repeat the same process
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>


C:\Qt\libqxt-Qt5\src\bdb '''&gt;''' C:\Qt\libqxt-Qt5\include\Qxtbdb<br /> C:\Qt\libqxt-Qt5\src\designer '''&gt;''' C:\Qt\libqxt-Qt5\include\QxtCore<br /> C:\Qt\libqxt-Qt5\src\network '''&gt;''' C:\Qt\libqxt-Qt5\include\QxtNetwork<br /> C:\Qt\libqxt-Qt5\src\sql '''&gt;''' C:\Qt\libqxt-Qt5\include\QxtSql<br /> C:\Qt\libqxt-Qt5\src\web '''&gt;''' C:\Qt\libqxt-Qt5\include\QxtWeb<br /> C:\Qt\libqxt-Qt5\src\widgets '''&gt;''' C:\Qt\libqxt-Qt5\include\QxtWidgets<br /> C:\Qt\libqxt-Qt5\src\zeroconf '''&gt;''' C:\Qt\libqxt-Qt5\include\QxtZeroconf
I'm not sure if there are other ways… if you know post in my forum post or simply edit this wiki.


Execute the below commands if you have cygwin or bash to do this quickly<br />
== Step 4: Using LibQxt in Your Qt Creator Projects ==


I’m not sure if there are other ways… if you know post in my forum post or simply edit this wiki.
The best way to learn is by example. Here is a CSV reader and writer made with Qt 5 and the QxtCsvModel:


==Step 4: Using LibQxt in Your Qt Creator Projects==
http://wiki.qt.io/Handling_CSV


The best way to learn is by example. Here is a <span class="caps">CSV</span> reader and writer made with Qt 5 and the QxtCsvModel:
[[Image:https://lh3.googleusercontent.com/-b5m3QxX8pyM/UXoGGXu2_lI/AAAAAAAABP4/7rkLeGfcEuY/w587-h293/_2013-04-26_12-43-19.png|minicsvprogram]]
 
[[Handling CSV|http://wiki.qt.io/Handling_CSV]]
 
[[Image:_2013-04-26_12-43-19.png|minicsvprogram]]
 
And that’s it! Feedback and discussions please go to http://forum.qt.io/viewthread/27167/

Revision as of 14:38, 23 February 2015

h1. How to Use LibQxt with Qt Creator

What is LibQxt?

libqxtlogo

"LibQxt&quot;: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&quot;: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&quot;: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&quot; to "C:"

I will also rename "libqxt-libqxt-7c83e1694ed5&quot; to "libqxt-Qt5&quot; because I can't remember a bunch of random numbers and letters.

"Original instructions are here&quot;: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&quot; 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&quot;.
  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&gt;), even after you add your dependancy path(C:-Qt5\include\QxtCore) you will come with with errors like

<br />D:.h:26: error: QxtCsvModel: No such file or directory<br />


Why is that so? Well, that's because the file QxtCsvModel (with no extensions) only has the line

<br />#include &quot;qxtcsvmodel.h&amp;quot;<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 "core&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


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

<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 />

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