Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. C++ Gurus
  4. Transition qt4.6 to qt5.7 with Erorr token
QtWS25 Last Chance

Transition qt4.6 to qt5.7 with Erorr token

Scheduled Pinned Locked Moved Unsolved C++ Gurus
6 Posts 3 Posters 1.8k Views
  • 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.
  • L Offline
    L Offline
    liondavid
    wrote on last edited by
    #1

    I am transition from Qt 4.x to Qt 5 : I have Add this on my *.pro file: "QT += core gui widgets" as well "Change all instances of #include <QtGui> to #include <QtWidgets>.

    I am getting an Error:expected class-name before '{' token line 95 qimage.h. I am not using qimage.h or any QPaintDevices.

    jsulmJ 1 Reply Last reply
    0
    • L liondavid

      I am transition from Qt 4.x to Qt 5 : I have Add this on my *.pro file: "QT += core gui widgets" as well "Change all instances of #include <QtGui> to #include <QtWidgets>.

      I am getting an Error:expected class-name before '{' token line 95 qimage.h. I am not using qimage.h or any QPaintDevices.

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @liondavid Is this the only error you get?
      Can you show the code where this error occur?
      Did you delete the build directory, run qmake and rebuild then?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • L Offline
        L Offline
        liondavid
        wrote on last edited by
        #3

        Errors I am getting are in qimage.h, qpixmap.h, qfont.h, qfontmetrics.h, qwidget.h, qpainter.h, qstylepainter.h, All have Error Token. few repeat come out saying QpaintDevice and Qpainter has not been declared. few repeat come out as Qwidget error 'WID' does not name a type. When only talk about my code when it say:

        Error: expected ';' before '' token In file included from /usr/include/qt5/QtWidgets/QtWidgets:73, from MultiPingDlg.h;14 and from main.cpp;6 in constructor 'QStylePainter::QStylePainter(QWidget); candidaates are bool QStylepainter::begin(QWidget*) note: bool Qstylepainter being (QPaintDevice*, QWidget*) in member function bool QStylePainter::begin(QWidget*):
        No matching function for call to 'QStylePainter::begin(QWidget*&, QWidget*&)

        MultiPingDlg.h is mainwindow.h

        Yes, I did delete the build directory and did qmake and rebuid.

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

          Hi and welcome to devnet,

          You shouldn't use the module includes. They will pull in every header of their respective module which will make the build longer for no benefits.

          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
          • L Offline
            L Offline
            liondavid
            wrote on last edited by
            #5

            What do you mean by don't use the module includes? Do you mean what I just add on my pro file, for example; Qt +=core gui widgets.

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

              I mean don't use #include <QtGui> or #include <QtWidgets>. Include what you are using: #include <QWidget>, #include <QImage> etc.

              By the way, QtGui has not been renamed QtWidgets, the widget related classes have been moved to the QtWidgets module hence your errors.

              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
              2

              • Login

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