[Qt-interest] Problem with MFC to Qt migration using qt-vs-addin-1.0.2 in VisualStudio2005

Vanbrabant Martin M.Vanbrabant at televic-education.com
Thu Sep 24 09:55:37 CEST 2009


John,

thanks for your input.

I did have .pro files for following the walkthrough in the MFC to Qt migration kit examples (qtwinmigrate-2.8-opensource\examples\mfc\step*\step*.pro),
But I don't have one for the MFC project I have to convert.

If there were a way to create a .pro file anyway, then I could follow your input.

The Qt VisualStudio add-in's menu option "Create basic .pro File..." is - guess what - grayed out my project!
(This seems to be the case for all projects that weren't created as Qt applications).

Martin.


-----Original Message-----
From: John McClurkin [mailto:jwm at nei.nih.gov]
Sent: woensdag 23 september 2009 18:28
To: qt-interest at trolltech.com
Subject: Re: [Qt-interest] Problem with MFC to Qt migration using qt-vs-addin-1.0.2 in VisualStudio2005

Vanbrabant Martin wrote:
> Hello,
>
>
>
> I am using Qt 4.5.2, open source version, configured and built from the
> source distribution for platform win32-msvc2005.
>
> I develop using VisualStudio2005, and have the Visual Studio add-in
> (qt-vs-addin-1.0.2) installed.
>
> Making new Qt applications work fine.
>
>
>
> Now I have to gradually migrate a (huge!) MFC application to Qt.
>
> I am using qt-winmigrate-opensource-2-8 for that purpose.
>
>
>
> I can reconstruct (using qmake -tp vc) .vcproj files for all steps found
> in the help:
>
> http://doc.trolltech.com/solutions/4/qtwinmigrate/winmigrate-walkthrough.html
> ..
>
>
>
> Next thing to do is to repeat these steps in my own MFC application.
>
> When I am at the paragraph "A new Qt Dialog" in above walkthrough, I read:
>
> "To add a new dialog we use the Visual Studio integration toolbar's "New
> Qt Dialog" button. We add a Qt Designer ..ui file "optionsdialog.ui" to
> the current project, and add the required build steps to generate a C++
> class from that file."
>
>
>
> Now here is the problem: the Visual Studio add-in does not provide this
> toolbar to VisualStudio2005.
>
>
>
> As a workaround, in the solution explorer, I tried the context sensitive
> menu Add.../New Item.../Qt Forms/Qt Dialog Form, which resulted in a new
> .ui file.
>
> I could edit the .ui file with Qt Designer, but when I built the
> project, the .ui file was not processed (I did not get any moc_*.cpp,
> ui_*.h files).
>
> Also, I could not change my project properties (the "Qt Project
> Settings" menu item is grayed out for this project, unlike for self-
> created Qt applications).
>
>
>
> Any idea how to continue here?

You say you use qmake to make the .vcproj files. I assume then, that you
  have .pro files. Did you add the .ui file to the FORMS section of the
.pro file? Did you add an include statement to your base class header
that includes the ui_dialog.h?
        #include "ui_dialog.h"
This is what actually causes qmake to add commands for uic.exe into the
build system.

For what it's worth, I also use msvc2005 with the opensource version of
Qt, but I have found the plugin to be fairly useless. I just run
QtDesigner alone to create gui elements, manually edit the .pro file to
add those elements to the FORMS section, run qmake -tp vc in a cmd
window to make the .vcproj files, and just use visual studio as the
final edit and build tool.

>
>
>
> Thanks.
>





More information about the Qt-interest-old mailing list