← Back to team overview

brewtarget-devs team mailing list archive

brewtarget and qt5

 

I started just toying with this earlier today. As the docs promised, it was
easy enough and I know have something that compiles and runs against Qt5.
If you want to play, it is on gitorious in my clone (git://
gitorious.org/brewtarget/mikfires-brewtarget.git) as feature/qt5.

It builds for both Qt4 and Qt5. Run ./configure -q ON to build for Qt5. I
have only tested this on Kubuntu 14.04 but did everything through cmake. It
should just sort of work anywhere. If it doesn't, I would love to know.

I know the tests only work for Qt4 right now. They changed the cmake stuff
and I just didn't have the brain power to go chasing the proper invocation
for the tests, so I effectively ifdef'd it.

I am not certain about the translations. It is done different in Qt5, and I
think I did it properly but I don't really know how to test.

I have had to add a few #ifdefs, but not that many. The Q_WS_* macros no
longer exist in Qt5, so I had to reorder about three places in
brewtarget.cpp to use Q_OS instead. The uncomfortable part is that there is
no easy Q_OS_LINUX that I could find, so I've had to invert the logic of
the tests. I also had to remove a few methods that were deprecated in 4.6
and removed somewhere in Qt5.

There are likely a hundred little bugs. I'm noticing things are much more
sensitive and generally unhappy w/ forward class declarations (see the
fourth link, the section titled "Missing Q_OBJECT macros and metatype
cleanup"). I need to find all the places we do those and make sure things
work. Nothing catastrophic, but lots of complaints about not being able to
read undeclared types.

Some good resources:
http://www.kdab.com/porting-from-qt-4-to-qt-5/
https://www.ics.com/blog/porting-desktop-applications-qt-4-qt-5
http://qt-project.org/wiki/Transition_from_Qt_4.x_to_Qt5
http://www.kdab.com/using-cmake-with-qt-5/

Mik
-- 
In a world of ninja v. pirate, I pilot a Gundam

Follow ups