Constraint icons size at Sketcher edit (PR ready)
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
Constraint icons size at Sketcher edit (PR ready)
Hello everyone.
I'm just user at moment.
On my 180 dpi dysplay constraint icons are too small.
I look a bit source and want propose:
Now in ViewProviderSketch::renderConstrIcon
font.setPixelSize(11);
replace with something like:
font.setPixelSize( hGrp->GetInt("EditSketcherFontSize", 17) *0.7 );
It's not a code, just idea.
Separare editable properties not very needed, i thinking.
Thanks, sorry for my english.
I'm just user at moment.
On my 180 dpi dysplay constraint icons are too small.
I look a bit source and want propose:
Now in ViewProviderSketch::renderConstrIcon
font.setPixelSize(11);
replace with something like:
font.setPixelSize( hGrp->GetInt("EditSketcherFontSize", 17) *0.7 );
It's not a code, just idea.
Separare editable properties not very needed, i thinking.
Thanks, sorry for my english.
Last edited by Elyas on Fri Dec 18, 2020 12:37 pm, edited 2 times in total.
Re: Constraint icons size
Can you make a before/after image showing your proposed improvement ?
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
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
Re: Constraint icons size
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:
It looks like it isn't. So you would have to specify the size:
64 pixels is a 48 pt size. So maybe like this:
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.
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:
Code: Select all
font.setPixelSize(11);
Code: Select all
font.setPointSize(8)
Code: Select all
QImage icon = Gui::BitmapFactory().pixmap(type.toLatin1()).toImage();
Code: Select all
qreal pRatio = devicePixelRatio();
qreal defaultCursorSize = 64;
qreal iconSize = defaultIconSize * pRatio;
QImage icon = Gui::BitmapFactory().pixmapFromSvg(type.toLatin1(), QSizeF(iconSize, iconSize)).toImage();
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();
Re: Constraint icons size
No. Currently contraint icon size is hardcoded by 11 pixel.
I'm not sure next: because it is on GL window it not controlled by common scale metod.
Already there is a "EditSketcherFontSize" property . It affect at displayed measure contraint but not contraint icon.
So i suggest to bind contraint icon size to "EditSketcherFontSize"
Re: Constraint icons size at Sketcher edit
We have seen here several times requests to increase the constraint icons size. Especially users with HIDPI screens may benefit. The proposal to link it to the font size sounds reasonable to me; other options could be MarkerSize or to create a new configuration parameter.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: Constraint icons size at Sketcher edit
+1chrisb wrote: ↑Mon Sep 07, 2020 11:39 am We have seen here several times requests to increase the constraint icons size. Especially users with HIDPI screens may benefit. The proposal to link it to the font size sounds reasonable to me; other options could be MarkerSize or to create a new configuration parameter.
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
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
Re: Constraint icons size at Sketcher edit
I have prepared a scalable icon.
You can see they look at equal sizes with the font (35 hardware pixels) Let's determine if a separate slider is needed or relate to the font size.
If we link, we set it equal or slightly less. Or a slider, but in a fraction of the font size.
You can see they look at equal sizes with the font (35 hardware pixels) Let's determine if a separate slider is needed or relate to the font size.
If we link, we set it equal or slightly less. Or a slider, but in a fraction of the font size.
Re: Constraint icons size at Sketcher edit
Do you mean the new setting with a number input to configure the constraint size?Elyas wrote: ↑Fri Sep 18, 2020 7:19 am I have prepared a scalable icon.
You can see they look at equal sizes with the font (35 hardware pixels)
ScalableIcons.png
Let's determine if a separate slider is needed or relate to the font size.
If we link, we set it equal or slightly less. Or a slider, but in a fraction of the font size.
I'd prefer a minimal amount of size related settings.
If we really need to provide user with font customization, I'd use QSS. Something like this:
Code: Select all
CustomOpenGLWidget[type="constraintIcon"] {
font-size: 12pt;
}
Re: Constraint icons size at Sketcher edit
Scalable icons, the size is related to the default font:
Notes:
checked when"EditSketcherFontSize" was removed from users.cfg
view3D_factor - since it is a little more difficult to read in the view3D window, you should zoom in a little.
"EditSketcherFontSize" - would mean physical pixels.
Main code:
Code: Select all
void ViewProviderSketch::InitSizes()
{
int defaultFontSize = QApplication::fontMetrics().capHeight();
qreal ldpi = QApplication::desktop()->logicalDpiX();
float k = 96./ldpi;
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View");
float view3D_factor = 1.25;
constraintIconSize = hGrp->GetInt("EditSketcherFontSize", defaultFontSize*view3D_factor);
coinFontSize = constraintIconSize * k;
return;
}
checked when"EditSketcherFontSize" was removed from users.cfg
view3D_factor - since it is a little more difficult to read in the view3D window, you should zoom in a little.
"EditSketcherFontSize" - would mean physical pixels.