A week ago I faced the challenge to start the migration of a legacy project that was built using MFC to Qt. The “weapon of choice” was qtwinmigrate
There is an INSTALL.txt file included, that gives detailed instructed how to compile the project. However, following these instructions using the VisualStudio 2013 compiler I ran into a problem: When building the project the linker complained about a missing mfc120.lib file
I searched my computer for this file and only found a mfc120u.lib. So it seemed like I only had the Unicode version of the library. I remembered reading something about Non-Unicode MFC projects quite some time ago, but I found the blog post again.
In this post there is a download link for the MBCS libraries for VisualStudio 2013, that include the required mfc120.lib file. After installing these libraries, the build process of qtwinmigrate succeeded.
For the first steps with qtwinmigrate there exists a pretty good Walkthrough. However, adding a new dialog like described in the “A new Qt Dialog” section, did not exactly worked as described in the walkthrough.
I had to replace the code for the OnAppOptions function with the following:
void WindowsApp::OnAppOptions() { QWinWidget *win = new QWinWidget(theApp.m_pMainWnd); win->showCentered(); OptionsDialog *dialog = new OptionsDialog(win); dialog->setAttribute(Qt::WA_DeleteOnClose); dialog->show(); }
Maybe this is because the walkthrough was written for an older Qt version.
However with this small tweak, so far qtwinmigrate works very well!