macOS Qt5 plan and status

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
blacey
Posts: 370
Joined: Tue Dec 08, 2015 11:28 pm

Re: macOS Qt5 plan and status

Post by blacey »

f3nix wrote: I just wonder if the HiRes capable is being overridden somewhere in the code.
From Qt doc:
Applications mostly work with device independent pixels. Notable exceptions are OpenGL and code that works with raster graphics.
My understanding is that we have to take care of the scaling ourselves.

Simple test I have run:
QT_SCALE_FACTOR=2 ./FreeCAD

and changing the code to make Viewport width and height to be twice as big gives good results.

I do wonder if setting QT_SCALE_FACTOR=0.5 would "fix" this Viewport issue (icons and everything else should be too small).

Have a nice trip! :)

Cheers,
Mateusz[/quote]
blacey wrote: I will try to set the scale factor external to the app to see if that helps as well but again, that might be up to a week away.
Hi Mateusz,

Sorry for the protracted response but I was away and just getting back to this now. I have created a 3 minute Youtube video if FreeCAD Qt4 side-by-side with FreeCAD Qt5 (unscaled and scaled) to demonstrate the problem that will hopefully highlight the root cause (NOTE: You will need to watch the video in full screen because I recorded on a 5120x2880 HiDPI display). Perhaps @wmayer will find this interesting and have some insight as well. Would really like to find a way to make the Qt5 builds usable enough to default the macOS builds to Qt5 for better test coverage.

Thanks,
Bruce

Build details:

Qt4

Code: Select all

OS: Mac OS X
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.10011 (Git)
Build type: Release
Branch: (detached from 15ab763)
Hash: 15ab763652c6bcbf3036c29d443ae0f3c2872bca
Python version: 2.7.13
Qt version: 4.8.7
Coin version: 3.1.3
OCC version: 7.0.0
Qt5

Code: Select all

OS: Mac OS X
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.10016 (Git)
Build type: Release
Branch: (detached from 8ea650c)
Hash: 8ea650cbc115f85fde7bb779a3177be0e56b5cef
Python version: 2.7.13
Qt version: 5.6.2
Coin version: 3.1.3
OCC version: 7.0.0
User avatar
f3nix
Posts: 346
Joined: Sat May 30, 2015 11:58 am

Re: macOS Qt5 plan and status

Post by f3nix »

Hi blacey!

This line is responsible for setting the size of QuarterWidget:

https://github.com/FreeCAD/FreeCAD/blob ... t.cpp#L683

Could you please try changing it to

Code: Select all

SbViewportRegion vp(event->size().width()*2, event->size().height()*2);
for testing purposes?

If that works the next step would be finding a way to calculate the correct scale factor depending on resolution.

There may be other places where a similar fix should be applied.

Do you have a way to test what it does when moving FreeCAD window from a hi-res monitor to a normal one?

Cheers,
Mateusz

P.S. I won't be able to do anything FreeCAD related until next weekend.
blacey
Posts: 370
Joined: Tue Dec 08, 2015 11:28 pm

Re: macOS Qt5 plan and status

Post by blacey »

f3nix wrote:Hi blacey!

This line is responsible for setting the size of QuarterWidget:

https://github.com/FreeCAD/FreeCAD/blob ... t.cpp#L683

Could you please try changing it to

Code: Select all

SbViewportRegion vp(event->size().width()*2, event->size().height()*2);
for testing purposes?
Hi Matuesz,

Ok, I tried the following change on the same HiDPI setup and uploaded a video of the results

Code: Select all

diff --git a/src/Gui/Quarter/QuarterWidget.cpp b/src/Gui/Quarter/QuarterWidget.cpp
index 5e918d3b6..b68ad0f3d 100644
--- a/src/Gui/Quarter/QuarterWidget.cpp
+++ b/src/Gui/Quarter/QuarterWidget.cpp
@@ -680,7 +680,7 @@ QuarterWidget::seek(void)
  */
 void QuarterWidget::resizeEvent(QResizeEvent* event)
 {
-    SbViewportRegion vp(event->size().width(), event->size().height());
+    SbViewportRegion vp(event->size().width()*2, event->size().height()*2);
     PRIVATE(this)->sorendermanager->setViewportRegion(vp);
     PRIVATE(this)->soeventmanager->setViewportRegion(vp);
     if (scene())
While this is progress, it seems we still have a cursor offset issue that is probably the spurious result of another hardwiring within the code base. Unfortunately I don't have the cycles necessary to climb the Qt learning curve right now so I can figure this out on my own but if that changes, I will gladly jump in.

One step at a time ;)

Cheers,
Bruce
User avatar
nemesis
Posts: 372
Joined: Tue Mar 25, 2014 11:24 pm
Location: France, Lyon

Re: macOS Qt5 plan and status

Post by nemesis »

blacey wrote: If you have another version of FreeCAD installed in /usr/local (i.e. you built it yourself), other versions may crash due to this mantis issue - https://www.freecadweb.org/tracker/view.php?id=2886

Please let me know if this is the root cause or not.
Hi,
So, I have 2 version of free cad in / application.
I moved it to another place and did the description in issue #2886
on step 4 I have no crash. the app just starts (with all the library creation I guess) and so it's QT4.8
I tried the step 5 but have this :

Code: Select all

error: install_name_tool: can't open file: FreeCAD (No such file or directory)
So I guess a Path error
User avatar
f3nix
Posts: 346
Joined: Sat May 30, 2015 11:58 am

Re: macOS Qt5 plan and status

Post by f3nix »

blacey wrote: While this is progress, it seems we still have a cursor offset issue that is probably the spurious result of another hardwiring within the code base.

[CUT]

One step at a time ;)
Ok. Here is a branch that hopefully fixes both issues.

Could you please test with external "normal dpi" monitor connected. It should scale correctly while moving between screens.

This code has been ported from here: https://grey.colorado.edu/svn/coin3d/quarter/trunk/ Work by Randall O'Reilly

Cheers,
Mateusz

P.S. As discussed earlier I won't be setting up a Windows build machine. It returns devicePixelRatio equal to 1 even on hidpi monitor.
blacey
Posts: 370
Joined: Tue Dec 08, 2015 11:28 pm

Re: macOS Qt5 plan and status

Post by blacey »

f3nix wrote:Ok. Here is a branch that hopefully fixes both issues.

Could you please test with external "normal dpi" monitor connected. It should scale correctly while moving between screens.
Hi Mateusz,

Will give it a try. In my configuration, I only have a HiDPI monitor and do not have a non-HPDI monitor that I can connect to my system. I can only try it on either a HiDPI only or normal-DPI only configuration.

Interesting about the Windows pixel ratio - hopefully your branch nails the problem.

Cheers,
Bruce
blacey
Posts: 370
Joined: Tue Dec 08, 2015 11:28 pm

Re: macOS Qt5 plan and status

Post by blacey »

f3nix wrote:Ok. Here is a branch that hopefully fixes both issues.
Confirmed. Well-done!

Code: Select all

OS: Mac OS X
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.10053 (Git)
Build type: DEBUG
Branch: qt5
Hash: 8d39662c2520871f5e4734a7622cd98210ce4b49
Python version: 2.7.13
Qt version: 5.6.2
Coin version: 3.1.3
OCC version: 7.1.0
FYI, I cherry-picked your commit onto my Qt5 branch and then rebased with upstream/master. It looks your change-set is Qt4/5 compatible so are you going to submit a PR with this commit? If so, my Qt5 macOS integration job will automagically pick it up once @werner or @yorik merge it.

Code: Select all

 git lg HEAD~10..
* 8d39662c2 - (HEAD -> qt5) Fix some Quarter High DPI Display issues. Ported from code by Randall O'Reilly. (32 minutes ago) <Mateusz Skowro<C5><84>ski>
* 8cb6ece52 - Install Qt 5 version of coin and pyside (32 minutes ago) <Bruce B. Lacey>
* a73406d0d - Upgrade macOS build to Qt 5.6 from Qt 5.5 (32 minutes ago) <Bruce B. Lacey>
* 96ad0efa4 - Enable Qt5 on macOS (32 minutes ago) <Bruce B. Lacey>
* 65070d4cf - Work-around MakeMacBundleRelocatable limitation (32 minutes ago) <Bruce B. Lacey>
* f20c64b10 - Define QT_PLUGINS_DIR when building for QT5 on macOS (32 minutes ago) <Bruce B. Lacey>
*   72d234942 - (upstream/master, master) Merge pull request #512 from WandererFan/Fix2888 (10 hours ago) <wwmayer>
|\  
| * 513decf8c - Cleanup orphan features on DVP delete (10 hours ago) <WandererFan>
| * 63d5749b6 - Fix crash if BaseView null on Section delete (10 hours ago) <WandererFan>
| * 69163cb01 - Fix #2888 Crash on Delete View (10 hours ago) <WandererFan>
* | 81c3bc6ef - make new Part.Line behaviour the default (10 hours ago) <wmayer>
|/  
*   43a54839d - Merge pull request #511 from luzpaz/Short-urls (12 hours ago) <wwmayer>
|\  
| * 364f53aa8 - Replace new Short URLs with old wiki URLs pt2 (26 hours ago) <Kunda>
| * bb52cd1f1 - Replace new Short URLs with old wiki URLs (32 hours ago) <Kunda>
* 9925e9028 - issue #0002183: Mesh View . Use Bounding-Box Not Working For Flat Lines (13 hours ago) <wmayer>
User avatar
f3nix
Posts: 346
Joined: Sat May 30, 2015 11:58 am

Re: macOS Qt5 plan and status

Post by f3nix »

blacey wrote:
f3nix wrote:Ok. Here is a branch that hopefully fixes both issues.
Confirmed. Well-done!

Code: Select all

OS: Mac OS X
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.10053 (Git)
Build type: DEBUG
Branch: qt5
Hash: 8d39662c2520871f5e4734a7622cd98210ce4b49
Python version: 2.7.13
Qt version: 5.6.2
Coin version: 3.1.3
OCC version: 7.1.0
Thanks for testing! :)
blacey wrote: FYI, I cherry-picked your commit onto my Qt5 branch and then rebased with upstream/master. It looks your change-set is Qt4/5 compatible so are you going to submit a PR with this commit? If so, my Qt5 macOS integration job will automagically pick it up once @werner or @yorik merge it.
PR sent.

What are those white rectangles in your video over the toolbar icons? Are they some screen capture glitches or... ???

Cheers,
Mateusz
blacey
Posts: 370
Joined: Tue Dec 08, 2015 11:28 pm

Re: macOS Qt5 plan and status

Post by blacey »

f3nix wrote:PR sent.
What are those white rectangles in your video over the toolbar icons? Are they some screen capture glitches or... ???
Those white rectangles are real. Here is a short video that demonstrates a couple of open issues:

1) Notice that the toolbar icons do not seem to render / redraw properly when opening a new document in Part Design.
2) When adding a sketch to a surface and applying a coincident constraint, the sketch resizes to a smaller size (most likely another scaling issue)

Sorry for the quality unannotated video but you will spot the issues immediately.

Do you see these issues on Linux?

Any ideas/thoughts/fixes that you might have are welcomed ;)

PySide2 - SHA: b262da5
Shiboken2 - SHA: e11fa17

Code: Select all

OS: Mac OS X
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.10286 (Git)
Build type: Release
Branch: (detached from 2266a65)
Hash: 2266a650d2d61d7ccf47285b8b7cece8a9fd01cc
Python version: 2.7.13
Qt version: 5.6.2
Coin version: 4.0.0a
OCC version: 7.1.0
FYI - I submitted a PR yesterday that will build Qt5 for macOS on master, in addition to Qt4, to enable and foster greater end-user test coverage of Qt5.
blacey
Posts: 370
Joined: Tue Dec 08, 2015 11:28 pm

Re: macOS Qt5 plan and status

Post by blacey »

FYI, the macOS CI builds on FreeCAD master are now available with both Qt5 and Qt4. https://forum.freecadweb.org/viewtopic.php?f=10&t=20977
Post Reply