Custom cursors and high dpi (Windows and MacOS testers needed)

A forum for research and development of the user interface of FreeCAD
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
vanuan
Posts: 539
Joined: Wed Oct 24, 2018 9:49 pm

Re: Custom cursors and high dpi (Windows and MacOS testers needed)

Post by vanuan »

DeepSOIC wrote: Sun Jul 19, 2020 1:10 pmMy normal cursor is enormous, set with a special slider in windows settings (accessibility->cursor and pointer), and FreeCAD clearly does not respect that slider.
Oh, another issue to look into. So is it smaller only for custom cursor or for the default one too?
Could you please test with a cursor set to the default size?
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Custom cursors and high dpi (Windows and MacOS testers needed)

Post by DeepSOIC »

vanuan wrote: Sun Jul 19, 2020 2:32 pm So is it smaller only for custom cursor or for the default one too?
Could you please test with a cursor set to the default size?
Only for the special cursor. The default cursor (arrow) does respect the slider.
I don't know what position of the slider is default :oops: the smallest looks smaller-than-normal to me, but maybe it's just a matter of habit.

Most of the time I don't see any cursor at all, because I mostly use touchscreen for everything.
User avatar
vanuan
Posts: 539
Joined: Wed Oct 24, 2018 9:49 pm

Re: Custom cursors and high dpi (Windows and MacOS testers needed)

Post by vanuan »

DeepSOIC wrote: Sat Jul 18, 2020 11:43 pm I have tried setting 175% on my windows, and the cursor does increase in your branch.
OS: Windows 10 (10.0)
Qt version: 5.12.1
Hm, apparently, the fractional device pixel ratio for Windows (1.75 in your case) is introduced only in Qt 5.14. So maybe devicePixelRatio is rounded to an integer.
https://lists.qt-project.org/pipermail/ ... 37434.html
User avatar
vanuan
Posts: 539
Joined: Wed Oct 24, 2018 9:49 pm

Re: Custom cursors and high dpi (Windows and MacOS testers needed)

Post by vanuan »

Created a wiki page: https://wiki.freecadweb.org/HiDPI_support

Will add more links and documentation.
User avatar
vanuan
Posts: 539
Joined: Wed Oct 24, 2018 9:49 pm

Re: Custom cursors and high dpi

Post by vanuan »

bitacovir wrote: Sat Jul 18, 2020 2:48 pm
Is this what you want?

First SVG cursor is ready to review!

Now the problem is with constraints icons: https://github.com/FreeCAD/FreeCAD/tree ... cons/small
Screenshot from 2020-07-21 22-34-43.png
Screenshot from 2020-07-21 22-34-43.png (14.59 KiB) Viewed 1965 times
Also, need to figure out how to set crosshair color.
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Custom cursors and high dpi (Windows and MacOS testers needed)

Post by Kunda1 »

Yea, the SVG icon looks so much more crisp and without pixelation.

Is the crosshair color hardcoded ?
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
openBrain
Veteran
Posts: 9041
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: Custom cursors and high dpi (Windows and MacOS testers needed)

Post by openBrain »

Kunda1 wrote: Wed Jul 22, 2020 5:05 am Is the crosshair color hardcoded ?
Yes, either in the XPM (old style) or in the SVG (new style)
vanuan wrote: Tue Jul 21, 2020 7:48 pm Also, need to figure out how to set crosshair color.
There is an example of live color tampering in this function that was implemented to change colors of the icons in the list of sketch elements. ;)
Though as the crosshair is a simple shape, it could be easier to directly define it in a QPainter then add the symbol in the pixmap. It's a bit more changes, but more flexible IMO.
User avatar
apeltauer
Posts: 399
Joined: Fri Aug 11, 2017 2:19 pm

Re: Custom cursors and high dpi (Windows and MacOS testers needed)

Post by apeltauer »

Also maybe it would be possible to change the color of the svg at runtime. Svg is some kind of xml file I think...
Change the color and reload the icon...
User avatar
vanuan
Posts: 539
Joined: Wed Oct 24, 2018 9:49 pm

Re: Custom cursors and high dpi (Windows and MacOS testers needed)

Post by vanuan »

BTW, I've added a proposed plan:
https://wiki.freecadweb.org/HiDPI_support
User avatar
vanuan
Posts: 539
Joined: Wed Oct 24, 2018 9:49 pm

Re: Custom cursors and high dpi (Windows and MacOS testers needed)

Post by vanuan »

Customizable crosshair color is good to go! The solution is suboptimal but I didn't want to bend an existing architecture.

Also, I had to change the crosshair stroke color (it was set to a shade of gray).
Screenshot from 2020-07-23 00-14-16.png
Screenshot from 2020-07-23 00-14-16.png (5.73 KiB) Viewed 1813 times
Post Reply