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. Qt5 porting tips/findings
Qt 6.11 is out! See what's new in the release blog

Qt5 porting tips/findings

Scheduled Pinned Locked Moved General and Desktop
24 Posts 10 Posters 21.6k Views 1 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.
  • rootshellR Offline
    rootshellR Offline
    rootshell
    wrote on last edited by
    #10

    Another good one is QString::toASCI() has been depreciated, use QString::toLatin1()

    Certifications: CISSP, MCITP, MCSE, MCSA, BA, AA, AG, CST, CNST, Linux+, Security+, Server+, Network+, A+, iNet+

    Languages: C++, C#, VB, Python, Java

    1 Reply Last reply
    0
    • A Offline
      A Offline
      altera_2011
      wrote on last edited by
      #11

      Yep. that change is incredibly sneaky since it doesn't throw any error. Glad it saved you some time

      1 Reply Last reply
      0
      • P Offline
        P Offline
        puffosauro
        wrote on last edited by
        #12

        Hi altera_2011.

        I'm going to port my Qt 4 application to Qt 5. I have a big Visual Studio (2008) solution with a lot of projects because I have a lot of qt plugins.

        My doubt is about the Visual Studio project (and not about the application source code).

        I know that with Qt 5 some modules have changed, so I would like to know what's the best procedure to port the Visual Studio project.
        I don't know if I can use my old project and change the project settings, or if I must create a new project...

        Thanks

        1 Reply Last reply
        0
        • A Offline
          A Offline
          altera_2011
          wrote on last edited by
          #13

          puffosauro, I wish I had good advice for you but we use qmake and QtCreator instead of the VS2010 IDE. So in that respect the change to Qt 5 was a non-event as qmake took care of the changes.

          How did you create the visual studio projects?

          1 Reply Last reply
          0
          • P Offline
            P Offline
            puffosauro
            wrote on last edited by
            #14

            I have used the Visual Studio Addin to create the VS projects and also to add Qt classes etc... so I don't have a .pro file.

            1 Reply Last reply
            0
            • A Offline
              A Offline
              altera_2011
              wrote on last edited by
              #15

              I'm sorry I'm not familiar with the VS addin. Maybe someone else can give some suggestions.

              1 Reply Last reply
              0
              • K Offline
                K Offline
                koahnig
                wrote on last edited by
                #16

                [quote author="puffosauro" date="1389276361"]I have used the Visual Studio Addin to create the VS projects and also to add Qt classes etc... so I don't have a .pro file.
                [/quote]

                You can export the project to .pro file from vsaddin. This is part of the Qt menu in msvc. I have done my migration from msvc to Qt creator that way.

                Vote the answer(s) that helped you to solve your issue(s)

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  Asperamanca
                  wrote on last edited by
                  #17

                  [quote author="JKSH" date="1369361247"]I found another previously-undocumented change:

                  • QPen now has a default width of 1 instead of 0, so it is no longer cosmetic by default.[/quote]

                  Ouch

                  1 Reply Last reply
                  0
                  • P Offline
                    P Offline
                    puffosauro
                    wrote on last edited by
                    #18

                    [quote author="koahnig" date="1389278461"]
                    You can export the project to .pro file from vsaddin. This is part of the Qt menu in msvc. I have done my migration from msvc to Qt creator that way. [/quote]

                    Thanks. But I continue to use Visual Studio with the addin.

                    I have seen that it is easier than I thought, it's almost "automatic", I have only to add the new modules using the addin and I have to change the names of the libraries in the project settings (eg QtCore4.lib -> Qt5Core.lib)

                    ....

                    [quote author="JKSH" date="1369361247"]

                    • QPen now has a default width of 1 instead of 0, so it is no longer cosmetic by default.
                      [/quote]

                    mamma mia!!!!!! :(

                    1 Reply Last reply
                    0
                    • P Offline
                      P Offline
                      pedromateo
                      wrote on last edited by
                      #19

                      ERROR: 'class QApplication' has no member named 'argc'

                      FIX for QApplication::argc():

                      @
                      s_argc = app->arguments().size();
                      @

                      FIX for QApplication::argv():

                      @
                      s_argv = new char*[s_argc + 1];
                      //
                      for (int i = 0; i < s_argc; i++) {
                      // current arg
                      std::string arg =
                      app->arguments().at(i).toStdString();
                      // copy arg to char** structure
                      s_argv[i] = new char[strlen(arg.c_str()) + 1];
                      memcpy(s_argv[i], arg.c_str(),
                      strlen(arg.c_str()) + 1); // +1 for '\0'
                      }
                      s_argv[s_argc] = ((char)NULL);
                      @

                      My two cents :-)

                      Pedro Mateo
                      pedromateo@um.es
                      http://www.pedromateo.es

                      1 Reply Last reply
                      0
                      • P Offline
                        P Offline
                        pedromateo
                        wrote on last edited by
                        #20

                        ERROR: 'class QApplication' has no member named 'argc'

                        FIX for QApplication::argc():

                        @
                        s_argc = app->arguments().size();
                        @

                        FIX for QApplication::argv():

                        @
                        s_argv = new char*[s_argc + 1];
                        //
                        for (int i = 0; i < s_argc; i++) {
                        // current arg
                        std::string arg =
                        app->arguments().at(i).toStdString();
                        // copy arg to char** structure
                        s_argv[i] = new char[strlen(arg.c_str()) + 1];
                        memcpy(s_argv[i], arg.c_str(),
                        strlen(arg.c_str()) + 1); // +1 for '\0'
                        }
                        s_argv[s_argc] = ((char)NULL);
                        @

                        My two cents :-)

                        Pedro Mateo
                        pedromateo@um.es
                        http://www.pedromateo.es

                        1 Reply Last reply
                        0
                        • P Offline
                          P Offline
                          pedromateo
                          wrote on last edited by
                          #21

                          ERROR: 'qWaitForWindowShown' is not a member of 'QTest'

                          FIX:
                          @
                          QWidget* panel;

                          panel->hide();
                          panel->show();

                          #if QT_VERSION >= 0x050000
                          QTest::qWaitForWindowActive(panel);
                          #else
                          QTest::qWaitForWindowShown(panel);
                          #endif
                          @

                          Pedro Mateo
                          pedromateo@um.es
                          http://www.pedromateo.es

                          1 Reply Last reply
                          0
                          • P Offline
                            P Offline
                            pedromateo
                            wrote on last edited by
                            #22

                            ERROR: 'qWaitForWindowShown' is not a member of 'QTest'

                            FIX:
                            @
                            QWidget* panel;

                            panel->hide();
                            panel->show();

                            #if QT_VERSION >= 0x050000
                            QTest::qWaitForWindowActive(panel);
                            #else
                            QTest::qWaitForWindowShown(panel);
                            #endif
                            @

                            Pedro Mateo
                            pedromateo@um.es
                            http://www.pedromateo.es

                            1 Reply Last reply
                            0
                            • P Offline
                              P Offline
                              pedromateo
                              wrote on last edited by
                              #23

                              ERROR: QSpinBox: No such file or directory

                              FIX: Add this in your .pro file:

                              @
                              equals(QT_MAJOR_VERSION, 5) {
                              QT += widgets
                              }
                              @

                              Pedro Mateo
                              pedromateo@um.es
                              http://www.pedromateo.es

                              1 Reply Last reply
                              0
                              • P Offline
                                P Offline
                                pedromateo
                                wrote on last edited by
                                #24

                                ERROR: QSpinBox: No such file or directory

                                FIX: Add this in your .pro file:

                                @
                                equals(QT_MAJOR_VERSION, 5) {
                                QT += widgets
                                }
                                @

                                Pedro Mateo
                                pedromateo@um.es
                                http://www.pedromateo.es

                                1 Reply Last reply
                                0

                                • Login

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