Gui: support to customize the font size of bounding boxes

This commit is contained in:
wmayer
2021-03-02 16:28:35 +01:00
parent c1b3fba031
commit dfba396b4f
3 changed files with 60 additions and 0 deletions

View File

@@ -34,6 +34,7 @@
# include <Inventor/nodes/SoBaseColor.h>
# include <Inventor/nodes/SoCamera.h>
# include <Inventor/nodes/SoDrawStyle.h>
# include <Inventor/nodes/SoFont.h>
# include <Inventor/nodes/SoMaterial.h>
# include <Inventor/nodes/SoSeparator.h>
# include <Inventor/nodes/SoSwitch.h>
@@ -250,6 +251,14 @@ unsigned long ViewProviderGeometryObject::getBoundColor() const
return bbcol;
}
namespace {
float getBoundBoxFontSize()
{
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View");
return hGrp->GetFloat("BoundingBoxFontSize", 10.0);
}
}
void ViewProviderGeometryObject::showBoundingBox(bool show)
{
if (!pcBoundSwitch && show) {
@@ -265,6 +274,9 @@ void ViewProviderGeometryObject::showBoundingBox(bool show)
pcBoundColor->rgb.setValue(r, g, b);
pBoundingSep->addChild(pcBoundColor);
SoFont* font = new SoFont();
font->size.setValue(getBoundBoxFontSize());
pBoundingSep->addChild(font);
pBoundingSep->addChild(new SoResetTransform());
pBoundingSep->addChild(pcBoundingBox);

View File

@@ -64,6 +64,7 @@ void DlgSettingsObjectColor::saveSettings()
ui->DefaultShapeVertexColor->onSave();
ui->DefaultShapeVertexSize->onSave();
ui->BoundingBoxColor->onSave();
ui->BoundingBoxFontSize->onSave();
ui->twosideRendering->onSave();
// Annotations
ui->AnnotationTextColor->onSave();
@@ -79,6 +80,7 @@ void DlgSettingsObjectColor::loadSettings()
ui->DefaultShapeVertexColor->onRestore();
ui->DefaultShapeVertexSize->onRestore();
ui->BoundingBoxColor->onRestore();
ui->BoundingBoxFontSize->onRestore();
ui->twosideRendering->onRestore();
// Annotations
ui->AnnotationTextColor->onRestore();

View File

@@ -241,6 +241,47 @@
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_fontsize">
<property name="minimumSize">
<size>
<width>182</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Bounding box font size</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="Gui::PrefDoubleSpinBox" name="BoundingBoxFontSize">
<property name="toolTip">
<string>The font size of bounding boxes in the 3D view</string>
</property>
<property name="suffix">
<string notr="true">pt</string>
</property>
<property name="decimals">
<number>1</number>
</property>
<property name="maximum">
<double>64.000000000000000</double>
</property>
<property name="minimum">
<double>2.000000000000000</double>
</property>
<property name="value">
<double>10.000000000000000</double>
</property>
<property name="prefEntry" stdset="0">
<cstring>BoundingBoxFontSize</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>View</cstring>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="Gui::PrefCheckBox" name="twosideRendering">
<property name="minimumSize">
<size>
@@ -364,6 +405,11 @@ will be used or black.</string>
<extends>QSpinBox</extends>
<header>Gui/PrefWidgets.h</header>
</customwidget>
<customwidget>
<class>Gui::PrefDoubleSpinBox</class>
<extends>QDoubleSpinBox</extends>
<header>Gui/PrefWidgets.h</header>
</customwidget>
<customwidget>
<class>Gui::PrefColorButton</class>
<extends>Gui::ColorButton</extends>