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



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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.