PDA

View Full Version : KDevelop and Qt4



high_flyer
27th January 2006, 00:41
I have the following problem:
When I just istalled the new SUSE10 (ftp install), I saw it installed Qt4 and Qt3 in parallel, and my KDevelop could create a Qt4 projects, with the righ includes (i.e <QtCore/QApplication>) and compiled and linked ok.
But for various reasons I had to undinstall Qt4.

Then I reinstalled Qt4.
Since then I can't get KDevelop to generate Qt4 projects (the option is just no there).
I searched the Internet, and from what I could find out, ony KDevelop3.4 (unstable) supports Qt4.
But as I said, at least once I had SUSE's KDevelop (which is defenitively not more then 3.3) created Qt4 projects...

Can any one share with me if and how they work (installed) with KDevelop and Qt4 (prefferably under SUSE10)?

Thanks.

KjellKod
27th January 2006, 10:38
I'm running Qt3 and Qt4 and using both with KDevelop.
setenv QTDIR /usr/lib/qt4 (and vice versa for QT3) before I start KDevelop from command line.

I have not used KDevelop to create QT4 projects. But I use KDevelop to import an existing QT4 project, and to compile the code there without any problems.

Also to make code completion work you need the source for QT4. Then just include the source as you would normally do when including an external library (Projects->Project Options->C++ Specific->Code Completion->Add->KDevelop Custom Directory PCS Importer).

I'm not sure this was exactly what you needed, but I hope it helps.

macabre
27th January 2006, 13:37
I believe KDevelop uses the environment variables - if QTDIR and your PATH are set to QT4, then it should use QT4's qmake, etc.

high_flyer
27th January 2006, 13:45
I believe KDevelop uses the environment variables - if QTDIR and your PATH are set to QT4, then it should use QT4's qmake, etc.
But if you add a new class, it will add the wrong includes, and you wont be able to create new projects.
You will be able to use it as KjellKod wrote.
But since I already had KDevelop that generated Qt4 projects, I'd like to have it again.
Very strange that whole thing...

krawek
27th January 2006, 15:13
Hi,

you need set QTDIR and PATH...

I make a patch for solve any problems with Qt4 support:

http://bugs.kde.org/show_bug.cgi?id=101084
http://bugs.kde.org/show_bug.cgi?id=120802

OldJohnB
29th January 2006, 01:32
I am interested in all the discussion on this topic since I have been wanting to move up to Qt4. However, I am running Fedora4 and I believe this is based on Qt3.3, KDE3.5 and KDevelop3.3 and I have been concerned that KDE3.5 would not work if I changed to Qt4. Is everything backwards compatible or should I wait until KDE issues its next version which will hopefully be based on Qt4???

OldJohnB

kandalf
29th January 2006, 01:48
Is everything backwards compatible or should I wait until KDE issues its next version which will hopefully be based on Qt4???

No it's not, it is possible to develop Qt3 compatible applications with Qt4, anyways, you don't need to replace one for another, you can have both installed, just need to set up your environment for one or the other when you need.
I recommend you compile Qt4 for development and install it in a custom location e.g. /usr/local/Qt4 and set QTDIR and PATH to point that location when you're developing with Qt4.

Hope it helps.

Cheers.

vfernandez
30th January 2006, 19:26
I'm running SUSE 10 with KDevelop 3.3 and I'm developing a project with QT4. I don't find much problems. When I create a new class and check "Generate a child class of QWidget", it creates the proper includes (i.e. #include <QWidget>). Just go to Project - Project options, then C++ specific, tab "Qt", and set the proper version of QT. In "Path to QT root" I have "/usr/lib". The only thing that is not working properly for me is the inclusion of images in the project. When I include some icons to use with QAction and run qmake, the Makefile has uic3 instead of uic (which is in fact uic from QT4):


qmake_image_collection.cpp: 16_connect_creating.png 16_exit.png

/usr/bin/uic3 -embed ../bin/siouk 16_connect_creating.png 16_exit.png -o qmake_image_collection.cpp


So it gives a compiling. I don't know why this happens but it seems related to QT itself, not to KDevelop.

GreyGeek
30th January 2006, 22:08
I am interested in all the discussion on this topic since I have been wanting to move up to Qt4. However, I am running Fedora4 and I believe this is based on Qt3.3, KDE3.5 and KDevelop3.3 and I have been concerned that KDE3.5 would not work if I changed to Qt4. Is everything backwards compatible or should I wait until KDE issues its next version which will hopefully be based on Qt4???

OldJohnB

I am running SimplyMEPIS 3.4.3-rc2 upgraded to KDE 3.5 and I have no trouble developing QT4 apps under it. I use Kate and the console terminal that Kate supplies. I execute this command in the terminal:


QTDIR=/usr/share/qt4;export QTDIR

to set the proper QTDIR definition. Then I issue qmake commands with


$QTDIR/bin/qmake

The make command depends on the Makefile settings, which were created with the qmake command above, so I don't need to condition its execution.

The editing and compiling work great. I issue the "designer-qt4" command from that terminal to get a properly running QT4 designer.

And, I have no problem running KDE 3.5 or its applications. In fact, KDE 3.5 has given me the best KDE installation I've ever run.

OldJohnB
30th January 2006, 23:43
Thanks for all the suggestions. I now have lots to try.

Cheers :)

high_flyer
31st January 2006, 10:31
I'm running SUSE 10 with KDevelop 3.3 and I'm developing a project with QT4. I don't find much problems. When I create a new class and check "Generate a child class of QWidget", it creates the proper includes (i.e. #include <QWidget>). Just go to Project - Project options, then C++ specific, tab "Qt", and set the proper version of QT. In "Path to QT root" I have "/usr/lib". The only thing that is not working properly for me is the inclusion of images in the project. When I include some icons to use with QAction and run qmake, the Makefile has uic3 instead of uic (which is in fact uic from QT4):


qmake_image_collection.cpp: 16_connect_creating.png 16_exit.png

/usr/bin/uic3 -embed ../bin/siouk 16_connect_creating.png 16_exit.png -o qmake_image_collection.cpp


So it gives a compiling. I don't know why this happens but it seems related to QT itself, not to KDevelop.

You are describing the state I had my self, which I am trying to have again, but can't fegure out how to.
Do mean you have an extra tab named Qt? (in project options)
And in that tab you can set Qt4?

Everall
2nd February 2006, 15:55
Do mean you have an extra tab named Qt? (in project options)
And in that tab you can set Qt4?

Maybe you are using different versions of kdevelop. My kdevelop version 3.2.0 doesn't have that tab either.

from www.kdevelop.org :
KDevelop 3.3 release Announcement

The main focus of this release was the improvement of the integrated debugger and the new QT4 support.

You can read more details at :
http://www.kdevelop.org/index.html?filename=3.3/announce-kdevelop-3.3.html

high_flyer
2nd February 2006, 16:41
Thanks I'll look it up.

high_flyer
2nd February 2006, 23:04
Ok, I installed KDevelop 3.3.0.
But my KDevelop does not have a QT4 option in the project options...:confused:
If I manualy create a Qt4 project, and start KDevelop it with PATH pointing at QT4, it will compile, but I have no Qt4 option to set nowhere...
I can't understand how other poeple have that option...
Ofcourse, the project generator generates Qt3 project...
Hmm...

Any idea what I could be doing wrong?

EDIT:
Ahhh, found it.! :)
Its not under the current project option under the the make manager, but under the general project option accessable form the Project menu.

high_flyer
7th February 2006, 19:39
qmake_image_collection.cpp: 16_connect_creating.png 16_exit.png

/usr/bin/uic3 -embed ../bin/siouk 16_connect_creating.png 16_exit.png -o qmake_image_collection.cpp

So it gives a compiling. I don't know why this happens but it seems related to QT itself, not to KDevelop.

The compilation error is generated because in order to embed an image the Qt3 uic is used (I don't know why), but I guess that through the Qt config files Qt4 knows to add the right code for Qt4.
This means however, that you need to add the Qt3 supprt in Qt4.
Add :
QT += qt3support
to your pro file, qmake it, and run make.
It should compile.

high_flyer
8th February 2006, 21:59
The compilation error is generated because in order to embed an image the Qt3 uic is used (I don't know why)
Ok, I know now why.
Qt4 has resource system.
From the docs:

The Qt resource system is a platform-independent mechanism for storing binary files in the application's executable. This is useful if your application always needs a certain set of files (icons, translation files, etc.) and you don't want to run the risk of losing the files.
The resource system is based on tight cooperation between qmake, rcc (Qt's resource compiler), and QFile. It obsoletes Qt 3's qembed tool and the image collection mechanism.

huet
27th March 2006, 22:27
Hello,

I am using Suse 10 with KDevelop 3.3.1 and Qt 4. I can compile my app and run it fine but unfortunately I lost the ability to debug it with breakpoints since I integrated Qt :-( I found a post on the web with the exact same problem and description (see below), but unfortunately no answer... I use CONFIG += qt debug thread warn_on and in the generated Makefile I set -g and -O0.

http://linux.derkeiler.com/Newsgroups/comp.os.linux.development.apps/2005-05/0253.html

Any ideas ?


best regards,


Christobal

glocker50
19th August 2006, 16:44
This means however, that you need to add the Qt3 supprt in Qt4.
Add :
QT += qt3support
to your pro file, qmake it, and run make.
It should compile.

Once you edit the .pro file manually, you can not use the qmake manager anymore. It overwrites the contents of the .pro file.

How can you add the qt3support via the Kdevelop qmake manager ? Or is this not possible ?

Cedric.

jacek
19th August 2006, 17:05
How can you add the qt3support via the Kdevelop qmake manager ? Or is this not possible ?
I have KDevelop 3.3.4 and QT variable is listed in custom variables tab (or whatever it's called in English version). It's the last tab in project configuration dialog (the one from qmake manager).

high_flyer
19th August 2006, 23:51
Another option is just to add -lQt3Support to the external libraries in your project.

jacek
20th August 2006, 00:33
Another option is just to add -lQt3Support to the external libraries in your project.
What about #ifdef QT3_SUPPORT? There's a lot of them in Qt headers.

high_flyer
20th August 2006, 02:22
What about #ifdef QT3_SUPPORT? There's a lot of them in Qt headers.
I am not syre what do you mean with that.
You need to link against the Qt3 support lib if you want to use the Qt3 support classes...
How do you want to uese the #ifdef for that? with adding dynamic linking in the code?
Its possible, but lots of work... much easier just to add a -l to the libs list...

jacek
20th August 2006, 02:39
much easier just to add a -l to the libs list...
But adding -lQt3Support to LIBS is not enough.

For example lets take QString header:


...
#ifdef QT3_SUPPORT
inline QT3_SUPPORT const char *ascii() const { return ascii_helper(); }
inline QT3_SUPPORT const char *latin1() const { return latin1_helper(); }
...

Without QT3_SUPPORT defined, compiler won't see those methods.

QT += something does more than LIBS += -lsometing.

high_flyer
20th August 2006, 02:44
oh, now I see what you meant...
One sould ofcourse add the QT3_SUPPORT define to the make parameters under "build options->defines"

glocker50
20th August 2006, 14:41
Hello,

I am using Suse 10 with KDevelop 3.3.1 and Qt 4. I can compile my app and run it fine but unfortunately I lost the ability to debug it with breakpoints since I integrated Qt :-( I found a post on the web with the exact same problem and description (see below), but unfortunately no answer... I use CONFIG += qt debug thread warn_on and in the generated Makefile I set -g and -O0.


It works on my system (Kdevelop 3.3.4 and Qt 4.1.4). In the .pro file, i have :
QT = core gui debug
CONFIG += debug warn_on
Don't forget to clean the project, recompile it and run in debugger mode. If you modify settings in qmake manager it does not recompile by default.

Cedric.