Qt4/Qt5 neutral compilation fixes

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

Re: Qt4/Qt5 neutral compilation fixes

Postby saso » Mon Dec 26, 2016 5:00 pm

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
Posts: 9278
Joined: Mon Dec 12, 2011 4:45 pm

Re: Qt4/Qt5 neutral compilation fixes

Postby triplus » Mon Dec 26, 2016 5:10 pm

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
Posts: 1418
Joined: Fri May 16, 2014 1:14 pm
Contact:

Re: Qt4/Qt5 neutral compilation fixes

Postby saso » Mon Dec 26, 2016 5:23 pm

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
Site Admin
Posts: 15487
Joined: Thu Feb 19, 2009 10:32 am

Re: Qt4/Qt5 neutral compilation fixes

Postby wmayer » Mon Dec 26, 2016 5:31 pm

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
Posts: 3182
Joined: Mon Nov 11, 2013 5:29 pm

Re: Qt4/Qt5 neutral compilation fixes

Postby looo » Mon Dec 26, 2016 6:12 pm

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.
please help with my conda-packaging efforts: https://liberapay.com/looooo/
minimalistic blog: https://looooo.github.io/mini-blog/
wmayer
Site Admin
Posts: 15487
Joined: Thu Feb 19, 2009 10:32 am

Re: Qt4/Qt5 neutral compilation fixes

Postby wmayer » Mon Dec 26, 2016 6:56 pm

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
Posts: 1418
Joined: Fri May 16, 2014 1:14 pm
Contact:

Re: Qt4/Qt5 neutral compilation fixes

Postby saso » Mon Dec 26, 2016 9:26 pm

Good, thanks for the additional informations
User avatar
yorik
Site Admin
Posts: 11700
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Re: Qt4/Qt5 neutral compilation fixes

Postby yorik » Tue Dec 27, 2016 12:47 pm

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

Re: Qt4/Qt5 neutral compilation fixes

Postby wmayer » Tue Dec 27, 2016 12:56 pm

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
Posts: 3182
Joined: Mon Nov 11, 2013 5:29 pm

Re: Qt4/Qt5 neutral compilation fixes

Postby looo » Tue Dec 27, 2016 2:17 pm

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.
please help with my conda-packaging efforts: https://liberapay.com/looooo/
minimalistic blog: https://looooo.github.io/mini-blog/