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
-alex-
Veteran
Posts: 1856
Joined: Wed Feb 13, 2019 9:42 pm
Location: France

Re: Supporting Qt 6 - What's needed?

Post by -alex- »

Kunda1 wrote: Sun Jan 09, 2022 1:04 pm Do you have a link to the upstream Qt5 bug?
Not really, it rather my guess. BTW I'm just an end user, so just my 2cts. I've edited my previous post.
Sorry if that's a bit offtopic:
I think about Qt5 related issue since FC works fine on RPIOS32B when compiled with Py2/Qt4 or Py3/Qt4 but crashs with Py2/Qt5 or Py3/Qt5 (GL context issue).
My 2cts conclusion : Qt5 is involved with some 32B/64B stuffs. I may be wrong though, I'm not skilled to investigate further. issue #4083
hyarion
Posts: 139
Joined: Fri Jun 26, 2020 6:08 pm

Re: Supporting Qt 6 - What's needed?

Post by hyarion »

Regarding Qt6. Has anyone started on it yet?
It's a bit annoying that web view doesn't work on macOS with arm64 chipset, bumping qt to version 6 would fix that.

It sounds like a nice project to for me tinker with to get back to freecad hacking, so I'm happy to help or I can start with it if no one has done it already :)
openBrain
Veteran
Posts: 9034
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: Supporting Qt 6 - What's needed?

Post by openBrain »

Maybe @chennes or another core dev can create a branch in main repo ?
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 »

We don't generally maintain those branches as part of the depot, but of course we strongly encourage working on a branch on your own fork. If several people want to collaborate on the branch I'd just post a link to it here.
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
hyarion
Posts: 139
Joined: Fri Jun 26, 2020 6:08 pm

Re: Supporting Qt 6 - What's needed?

Post by hyarion »

openBrain wrote: Thu Jan 20, 2022 7:30 am Maybe @chennes or another core dev can create a branch in main repo ?
I don't know if we really need an official branch for it. There are a lot of changes that needs to be done, but just like freecad used to support both qt4 and qt5 it is possible to support both qt5 and qt6 too.

I've started on my own repo https://github.com/hyarion/freecad/tree/qt6 for now. I'm just hacking an slashing at the moment, but when the times comes that something boots up and can be tested I'll start with prettifying it and create merge request(s) to the main repo.

Freecad uses a lot of deprecated classes in qt (which is expected for a big project), so I'm trying my best to update everything in a compatible way, supporting Qt 5.9 and forward.
aapo
Posts: 615
Joined: Mon Oct 29, 2018 6:41 pm

Re: Supporting Qt 6 - What's needed?

Post by aapo »

hyarion wrote: Thu Jan 20, 2022 10:21 pm Freecad uses a lot of deprecated classes in qt (which is expected for a big project), so I'm trying my best to update everything in a compatible way, supporting Qt 5.9 and forward.
Thanks for working on this. :D I'd presume that not everything that is deprecated has been dropped in Qt6, I hope some of these classes are still marked as deprecated in Qt6, but continue existing. If you have already done work on this, it'd be superb if you could list in this thread the Qt classes used in FreeCAD currently, but dropped in Qt6. That would serve as a good advance warning for others!
User avatar
-alex-
Veteran
Posts: 1856
Joined: Wed Feb 13, 2019 9:42 pm
Location: France

Re: Supporting Qt 6 - What's needed?

Post by -alex- »

hyarion wrote: Thu Jan 20, 2022 10:21 pm when the times comes that something boots up and can be tested I'll start with prettifying it and create merge request(s) to the main repo.
Thanks for your effort!
When you'll make a PR or when something will be ready to compile, please report here as well.
hyarion
Posts: 139
Joined: Fri Jun 26, 2020 6:08 pm

Re: Supporting Qt 6 - What's needed?

Post by hyarion »

-alex- wrote: Fri Jan 21, 2022 9:16 am When you'll make a PR or when something will be ready to compile, please report here as well
Will do!
aapo wrote: Fri Jan 21, 2022 7:51 am If you have already done work on this, it'd be superb if you could list in this thread the Qt classes used in FreeCAD currently, but dropped in Qt6. That would serve as a good advance warning for others!
Sure! The list is currently as follows:
  • QRegExp -> QRegularExpression
  • QRegExpValidator -> QRegularExpressionValidator
  • QGL, we already support QOpenGL which is basically the same in qt6
  • Qt WebKit (QWebView, QWebPage etc.), but we already support QWebEngine which is available in Qt6.2+
  • QLayout::setMargin(margin) -> QLayout::setContentsMargins(a,b,c,d)
  • QTextCodec (when used with QTextStreams, instead of calling QTextStream::setCodec("UTF-8") you can use QTextStream::setEncoding(QStringConverter::Utf8))
  • QPair has been deprecated, though there is a proxy for it, it's recommended to use std::pair instead.
  • QVariant::setValue() -> QVariant::fromValue() which returns a new QVariant with the value from whatever you call it with.
  • setFallbackSessionManagementEnabled
  • QInputEvent::QInputEvent requires a QInputDevice
  • QDateTime::toTime_t -> QDateTime::toSecsSinceEpoch, from 32bits to 64bits to avoid roll over in 2038
The items above does not include what's handled by Qt5Compat.
aapo
Posts: 615
Joined: Mon Oct 29, 2018 6:41 pm

Re: Supporting Qt 6 - What's needed?

Post by aapo »

hyarion wrote: Fri Jan 21, 2022 11:04 am
  • QRegExp -> QRegularExpression
Thanks a lot for this list! That particular item already bites me, because I have currently a TechDraw PR pending that uses QRegExp(). Well, I should probably fix it right away, as QRegExp and QRegularExpression should work exactly the same for my use case. I've been using QRegExp() because it's shorter to write, without realizing it's deprecated! :lol:
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 »

Apparently the jump in the FreeCAD source code itself won't be too hard..

The biggest hassle will be to set all the further dependencies (coin/quarter/pivy and pyside, basically) to work...
Post Reply