Please read this:
https://wiki.freecadweb.org/HiDPI_support
Are you saying that the contraint icon size is currently derived from the font pixel size? And your solution is to make it configurable by the user?
I would rather replace this:
with this:
But I'm not convinced that the icon depends on the font size:
Code: Select all
QImage icon = Gui::BitmapFactory().pixmap(type.toLatin1()).toImage();
It looks like it isn't. So you would have to specify the size:
Code: Select all
qreal pRatio = devicePixelRatio();
qreal defaultCursorSize = 64;
qreal iconSize = defaultIconSize * pRatio;
QImage icon = Gui::BitmapFactory().pixmapFromSvg(type.toLatin1(), QSizeF(iconSize, iconSize)).toImage();
64 pixels is a 48 pt size. So maybe like this:
Code: Select all
QFont font = QApplication::font();
font.setPointSize(48);
QFontMetricsF qfm = QFontMetricsF(font);
qreal iconSize = qfm.xHeight();
QImage icon = Gui::BitmapFactory().pixmapFromSvg(type.toLatin1(), QSizeF(iconSize, iconSize)).toImage();
Maybe 48pt is too large of a size, so I would start with 24pt (32 virtual pixels, 64 device pixels at 200%) which should be equal to the cursor size.