Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Put Qt UI to MFC application
Forum Updated to NodeBB v4.3 + New Features

Put Qt UI to MFC application

Scheduled Pinned Locked Moved Unsolved General and Desktop
12 Posts 4 Posters 7.8k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • mrjjM Offline
    mrjjM Offline
    mrjj
    Lifetime Qt Champion
    wrote on last edited by
    #2

    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 ?

    mandruk1331M 1 Reply Last reply
    1
    • mrjjM mrjj

      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 ?

      mandruk1331M Offline
      mandruk1331M Offline
      mandruk1331
      wrote on last edited by
      #3

      @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);
      	}
      

      Mandruk1331

      1 Reply Last reply
      0
      • VRoninV Offline
        VRoninV Offline
        VRonin
        wrote on last edited by VRonin
        #4

        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

        "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
        ~Napoleon Bonaparte

        On a crusade to banish setIndexWidget() from the holy land of Qt

        mandruk1331M 1 Reply Last reply
        1
        • VRoninV VRonin

          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

          mandruk1331M Offline
          mandruk1331M Offline
          mandruk1331
          wrote on last edited by mandruk1331
          #5

          @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?

          Mandruk1331

          mrjjM 1 Reply Last reply
          0
          • mandruk1331M mandruk1331

            @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?

            mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by
            #6

            @mandruk1331

            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 ????

            mandruk1331M 1 Reply Last reply
            1
            • mrjjM mrjj

              @mandruk1331

              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 ????

              mandruk1331M Offline
              mandruk1331M Offline
              mandruk1331
              wrote on last edited by
              #7

              @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.

              Mandruk1331

              mrjjM 1 Reply Last reply
              0
              • mandruk1331M mandruk1331

                @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.

                mrjjM Offline
                mrjjM Offline
                mrjj
                Lifetime Qt Champion
                wrote on last edited by
                #8

                @mandruk1331

                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.

                mandruk1331M 1 Reply Last reply
                0
                • mrjjM mrjj

                  @mandruk1331

                  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.

                  mandruk1331M Offline
                  mandruk1331M Offline
                  mandruk1331
                  wrote on last edited by
                  #9

                  @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.

                  Mandruk1331

                  mrjjM 1 Reply Last reply
                  0
                  • mandruk1331M mandruk1331

                    @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.

                    mrjjM Offline
                    mrjjM Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on last edited by
                    #10

                    @mandruk1331

                    Yeah if the main app class is MFC it will need the normal event loop.
                    and Qt will still want one for dialog etc.

                    mandruk1331M 1 Reply Last reply
                    0
                    • mrjjM mrjj

                      @mandruk1331

                      Yeah if the main app class is MFC it will need the normal event loop.
                      and Qt will still want one for dialog etc.

                      mandruk1331M Offline
                      mandruk1331M Offline
                      mandruk1331
                      wrote on last edited by
                      #11

                      @mrjj are there any books/tutorials which can help in understanding how to create the Qt UI in MFC?

                      Mandruk1331

                      1 Reply Last reply
                      0
                      • SGaistS Offline
                        SGaistS Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on last edited by
                        #12

                        Hi,

                        You might want to take a look at the QtWinMigrate solution of the QtSolutions module.

                        Hope it helps

                        Interested in AI ? www.idiap.ch
                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                        1 Reply Last reply
                        1

                        • Login

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups
                        • Search
                        • Get Qt Extensions
                        • Unsolved