Supporting Qt5

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
peterl94
Veteran
Posts: 1001
Joined: Thu May 23, 2013 7:31 pm
Location: United States

Supporting Qt5

Post by peterl94 »

Hey,

There is some important Mac fixes in Qt5, so it would be really nice to able build FreeCAD with Qt5. Does anyone know if it would require a lot of changes to support both Qt4 and Qt5?

~ Peter
User avatar
tanderson69
Veteran
Posts: 1626
Joined: Thu Feb 18, 2010 1:07 am

Re: Supporting Qt5

Post by tanderson69 »

I don't think anybody has tried it. I am guessing it won't be huge. a good place to start: http://qt-project.org/wiki/Transition_f ... 4.x_to_Qt5
peterl94
Veteran
Posts: 1001
Joined: Thu May 23, 2013 7:31 pm
Location: United States

Re: Supporting Qt5

Post by peterl94 »

Cool, I think I will give it a try.
User avatar
tanderson69
Veteran
Posts: 1626
Joined: Thu Feb 18, 2010 1:07 am

Re: Supporting Qt5

Post by tanderson69 »

great! create a branch and push it somewhere. Keep us "in the know". I will do some trial builds on kubuntu when needed.
peterl94
Veteran
Posts: 1001
Joined: Thu May 23, 2013 7:31 pm
Location: United States

Re: Supporting Qt5

Post by peterl94 »

Okay, will do.

Does anyone have a preference on how I do the conditional code?

Code: Select all

#if QT_VERSION >= 0x050000
    //Qt 5 stuff
#else
    //Qt 4 stuff
#endif

Code: Select all

#if QT_VERSION < 0x050000
    //Qt 4 stuff
#else
    //Qt 5 stuff
#endif
wmayer
Founder
Posts: 20309
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Supporting Qt5

Post by wmayer »

Does anyone have a preference on how I do the conditional code?
Both methods are fine.
peterl94
Veteran
Posts: 1001
Joined: Thu May 23, 2013 7:31 pm
Location: United States

Re: Supporting Qt5

Post by peterl94 »

Progress update: I have SoQt working with Qt5 now https://bitbucket.org/peterl94/soqt. Configure with --with-qt5 to enable. I haven't tested it yet on any other platforms besides Mac OS X 10.6.
mrlukeparry
Posts: 655
Joined: Fri Jul 22, 2011 8:37 pm
Contact:

Re: Supporting Qt5

Post by mrlukeparry »

from what I remember, there will need to be substantial changes to the 3D View / SoQt to support Qt5 because of the change to the underlying presentation framework - Lighthouse project. I think these are QWindow and QScreen.

I think the rest of FreeCAD should be fairly straightforward to port.

There's a compile flag that might be an issue with Cmake and shared libraries - see '-fpic'
http://www.kdab.com/using-cmake-with-qt-5/

It will be interesting in the long run, Qt 5.2 now supports QML desktop widgets, which will be really good for the task view windows rather than the QtDesigner ones. KDE Framework 5 will be released in Summer, but I doubt it will be ready for the masses.
peterl94
Veteran
Posts: 1001
Joined: Thu May 23, 2013 7:31 pm
Location: United States

Re: Supporting Qt5

Post by peterl94 »

Okay, so now I have the core app and the part workbench working with Qt 5. Thankfully, the Qt devs did a pretty good job at keeping compatibility with Qt 4. I pushed the changes to peterl94/qt5. Again, I've only tested this on OS X, and only a little at that. To build with Qt 5, set FREECAD_USE_QT5 cmake option. (Note: I used features that are only available in CMake >= 2.8.11)

It's going to be a long time before there will a complete FreeCAD running with Qt 5 -- there is no PySide version for Qt 5, and from what I've read, the PySide devs don't have an interest in doing it (or at least it's very low on their priority list).

There are a couple changes I did that I wasn't sure about. The first one being changing QCoreApplication::translate to QObject::tr, because the Qt docs made it sound like they were equivalent, but then I was thinking the class name passed to QCoreApplication::translate is need for something? The second one was to PropertyModel::buildUp. I wasn't sure if I put QAbstractItemModel::begin/endResetModel in the right place.
User avatar
jriegel
Founder
Posts: 3369
Joined: Sun Feb 15, 2009 5:29 pm
Location: Ulm, Germany
Contact:

Re: Supporting Qt5

Post by jriegel »

Great you look into this. But I feel no need to switch to Qt5. The 5 was mainly driven by Nokias need for mobile platform. I see little to nothing to gain for C++ desktop applications. Or am I wrong!?
Stop whining - start coding!
Post Reply