1.Prefereces dialog listbox scaling
Code: Select all
--- a/src/Gui/DlgPreferencesImp.cpp
+++ b/src/Gui/DlgPreferencesImp.cpp
using namespace Gui::Dialog;
/* TRANSLATOR Gui::Dialog::DlgPreferencesImp */
@@ -68,7 +67,7 @@ DlgPreferencesImp::DlgPreferencesImp(QWidget* parent, Qt::WindowFlags fl)
{
ui->setupUi(this);
ui->listBox->setFixedWidth(130);
- ui->listBox->setGridSize(QSize(108, 120));
+ ui->listBox->setGridSize(QSize(108, 108+QFontMetrics(ui->listBox->font()).height()));
connect(ui->buttonBox, SIGNAL (helpRequested()),
getMainWindow(), SLOT (whatsThis()));^M
Code: Select all
--- a/src/Gui/NaviCube.cpp
+++ b/src/Gui/NaviCube.cpp
@@ -394,7 +394,8 @@ GLuint NaviCubeImplementation::createCubeFaceTex(QtGLWidget* gl, float gap, floa
if (text) {
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/NaviCube");
paint.setPen(Qt::white);
- QFont sansFont(str("Helvetica"), 0.18 * texSize);
+ QFont sansFont(str("Helvetica"));
+ sansFont.setPixelSize(0.22 * texSize);
QString fontString = QString::fromUtf8((hGrp->GetASCII("FontString")).c_str());
if (fontString.isEmpty()) {
// Improving readability
Code: Select all
diff --git a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp
index 009d34142..440dcdfb6 100644
--- a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp
+++ b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp
@@ -3523,6 +3523,15 @@ float ViewProviderSketch::getScaleFactor()
}
}
+int ViewProviderSketch::fontSizeForCoin()
+{
+ int ldpi = this->getActiveView()->logicalDpiX();
+ float k = 96./ldpi;
+ ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View");
+ int fontSize = hGrp->GetInt("EditSketcherFontSize", ldpi/8);
+ return fontSize*k;
+}
+
void ViewProviderSketch::draw(bool temp /*=false*/, bool rebuildinformationlayer /*=true*/)
{
assert(edit);
@@ -3558,9 +3567,6 @@ void ViewProviderSketch::draw(bool temp /*=false*/, bool rebuildinformationlayer
Gui::coinRemoveAllChildren(edit->infoGroup);
}
- ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View");
- int fontSize = hGrp->GetInt("EditSketcherFontSize", 17);
-
int currentInfoNode = 0;
ParameterGrp::handle hGrpsk = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher/General");
@@ -3573,6 +3579,7 @@ void ViewProviderSketch::draw(bool temp /*=false*/, bool rebuildinformationlayer
int GeoId = 0;
+ ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View");
int stdcountsegments = hGrp->GetInt("SegmentsPerGeometry", 50);
// value cannot be smaller than 3
if (stdcountsegments < 3)
@@ -3927,7 +3934,7 @@ void ViewProviderSketch::draw(bool temp /*=false*/, bool rebuildinformationlayer
SoFont *font = new SoFont;
font->name.setValue("Helvetica");
- font->size.setValue(fontSize);
+ font->size.setValue(fontSizeForCoin());
SoText2 *degreetext = new SoText2;
degreetext->string = SbString(spline->getDegree());
@@ -4206,7 +4213,7 @@ void ViewProviderSketch::draw(bool temp /*=false*/, bool rebuildinformationlayer
SoFont *font = new SoFont;
font->name.setValue("Helvetica");
- font->size.setValue(fontSize);
+ font->size.setValue(fontSizeForCoin());
SoText2 *degreetext = new SoText2;
degreetext->string = SbString("(")+SbString(*itm)+SbString(")");
@@ -5332,9 +5339,6 @@ void ViewProviderSketch::rebuildConstraintsVisual(void)
Gui::coinRemoveAllChildren(edit->constrGroup);
edit->vConstrType.clear();
- ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View");
- int fontSize = hGrp->GetInt("EditSketcherFontSize", 17);
-
for (std::vector<Sketcher::Constraint *>::const_iterator it=constrlist.begin(); it != constrlist.end(); ++it) {
// root separator for one constraint
SoSeparator *sep = new SoSeparator();
@@ -5378,7 +5382,7 @@ void ViewProviderSketch::rebuildConstraintsVisual(void)
ConstrDimColor
:NonDrivingConstrDimColor)
:DeactivatedConstrDimColor;
- text->size.setValue(fontSize);
+ text->size.setValue(fontSizeForCoin());
text->useAntialiasing = false;
SoAnnotation *anno = new SoAnnotation();
anno->renderCaching = SoSeparator::OFF;
@@ -6047,10 +6051,9 @@ void ViewProviderSketch::createEditInventorNodes(void)
CoordTextMaterials->diffuseColor = cursorTextColor;
Coordsep->addChild(CoordTextMaterials);
- int fontSize = hGrp->GetInt("EditSketcherFontSize", 17);
-
SoFont *font = new SoFont();
- font->size.setValue(fontSize);
+ font->size.setValue(fontSizeForCoin());
+
Coordsep->addChild(font);
edit->textPos = new SoTranslation();
diff --git a/src/Mod/Sketcher/Gui/ViewProviderSketch.h b/src/Mod/Sketcher/Gui/ViewProviderSketch.h
index 571ec209b..b60e81d52 100644
--- a/src/Mod/Sketcher/Gui/ViewProviderSketch.h
+++ b/src/Mod/Sketcher/Gui/ViewProviderSketch.h
@@ -282,6 +282,9 @@ protected:
void forceUpdateData();
+ /// Return value for SoFont.size to display labels fixed size in pixe
+ int fontSizeForCoin();
+
/// Return display string for constraint including hiding units if
//requested.
QString getPresentationString(const Sketcher::Constraint *constraint);
OS: openSUSE Leap 15.2 (KDE//usr/share/xsessions/plasma5)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.22284 (Git) AppImage
Build type: Release
Branch: master
Hash: bf1e8e48389f5e9e25bd77b67fe98da4213e797c
Python version: 3.8.5
Qt version: 5.12.5
Coin version: 4.0.0
OCC version: 7.4.0
Locale: Russian/Russia (ru_RU)
On Right:
OS: openSUSE Leap 15.2 (KDE//usr/share/xsessions/plasma5)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.22426 +6 (Git)
Build type: Debug
Branch: hidpifixes
Hash: 134ca18c326c4dad4ab487c3590a0ee795ec190c
Python version: 3.6.10
Qt version: 5.12.7
Coin version: 3.1.3
OCC version: 6.9.1.oce-0.18
Locale: Russian/Russia (ru_RU)
It would be nice if someone check the behavior, for example on macOS