Unsolved Put Qt UI to MFC application
-
Hello
At the moment I'm developing an app using MFC, but the UI in MFC is not that, therefore I would like to ask if there is a way to separate the UI from qt and put it into MFC?
Thanks in advance. -
Hi
Not really possible.If you want to use Qt UI then why use MFC ?
Im not sure i understand what you want.
Mixing BOTH MFC windows/ GUI controls with Qt widgets ?
or what is the goal ? -
@mrjj I want to replace the MFC UI with the Qt's UI. At the moment I'm using the I have connected the dll's to the MFC project but there is an exception in the code:
HMODULE mod = LoadLibrary(L"qtdialog.dll"); int g = GetLastError(); if (mod) { typedef BOOL(*pShowDialog)(HWND parent); pShowDialog showDialog = (pShowDialog)GetProcAddress(mod, "showDialog"); if (showDialog) showDialog(theApp.m_pMainWnd->m_hWnd); // NULL in theApp.m_pMainWnd->m_hWnd FreeLibrary(mod); }
-
what's in qtdialog.dll?
Normally integrating Qt and MFC hits a wall when you realise you need 2 different event loops running at the same time
-
@VRonin I have followed this tutorial (https://sites.google.com/site/nttrungmtwiki/home/it/programming/gui-programming/mfc-to-qt-migration---walkthrough) and downloaded the winmigrate source from git rep. As I understood it's a bad idea of doing such thing?
-
Hi
There is something i really dont get.If you dont use MFC, its just c++ code
and then you can freely have Qt as GUI code.So what are you really trying ?
Why use ANY MFC gui class at all ???
Just make a qt project, (in visual studio if you want) then
make gui in Qt and rest is just normal c++.The winmigrate is for porting the App , in steps.
But you start post with
"At the moment I'm developing an app "So just STOP using MFC and use Qt instead.
why mix it ???? -
@mrjj Yes sorry for that. I have been developing the app a quite long time (to learn MFC ) therefore re-writing it to QT can take a lot of time. The MFC UI look old therefore I want to use the one the QT has. I had some exp. with QT, therefore to expand my knowledge I'd like to mix those two up.
-
Ok if to learn, it makes sense.
But its not easy as both have an event loop
and its complicated to mix it.But seems good link you found. be sure to read and fully understand all of it.
-
@mrjj Yes VRonin mentioned that I will have to run 2 event loops, as I understand one will be for event handling and the other is for the UI.
-
Yeah if the main app class is MFC it will need the normal event loop.
and Qt will still want one for dialog etc. -
@mrjj are there any books/tutorials which can help in understanding how to create the Qt UI in MFC?
-
Hi,
You might want to take a look at the QtWinMigrate solution of the QtSolutions module.
Hope it helps