UIPF compiles under Qt 5

The User Interface for Process Flowsheeting (UIPF) compiles under the almost-alpha Qt 5 (tested under Debian sid): just build Qt 5 from Git, then apply the tips.

Highlights:

  1. Change the uipf.pro file adding this (we don’t use QtDeclarative):
    greaterThan(QT_MAJOR_VERSION, 4) {
      QT += widgets
    }
  2. Fixing #includes with the provided fixqt4headers.pl Perl script resulted in compilation failures under Qt 4 since the QtWidgets header does not exist; trick:
    #if (QT_VERSION < 0x050000)
      #include <QtGui>
    #else
      #include <QtWidgets>
    #endif

    Note: The best practice would be to get rid of the Qt* headers and just include the really required classes; chase them before you start with:

    grep 'include <Qt' src/*cc include/*h
  3. One specific issue with UIPF was using the Q_WS_XX macros to conditionally compile for Windows (QT_WS_WIN), OSX (QT_WS_MAC) and Linux (QT_WS_X11);  these do not exist anymore (everything is Q_WS_QPA after the Lighthouse merge)  so one needs to switch on the Q_OS_XX macros:  QT_OS_WIN for Windows, QT_OS_MAC for OSX and QT_OS_LINUX for Linux, see this post. The solution was:
    sed -i 's/Q_WS_X11/Q_OS_LINUX/g' *cc
    sed -i 's/Q_WS/Q_OS/g' *cc

Mandatory screenshot (the fonts look ugly because it did not pick up the Oxygen theme for some reason):

About paolog

homo technologicus cynicus
This entry was posted in C++, UI. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

Anti-Spam Quiz: