Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to convert a regular win32 (VC++ vcproj) project to a Qt project?

Tags:

How can I convert existing vcproj files to project files that the QT add-in to Visual Studio recognizes and treats as valid Qt projects?

Should I just bite the bullet and create new projects to replace the old ones, and then add existing code?

I am using QT 4.6 and VS 2008 with Qt Add-in 1.1.2. Original vcproj files have NOT been generated with QMake.

like image 686
Morten Fjeldstad Avatar asked Jan 18 '10 18:01

Morten Fjeldstad


People also ask

How do I add a Qt to an existing Visual Studio project?

In Microsoft Visual Studio, select Extensions > Manage Extensions > Online, and search for Qt Visual Studio Tools to install or update Qt VS Tools.


1 Answers

Using Visual Studio 2010+ it is now possible to convert a project to a Qt Addin project, using the "Convert project to Qt Add-in project" feature of the Qt Addin.

The following steps are from the work around in bug QTVSADDINBUG-27. This was tested with Visual Studio 2010, but should work similarly with new versions:

  1. Right click on your project in "Solution Explorer", click on "Unload Project"
  2. Right click on your project in "Solution Explorer", click on "Edit .vcxproj"
  3. Add line <Keyword>Qt4VSv1.0</Keyword> between the tags <PropertyGroup Label="Globals"> and </PropertyGroup>.
  4. Right click on your project in "Solution Explorer", click on "Reload Project"
  5. Right click on your project in "Solution Explorer", click on "Convert project to Qt Add-in project"

If you have header files in your project you are going to have to follow the instructions in this answer to trigger the generation of moc_* files in the "Generated Files" folder.

For editions of Visual Studio older than 2010 see this work around.

like image 148
Jade Avatar answered Oct 20 '22 04:10

Jade