Author Topic: Using CB to develop Qt application  (Read 21771 times)

liweifuj

  • Guest
Using CB to develop Qt application
« on: November 26, 2005, 03:24:28 pm »
Hello,

Just download this CB RC2(with MINGW), now want to use it to design Qt application, but due to not familiar with CB environment, hope can get an advise to configure the work. My OS is windows XP, Qt edition is 4.0. Thanks.


David
« Last Edit: November 26, 2005, 03:26:16 pm by liweifuj »

Offline yop

  • Regular
  • ***
  • Posts: 387
Re: Using CB to develop Qt application
« Reply #1 on: November 26, 2005, 03:38:21 pm »
You can search the forum for some answers to your question (search for qt and qmake ;))
Life would be so much easier if we could just look at the source code.

liweifuj

  • Guest
Re: Using CB to develop Qt application
« Reply #2 on: November 27, 2005, 01:59:23 am »
Hi Yop,

Since the RC2 has included Qt project, I'd like to know how to configure the edit and compile environment. Because I find there 2 compile settings , one in the Build menu, and the other in Settings menu. Please advise which compile environment configure is must be done, how to import qmake . thanks.

sethjackson

  • Guest
Re: Using CB to develop Qt application
« Reply #3 on: November 27, 2005, 02:02:55 am »
Hi Yop,

Since the RC2 has included Qt project, I'd like to know how to configure the edit and compile environment. Because I find there 2 compile settings , one in the Build menu, and the other in Settings menu. Please advise which compile environment configure is must be done, how to import qmake . thanks.

The one in the settings menu is global the one in the build menu is for your current project only.

Offline yop

  • Regular
  • ***
  • Posts: 387
Re: Using CB to develop Qt application
« Reply #4 on: November 27, 2005, 10:30:08 am »
Write a custom .pro file for your project and sav it in the project dir. See http://doc.trolltech.com/4.0/qmake-manual.html
In tools menu add a tool:
Name: QMake
Executable: QTDIR/bin/qmake   (replace QTDIR)
Parameters: -o Makefile.qmake   (or whatever name you want)
Working Dir: ${PROJECTDIR}

In Settings->Compiler Settings->Other select "build using makefiles" (not sure if needed anymore)
In Project->Properties tick "This is a custom makefile" and write Makefile.qmake in the Makefile:

Now select Tools->QMake and then Build->Build and voila
Be warned that you overide the whole build system of codeblocks and that you have to write the .pro file yourself (qmake can also generate one for you but I like writing my own).

And as of my Qt plugin status it can build :) I am almost finished with the .pro generator and from there on it's all about making it user friendly ;)
Life would be so much easier if we could just look at the source code.

lucaciti

  • Guest
Re: Using CB to develop Qt application
« Reply #5 on: December 14, 2005, 05:47:12 pm »
I managed to integrate quite well (at least for my needs) QT4 with Code::Blocks.
If you follow the attached instructions you can:
- create new QT apps from a template
- invoke the qt designer to edit forms from within Code::Blocks
- let Code::Blocks automatically create the .pro file
- let Code::Blocks build release and debug targets
- interactively debug your QT app with Code::Blocks
I hope this helps as is or (better) can stimulate further improvements.
Cheers,
Luca


-------------------------------------------------------------------
Luca Citi
Ph.D. Candidate, Biorobotic science and engineering
IMT - Institutions, Markets, Technologies
Lucca Institute for Advanced Studies - Italy
Via San Micheletto, 3
55100 Lucca - Italy
-------------------------------------------------------------------

[attachment deleted by admin]

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: Using CB to develop Qt application
« Reply #6 on: December 14, 2005, 06:38:08 pm »
I managed to integrate quite well (at least for my needs) QT4 with Code::Blocks.
If you follow the attached instructions you can:
- create new QT apps from a template
- invoke the qt designer to edit forms from within Code::Blocks
- let Code::Blocks automatically create the .pro file
- let Code::Blocks build release and debug targets
- interactively debug your QT app with Code::Blocks
I hope this helps as is or (better) can stimulate further improvements.
Cheers,
Luca

That's interesting. Grazie Luca :).

Michael

Offline yop

  • Regular
  • ***
  • Posts: 387
Re: Using CB to develop Qt application
« Reply #7 on: December 14, 2005, 09:40:05 pm »
It uses the same method mentioned in other threads, but with the major improvement of qt designer. The major issues discussed quite a while ago still apply though but your work around is by far the most complete. Excellent work (and what I always admire: very well documented ;))

off topic: What is biorobotic engineering? (I could only find 5 paragraphs in wikipedia)
« Last Edit: December 14, 2005, 09:44:58 pm by yop »
Life would be so much easier if we could just look at the source code.

lucaciti

  • Guest
Re: Using CB to develop Qt application
« Reply #8 on: December 15, 2005, 10:43:50 am »
What do you mean with "major issues"?
One issue I cannot solve is "code completion" of QT classes.
Cheers,
Luca

off topic:
http://www.imtlucca.it/phd_programs/biorobotics_science_engineering/index.php

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: Using CB to develop Qt application
« Reply #9 on: December 15, 2005, 11:53:18 am »
off topic:
http://www.imtlucca.it/phd_programs/biorobotics_science_engineering/index.php

Interesting PhD program (Biorobotics Science and Engineering). Unfortunately, too late for me :( as I am doing already a PhD. It would have been a good solution to combine my biology skills with my computer sciences skills :).

Michael
 

Offline yop

  • Regular
  • ***
  • Posts: 387
Re: Using CB to develop Qt application
« Reply #10 on: December 15, 2005, 01:53:23 pm »
What do you mean with "major issues"?
One issue I cannot solve is "code completion" of QT classes.
You do realize that it's a work around (don't get me wrong I haven't proposed anything better :)) and so the implementation will always have limitiations (like external libraries, sources in different directories, external inclusions, custom definitions, changing compilers to name a few). But as I've said it's the most complete proposal for using qmake with codeblocks.
The codecompletion is not your fault, qmake resolves the qt headers dir and codeblocks have no way to know where to find the symbols
off topic:
http://www.imtlucca.it/phd_programs/biorobotics_science_engineering/index.php
Impresive
Life would be so much easier if we could just look at the source code.

lucaciti

  • Guest
Re: Using CB to develop Qt application
« Reply #11 on: December 23, 2005, 11:43:21 am »
I definitely agree with you. Anyway if you have some specific needs that are already considered in the syntax of the .pro files you can try to play with the qtoptions.txt file that is appended to the .pro file (e.g. "DEFINES += PIPPO"). I hope more people will start using Trolltech QT4 with Code:Blocks and a critical mass wil be reached soon carrying new ideas and new solutions.
I see you use CB under Linux, is it a good alternative to KDevelop (that do not yet fully support qt4)? By the way I changed the createpro.bat file in order to make it work both under Windows and Linux. It is a bit tricky, maybe not a "clean" solution, and probably not useful (you can have two separate files) but I started with this idea in mind and later it became a challenge.
I attach the new version.
Cheers,
Luca

[attachment deleted by admin]

Offline yop

  • Regular
  • ***
  • Posts: 387
Re: Using CB to develop Qt application
« Reply #12 on: December 23, 2005, 01:20:54 pm »
I definitely agree with you. Anyway if you have some specific needs that are already considered in the syntax of the .pro files you can try to play with the qtoptions.txt file that is appended to the .pro file (e.g. "DEFINES += PIPPO"). I hope more people will start using Trolltech QT4 with Code:Blocks and a critical mass wil be reached soon carrying new ideas and new solutions.
Wait for a few days (hopefully) I'll release a qt plugin (on the other hand I've said this so many times that I can't remember, but my free time is really limited so I always postpone it :()
I see you use CB under Linux, is it a good alternative to KDevelop (that do not yet fully support qt4)?
It's aperfect replacement but KDevelop is built with qt so there's no comparison, ceratainly KDevelop handles qt projects better
By the way I changed the createpro.bat file in order to make it work both under Windows and Linux. It is a bit tricky, maybe not a "clean" solution, and probably not useful (you can have two separate files) but I started with this idea in mind and later it became a challenge.
Super, I'll check it out, thanks.
Life would be so much easier if we could just look at the source code.