Supporting Qt 6 - What's needed?

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!
User avatar
chennes
Veteran
Posts: 3881
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: Supporting Qt 6 - What's needed?

Post by chennes »

aapo wrote: Fri Jan 21, 2022 11:22 am
hyarion wrote: Fri Jan 21, 2022 11:04 am
  • QRegExp -> QRegularExpression
Be careful with this one -- my recollection is that QRegularExpression does not exist in 5.9, so to support both 5.9 and 6.2 you will actually need to have both pieces of code in there, with a preprocessor (C++) or if/else (Python) branch statement controlling which is chosen.
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
aapo
Posts: 615
Joined: Mon Oct 29, 2018 6:41 pm

Re: Supporting Qt 6 - What's needed?

Post by aapo »

chennes wrote: Fri Jan 21, 2022 4:49 pm Be careful with this one -- my recollection is that QRegularExpression does not exist in 5.9, so to support both 5.9 and 6.2 you will actually need to have both pieces of code in there, with a preprocessor (C++) or if/else (Python) branch statement controlling which is chosen.
I checked it already; it says in the docs that QRegularExpression was introduced already in Qt 5.0, and Qt4 is going to be dropped in FreeCAD 0.20. So, no need to use macros there! :)

https://doc.qt.io/qt-5/qregularexpression.html
User avatar
chennes
Veteran
Posts: 3881
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: Supporting Qt 6 - What's needed?

Post by chennes »

Thanks! It was the QRegularExpression-taking "setFilterRegularExpression()" function from QSortFilterProxyModel that I had remembered biting me (that was only added in Qt 5.12).
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
StSt94
Posts: 6
Joined: Wed Jan 26, 2022 7:52 pm

Re: Supporting Qt 6 - What's needed?

Post by StSt94 »

Hi all,

I had issues running FreeCAD on my 2020 MacBook Pro with the M1 Apple Silicon (and wanted it nativ, not using Rosetta).

Therefore (because of the Lack of Python 3.7 support) I had to migrate to QT6!

I did lots of the mentioned work, some things are still missing though.

Please have a look at:

https://github.com/StStME/FreeCAD/tree/migrate/pyside6

it might be much easier to build on a X86_64 linux machine.

I Introduced the cmake variable "BUILD_QT6" and you need to enable "BUILD_GUI"

Any feedback is welcome :)
hyarion
Posts: 139
Joined: Fri Jun 26, 2020 6:08 pm

Re: Supporting Qt 6 - What's needed?

Post by hyarion »

Nice work StSt94! I notice we've done a lot of redundant work :D
What's left to do in your branch regarding functionality? And are you planning on getting this cleaned up and sent upstream too?

I think we should try to simplify the cmake files and remove old legacy code while we're at it.
For instance, I don't think we need a new build option (BUILD_QT6), in fact, we should probably remove the BUILD_QT5 option as well as qt4 isn't supported anymore.
We also have support for qwebkit and qglwidget which has been deprecated since long.

I think a first step to get this to the main branch is to locate and remove deprecated libraries and use modern ones that are supported on Qt 5.9 (minimum qt version for freecad 0.20) and create a PR for that.
After having a cleaned and refactored version of freecad, we could bolt on qt6-only alternative where needed in a second PR.

I think that doing it this way would make it a bit easier to code review.

Any thoughts?
User avatar
yorik
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Supporting Qt 6 - What's needed?

Post by yorik »

hyarion wrote: Wed Jan 26, 2022 10:43 pm For instance, I don't think we need a new build option (BUILD_QT6), in fact, we should probably remove the BUILD_QT5 option as well as qt4 isn't supported anymore.
Agree. But we still might need an option for people wanting to build with an older version of Qt (for ex. the "stable" one) even if a newer version (a "development" one) is found on the system. I can image for ex Linux distro package maintainers needing that. Maybe just an option to force a particular Qt version number? If empty, it would use the highest found.
hyarion wrote: Wed Jan 26, 2022 10:43 pm I think that doing it this way would make it a bit easier to code review.
Yes, that seems like a perfect path.
hyarion
Posts: 139
Joined: Fri Jun 26, 2020 6:08 pm

Re: Supporting Qt 6 - What's needed?

Post by hyarion »

yorik wrote: Thu Jan 27, 2022 10:28 am Maybe just an option to force a particular Qt version number?
Good point! :idea:
StSt94
Posts: 6
Joined: Wed Jan 26, 2022 7:52 pm

Re: Supporting Qt 6 - What's needed?

Post by StSt94 »

hyarion wrote: Wed Jan 26, 2022 10:43 pm Nice work StSt94! I notice we've done a lot of redundant work :D
What's left to do in your branch regarding functionality? And are you planning on getting this cleaned up and sent upstream too?
Thanks! Well I should have had a look at the forum before starting, I might have used lots of your work as starting point.. :D
but yes, of course, if accepted, I would gladly contribute a cleaned version.

So what's left regarding functionality... well, as I wrote in my latest commit Message: "launches, can create a cube.. :)"

That said, the Measure, TechDraw and WebGui Mod is still not ready.
I was trying to get the WebGui up and running but I miss symbols for arm64 so next step is to compile chromium for qt6 webengine.

And: Testing, Testing, Testing.
As I do not have a amd64 computer I would ask anyone to try to build what I have already done and to check if It is working as well.
hyarion wrote: Wed Jan 26, 2022 10:43 pm I think we should try to simplify the cmake files and remove old legacy code while we're at it.
For instance, I don't think we need a new build option (BUILD_QT6), in fact, we should probably remove the BUILD_QT5 option as well as qt4 isn't supported anymore.
We also have support for qwebkit and qglwidget which has been deprecated since long.
I totally agree with you here! I introduced the BUILD_QT6 option to be able to selectively enable and disable things during the development phase.
yorik wrote: Thu Jan 27, 2022 10:28 am Maybe just an option to force a particular Qt version number? If empty, it would use the highest found.
I would go with this. But might keep it until everything works so we don't have too many uncertainties.
hyarion wrote: Wed Jan 26, 2022 10:43 pm Any thoughts?
Lets start ;)

I would compare our both repos and combine the changes to have a common base.

And if it is done I might buy a iPad Pro with Apple Silicon and use FreeCAD on a Tablet with a Pen :D
StSt94
Posts: 6
Joined: Wed Jan 26, 2022 7:52 pm

Re: Supporting Qt 6 - What's needed?

Post by StSt94 »

StSt94 wrote: Thu Jan 27, 2022 10:25 pm
That said, the Measure, TechDraw and WebGui Mod is still not ready.
I was trying to get the WebGui up and running but I miss symbols for arm64 so next step is to compile chromium for qt6 webengine.
Measure and TechDraw are also alive now.

StSt94 wrote: Thu Jan 27, 2022 10:25 pm And: Testing, Testing, Testing.
As I do not have a amd64 computer I would ask anyone to try to build what I have already done and to check if It is working as well.
So what would be really helpful if someone could try to build this on a (amd64) Linux machine where build dependencies are available to see whether WebGUI can be built as well. Since in my case it fails linking because of missing arm64 symbols it might be good.
User avatar
babaroga
Posts: 178
Joined: Sun Aug 14, 2016 6:52 pm
Location: Banja Luka, Republic of Srpska, Bosnia and Herzegovina

Re: Supporting Qt 6 - What's needed?

Post by babaroga »

Hello @StSt94
I managed to build FreeCAD from your source on Manjaro.

Code: Select all

OS: Manjaro Linux (KDE/plasma)
Word size of FreeCAD: 64-bit
Version: 0.20.27103 (Git)
Build type: Release
Branch: migrate/pyside6
Hash: a059b5d1b9015a40a0283854e701b7b723aea068
Python version: 3.10.1
Qt version: 6.2.2
Coin version: 4.0.1
OCC version: 7.5.3
Locale: English/United States (en_US)

I had to comment out two lines in .CMakeLists.txt

Code: Select all

        #/Users/stefan.steinmueller/workspace/pyside-setup/build/qfp-py3.9-qt6.2.2-64bit-release/build/shiboken6/libshiboken/libshiboken6.cpython-39-darwin.6.0.0.dylib
        #/Users/stefan.steinmueller/workspace/pyside-setup/build/qfp-py3.9-qt6.2.2-64bit-release/build/pyside6/libpyside/libpyside6.cpython-39-darwin.6.0.0.dylib
Also in src/Gui/CMakeLists.txt i had to manually add path to Qt6 moc

Code: Select all

## hacky hack:
#qt/libexec/moc
#/opt/homebrew/Cellar/qt/6.2.2/share/qt/libexec/moc
set(Qt6Core_MOC_EXECUTABLE /usr/lib/qt6/moc)
Also i had to manually point to Pyside6 rcc and uic.

Part, PartDesign, Sketcher, Techdraw works.
Path, Draft and Arch is not working. Start is not working ("No module named WebGUI")

There is no icons in tree view.
Screenshot_20220203_002551.png
Screenshot_20220203_002551.png (202.45 KiB) Viewed 3360 times
It is late so i will test it more tomorrow. Let me know if I can test something or help in some other way.
Post Reply