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. Issues migrating from Qt 4.8.1 to Qt 5
Forum Updated to NodeBB v4.3 + New Features

Issues migrating from Qt 4.8.1 to Qt 5

Scheduled Pinned Locked Moved General and Desktop
11 Posts 3 Posters 27.9k 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.
  • H Offline
    H Offline
    Hatchi
    wrote on last edited by
    #1

    Dear all

    I worked for several months with Qt 4.8.1. 3 days ago I also installed Qt 5. My computer is a Windows 7 64 bit machine. I installed WinSDK containing MSVC compilers. At first compilers were not detected so I added the file as described on the known issues page.

    Qt 5 detects now the compilers and also the path to Qmake. However I get these 12 strange error messages when I try to compile the project which I developed with Qt 4.8.1. I tried to deinstall Qt 4.8.1 but this didn't help.

    C:\Users\owner\project\main.cpp:1: error: C1083: Cannot open include file: 'QtGui/QApplication': No such file or directory
    c:\users\owner\project\mainscreen.h:4: error: C1083: Cannot open include file: 'QMainWindow': No such file or directory
    c:\users\owner\project\nominalscale.h:4: error: C1083: Cannot open include file: 'QWidget': No such file or directory

    Does anybody know how to solve this issue?

    Best
    Hatchi

    1 Reply Last reply
    0
    • E Offline
      E Offline
      elpuri
      wrote on last edited by
      #2

      All the QWidgets related stuff is now in it's own module. You need to add "QT += widgets" to your .pro file.

      1 Reply Last reply
      0
      • V Offline
        V Offline
        vezprog
        wrote on last edited by
        #3

        Is your path environment variable set to the new bin location for Qt5 (appended to the path variable)? I haven't ventured into Qt5 yet though.

        1 Reply Last reply
        0
        • H Offline
          H Offline
          Hatchi
          wrote on last edited by
          #4

          I added C:\Qt\Qt5.0.0\5.0.0\msvc2010\bin to the path but this didn't help...

          I also added QT += widgets to the pro file but this also didn't help ...

          1 Reply Last reply
          0
          • V Offline
            V Offline
            vezprog
            wrote on last edited by
            #5

            Is that the actual install location you used?

            For 4.8.4 I use the default:
            C:\Qt\4.8.4\bin

            Not all the sub folders...

            Double check your install location on your C drive.

            1 Reply Last reply
            0
            • H Offline
              H Offline
              Hatchi
              wrote on last edited by
              #6

              This is the actual install location, all these subfolders were created by Qt 5 installer ...

              1 Reply Last reply
              0
              • V Offline
                V Offline
                vezprog
                wrote on last edited by
                #7

                Sorry, again, I haven't used Qt5 yet. Can you show your .pro file? That might help with figuring out if it is a linking issue.

                1 Reply Last reply
                0
                • H Offline
                  H Offline
                  Hatchi
                  wrote on last edited by
                  #8

                  This is the full content of my pro file:

                  #-------------------------------------------------

                  Project created by QtCreator 2012-10-14T13:28:45

                  #-------------------------------------------------

                  QT += core gui widgets

                  TARGET = Project
                  TEMPLATE = app

                  SOURCES += main.cpp
                  mainscreen.cpp
                  contextcomposer.cpp
                  conceptualscaling.cpp
                  multivaluedattribute.cpp
                  formalcontextmodel.cpp
                  nominalscale.cpp
                  ordinalscale.cpp
                  lattice.cpp
                  latticebrowser.cpp
                  concept.cpp
                  link.cpp
                  InClose2.cpp
                  manyvaluedcontextmodel.cpp
                  dataset.cpp
                  dataviewer.cpp

                  HEADERS += mainscreen.h
                  contextcomposer.h
                  conceptualscaling.h
                  multivaluedattribute.h
                  formalcontextmodel.h
                  nominalscale.h
                  ordinalscale.h
                  lattice.h
                  latticebrowser.h
                  concept.h
                  link.h
                  InClose2.h
                  manyvaluedcontextmodel.h
                  dataset.h
                  dataviewer.h

                  FORMS += mainscreen.ui
                  contextcomposer.ui
                  conceptualscaling.ui
                  nominalscale.ui
                  ordinalscale.ui
                  lattice.ui
                  latticebrowser.ui
                  dataviewer.ui

                  RESOURCES +=
                  Project.qrc

                  1 Reply Last reply
                  0
                  • V Offline
                    V Offline
                    vezprog
                    wrote on last edited by
                    #9

                    I just checked out an example from Qt5 here.
                    http://qt-project.org/doc/qt-5.0/qtwidgets/mainwindows-application.html

                    compare the includes from what you have and what they have for a main window application.

                    <QtWidgets> is an include in Qt5 instead of <QWidget>
                    <QApplication> is an include in Qt5 instead of <QtGui/QApplication>

                    and so on.

                    Hope this helps.

                    1 Reply Last reply
                    0
                    • H Offline
                      H Offline
                      Hatchi
                      wrote on last edited by
                      #10

                      Hello

                      The errors which I mentioned first disappeared after including QtWidgets etc. in the includes in the header files. Thanks!!

                      Afterwards, I now still have about 8 error messages of the following type:
                      C:\Users\owner\project\conceptualscaling.cpp:2: error: C1083: Cannot open include file: 'ui_conceptualscaling.h': No such file or directory

                      I tried creating a new form designer widget which has this include "ui_formtest.h" in the cpp and this new Widget does not have this error message.

                      Do you have any suggestions on how to solve this for my 8 designer form classes which already exist?

                      1 Reply Last reply
                      0
                      • H Offline
                        H Offline
                        Hatchi
                        wrote on last edited by
                        #11

                        Dear All

                        I managed to solve all problems some time ago so I will share it with you in case somebody can benefit from it:

                        • I added QT+= qtwidgets to the pro file and had to change all imports such as the views and models I used to <QtWidgets/...>
                        • <QPrinter> didn't work anymore so I had to include <QtPrintSupport/QPrinter> and also QT += qprintsupport to the pro file
                        • Custom data types don't work anymore in signals and slots without registering them as a metatype
                        • If you have ui files from a older Qt project, I found no beter solution than to remove them and code everything in them manually.

                        The code is now almost twice as fast for certain sub parts of the system.

                        Best
                        Hatchi

                        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