views:

1363

answers:

3

I'm going to develop a bunch of projects with Qt that should compile both under Visual Studio with Qt integration (commercial) and Qt Creator with LGPL SDK. My primary IDE is VS but I've grown to like Qt Creator too. It would be nice to be able to work in both of them simultaneously. I need to do it in some extent anyway.

The most annoying problem is project management. Should I create .pro file first and then import it to VS? Or should I create VS project first and create .pro file by Qt integration utilities? What's the best way to do it?

I would like to hear your ideas on the subject.

+2  A: 

Do you mean Qt Designer or Qt Creator? Qt Designer is the form builder, Qt Creator is the IDE.

I would recommend delegating your project management to CMake. Qt Creator now has support for cmake. cmake generates you project files based on a simple set of description files. I now use cmake even if I am just using visual studio because it is much easier to manage common settings between related projects than updating loads of settings in different dialog boxes. It also is also a multi platform build and is very clever at discovering the build tools and libraries installed on the developer system and creating the appropriate build output, make files, and ide project files.

iain
+1  A: 

My approach was to create the project in VC++ and then export it to pro. I then tweaked all the pro files by hand and I keep them in sync by hand.

  • It's better to start with VC++, because VC++ has many more options that Qt's pro files.
  • Once you start changing more advanced options you will want to sync by hand
  • Make sure that both toolchains output the files in the same directories, or you might encounter issues such as moc files in your project dir that are updated only by QtCreator, while VC++ only updates the ones in GenratedFiles which the compiler can't see due to the former.
rpg
How do you export the projects to .pro files?
Grzenio
+2  A: 

I use the .pro files as a basis and create VS projects from them. Using scoping rules I can set options that are specific for the VC++ compiler or the MinGW compiler. I haven't encountered any VS option yet I couldn't specify in a .pro file. OK, make that one: trying to set the warning level to 4 (win32:QMAKE_CXXFLAGS_DEBUG += /W4) didn't work because /W3 was still present.

For adding new files to the project I sometimes just add them to the .pro files and setup the VS project again. That way I don't have to worry about keeping both in sync.

Using this approach makes it easy to do automatic builds under a variety of compilers (Microsoft, Intel, MinGW, 64bit cross compilers)

May I maintain VS project structure this way? I mean grouping files in folders.
Sergey Skoblikov
You can as far as I know. In the .pro file specify the files in the format 'SOURCES += subdir/file.cpp'. I don't know how they will be displayed in VS, though.