Author Topic: Qt4.x project within Code::Blocks on Linux  (Read 4665 times)

Offline marcoose777

  • Single posting newcomer
  • *
  • Posts: 4
Qt4.x project within Code::Blocks on Linux
« on: May 12, 2011, 09:02:10 pm »
Hi,
Thought I'd share this. Its a workaround aimed at noobies (like myself) to aid in building reasonable Qt project on code::blocks. Attached is a compressed folder that you can download and extract to the UserTemplates folder within the code::blocks directory. Hint: on my system this is located at home/user/.codeblocks/UserTemplates. You'll need to find yours. Once extracted you should have a folder called Qt4 inside the UserTemplates folder. Open code::blocks and select New->from template.....Then you (again) should have a template called Qt4 listed. Select it and press go to proceed. Next you will need to create/specify a project folder once specified click open, and the project file and others should be created inside. The text file usage.txt within the project gives some hints on usage. Those noobs interested to know, it works by telling code::blocks to invoke a prebuild script which in turn invokes qmake to create the actual Makefile that code::blocks then uses to build the project. This is only a work around solution, don't flame me if you don't like. Anyone who tries to use it will need to have there qt path variable set for code::blocks to give helpers e.g. list available functions/members after typing ./-> in the context of a Qt member/object.
Enjoy
PS I did get the Qt wizard to work, but it failed miserably with real world examples e.g. when I try to subclass QWidget etc..
PPS The Qt work bench for code::blocks appears to be dead, no longer supported.
« Last Edit: May 13, 2011, 03:01:58 pm by MortenMacFly »

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Qt4.x project within Code::Blocks on Linux
« Reply #1 on: May 13, 2011, 08:03:53 am »
...do you have the same thing attached twice?! ;-)

But seriously: What is the target platform of this project? Does it work cross-platform? Did you try on Windows?
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline marcoose777

  • Single posting newcomer
  • *
  • Posts: 4
Re: Qt4.x project within Code::Blocks on Linux
« Reply #2 on: May 13, 2011, 02:40:51 pm »
Sorry I do have dual boot, but last time M$ windohs was used on my PC was 3 yrs ago, probably need to back up any data and reformat win partition. Cannot see any real probs with it working on windows, it's only a pre-build script within a template project. Assuming MinGW's Make works the same as Make does on linux, and the executable qmake-qt4 is named similarly . If qmake is named differently you'll just need to change the text 'qmake-qt4' in the pre-build script to whatever it's called on windows. Just wanted to give assistance to any noobies struggling as I was to get a half decent project to work on code::blocks.
Yes, the forum timed me out while I was double checking a minor detail in the .CBP file, that contained information specific to my system layout. Double post was a mistake, though I checked for a double post but couldn't find.
Good luck