Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Transition from 4.7.3 to 5.0.2 on MacOS...what am I missing
Qt 6.11 is out! See what's new in the release blog

Transition from 4.7.3 to 5.0.2 on MacOS...what am I missing

Scheduled Pinned Locked Moved Installation and Deployment
1 Posts 1 Posters 984 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.
  • P Offline
    P Offline
    PSI-lbc
    wrote on last edited by
    #1

    Really frustrated.

    I'm trying to transition from a working codebase for 4..7.3 to the newest 5.0.2 release. All the GUI forms were created with an earlier version of QtCreator (presumably something based on 4.7.3).

    I've read the porting guidelines at..

    https://qt-project.org/doc/qt-5.0/qtdoc/portingguide.html

    I was having a heck of a time getting somthing simple lile a QPrintDialog to compile. Found this...

    http://www.qtcentre.org/threads/54575-Printing-from-TextEdit-QPrinter-QPrintDialog

    Tried all the permutations suggested an it still would not compile.

    @#include <QtPrintSupport/QPrintDialog>
    #include <QtPrintSupport/QPrinter>

    #include <QPrintDialog>
    #include <QPrinter>@

    In the . pro file...

    @equals(QT_MAJOR_VERSION, 4) {
    #4.7.3
    QT += core gui
    QT += xml
    #QT += openssl
    QT += webkit
    QT += network
    }

    equals(QT_MAJOR_VERSION, 5) {
    #5.0.2
    QT += core gui
    QT += widgets
    QT += webkitwidgets
    QT += printsupport
    QT += xml
    QT += network
    }@

    I was using the following convention for a conditional compile in all the project .h files...

    @#ifndef BLAHBLAH_H
    #define BLAHBLAH_H

    #if (QT_VERSION < 0x050000)
    //4.7.3
    include <QtGui>
    include <QWidget>
    include <QMessageBox>
    include <QDebug>
    #else
    //5.0.2
    #include <QtWidgets/QtWidgets>
    #include <QtPrintSupport/QPrintDialog>
    #include <QtPrintSupport/QPrinter>
    #endif@

    Which seems to work most of the time if the module being compiled is a standard cpp class. For some reason, in a form_ui generated wit QtCreator from the 4.7.3 I must do this...

    @#ifndef FRMBLAHBLAH_H
    #define FRMBLAHBLAH_H

    /* <---??????
    #if (QT_VERSION < 0x050000)
    //4.7.3
    include <QtGui>
    include <QWidget>
    include <QMessageBox>
    include <QDebug>
    #else
    / // <---??????
    //5.0.2
    #include <QtWidgets/QtWidgets>
    #include <QtPrintSupport/QPrintDialog>
    #include <QtPrintSupport/QPrinter>
    /
    <---??????
    #endif
    */ @

    The <---?????? were added for clarification. Compiles only work if the 4.7.3 defines are manually commented out...conditional on QT_VERSION seems to be ignored.

    What ami I missing???

    Is there some artifact in the QtCreator generated form_ui files that contains a hidden reference/definition of QT_VERSION that is honking up the compile???

    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