Qt4/Qt5 neutral compilation fixes

Merged, abandoned or rejected pull requests are moved here to clear the main Pull Requests forum.
User avatar
saso
Veteran
Posts: 1920
Joined: Fri May 16, 2014 1:14 pm
Contact:

Re: Qt4/Qt5 neutral compilation fixes

Post by saso »

I would like to propose to reconsider the option mentioned here viewtopic.php?f=10&t=12534&start=190#p145131

That is to get in the Python3 support and start the 0.17 release process (can take few months). This would give us 0.17 with support for both Python3 and 2, and there are also already a lot of new features since 0.16 (2600+ commits).

After 0.17 release we move to Qt5/Pyside2 and drop support for Python2/Qt4/Pyside... There are a few good reasons to do it like this but I also believe it would be generally good for the project to have a new final release in the next months (at least in the first half of 2017).
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Qt4/Qt5 neutral compilation fixes

Post by triplus »

Actually things changed a bit as PySide2 now supports Python 2.7 (looking at the Qt Wiki) and up. It was not that long ago when i looked and it was advertised PySide2 will be Python 3 only.

P.S. Therefore FreeCAD being Python2/Python3, PySide/PySide2 and Qt4/Qt5 compatible i guess could stay relevant for additional year or two.
User avatar
saso
Veteran
Posts: 1920
Joined: Fri May 16, 2014 1:14 pm
Contact:

Re: Qt4/Qt5 neutral compilation fixes

Post by saso »

https://wiki.qt.io/PySide2_GettingStarted
"On Windows, it is recommended to use Python 3 and build with MSVC2015. Python 2 requires building with MSVC2008."

Regardless if it is possible or not it is still questionable if it makes sense to drag all this weight with us... If we do the 0.17 sooner, we can then have another year to work out everything else.
wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Qt4/Qt5 neutral compilation fixes

Post by wmayer »

I was thinking we maybe could also abstract the PyQt/PySide/PySide2, there is the qtpy package that could become interesting too some day...
I read about qtpy in the past but at this time it only supported PyQt4 and PySide. Does it also support PySide2 now?
+1 for not supporting multiply qt bindings. There are for sure some incompatible things in pyside, pyside2, pyqt4, pyqt5. Better to go for pyside2 only.
Even if we go for one Python binding only but if using qtpy reduces the code changes for the PySide <=> PySide2 migration or any future changes like the PySide3 migration for Qt6 then it might be worth to have a look at it.
https://wiki.qt.io/PySide2_GettingStarted
"On Windows, it is recommended to use Python 3 and build with MSVC2015. Python 2 requires building with MSVC2008."
It might be recommended but it's not mandatory. Last weekend I build PySide2 with Python2.7 using MSVC2013. MSVC2008 isn't an option anyway because since the merge of PartDesignNext we need C++11 features which the old compiler doesn't support. So, on Windows the minimum compiler version is MSVC2013.
User avatar
looo
Veteran
Posts: 3941
Joined: Mon Nov 11, 2013 5:29 pm

Re: Qt4/Qt5 neutral compilation fixes

Post by looo »

That is true. I just want to avoid issues for 3d party wb when used with pyqt...
What about wrapping the old pyside api into FreeCAD.PySide? Then we could simple replace 'from PySide import ... ' with 'from FreeCAD.PySide import ...'

Is there any reason for going for qt5 before python3? The python3 branch was nearly ready a year ago. And shouldn't be too much work to get ready again. On the qt5 side pyside2 is not officially released.
wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Qt4/Qt5 neutral compilation fixes

Post by wmayer »

Is there any reason for going for qt5 before python3?
If you have a look at the git history then you will see that the Qt5 migration is (nearly) finished. The move was quite smooth for the C++ part. The code basis now supports Qt4 and Qt5.
User avatar
saso
Veteran
Posts: 1920
Joined: Fri May 16, 2014 1:14 pm
Contact:

Re: Qt4/Qt5 neutral compilation fixes

Post by saso »

Good, thanks for the additional informations
User avatar
yorik
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Qt4/Qt5 neutral compilation fixes

Post by yorik »

As soon as it's finished, we retake the python3 battle! :)
wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Qt4/Qt5 neutral compilation fixes

Post by wmayer »

yorik wrote:As soon as it's finished, we retake the python3 battle! :)
Do you think we should first do the PySide2 migration before doing the Python3 port or what do you mean with "finished"?
User avatar
looo
Veteran
Posts: 3941
Joined: Mon Nov 11, 2013 5:29 pm

Re: Qt4/Qt5 neutral compilation fixes

Post by looo »

Another idea to support pyside2 without changing the python code:
Place a 'Pyside' dir somewhere at python path eg. usr/lib/freecad/Mod/pymodules. Now wrap pyside2 to the old api. Then the wrapped module should be imported and not the origin pyside module.
Post Reply