[TechDraw] let arrow size of a dimension change due property task panel

This commit is contained in:
grubertechnic
2023-06-06 15:47:05 +02:00
committed by WandererFan
parent bf8c59ba2a
commit 46882287f2
6 changed files with 22 additions and 2 deletions

View File

@@ -42,6 +42,7 @@
using namespace TechDraw;
const double Preferences::DefaultFontSizeInMM = 5.0;
const double Preferences::DefaultArrowSize = 3.5;
//! Returns the TechDraw preference group
Base::Reference<ParameterGrp> Preferences::getPreferenceGroup(const char* Name)
@@ -70,6 +71,11 @@ double Preferences::dimFontSizeMM()
return getPreferenceGroup("Dimensions")->GetFloat("FontSize", DefaultFontSizeInMM);
}
double Preferences::dimArrowSize()
{
return getPreferenceGroup("Dimensions")->GetFloat("ArrowSize", DefaultArrowSize);
}
App::Color Preferences::normalColor()
{
App::Color fcColor;

View File

@@ -51,6 +51,7 @@ public:
static QString labelFontQString();
static double labelFontSizeMM();
static double dimFontSizeMM();
static double dimArrowSize();
static App::Color normalColor();
static App::Color selectColor();
@@ -74,6 +75,7 @@ public:
static std::string lineGroupFile();
static const double DefaultFontSizeInMM;
static const double DefaultArrowSize;
static std::string formatSpec();
static int altDecimals();

View File

@@ -74,10 +74,11 @@ void DlgPrefsTechDrawDimensionsImp::loadSettings()
//Quantity widgets do not use preset value since they are based on
//QAbstractSpinBox
double fontDefault = Preferences::dimFontSizeMM();
double arrowDefault = Preferences::dimArrowSize();
ui->plsb_FontSize->setValue(fontDefault);
// double arrowDefault = 5.0;
// plsb_ArrowSize->setValue(arrowDefault);
ui->plsb_ArrowSize->setValue(fontDefault);
ui->plsb_ArrowSize->setValue(arrowDefault);
ui->pcbStandardAndStyle->onRestore();
ui->cbGlobalDecimals->onRestore();

View File

@@ -145,7 +145,7 @@ int PreferencesGui::dimArrowStyle()
double PreferencesGui::dimArrowSize()
{
return Preferences::getPreferenceGroup("Dimensions")->GetFloat("ArrowSize", Preferences::dimFontSizeMM());
return Preferences::getPreferenceGroup("Dimensions")->GetFloat("ArrowSize", Preferences::dimArrowSize());
}

View File

@@ -70,6 +70,9 @@ ViewProviderDimension::ViewProviderDimension()
ADD_PROPERTY_TYPE(Fontsize, (Preferences::dimFontSizeMM()),
group, (App::PropertyType)(App::Prop_None),
"Dimension text size in units");
ADD_PROPERTY_TYPE(Arrowsize, (Preferences::dimArrowSize()),
group, (App::PropertyType)(App::Prop_None),
"Arrow size in units");
ADD_PROPERTY_TYPE(LineWidth, (prefWeight()), group, (App::PropertyType)(App::Prop_None),
"Dimension line width");
ADD_PROPERTY_TYPE(Color, (prefColor()), group, App::Prop_None, "Color of the dimension");
@@ -195,6 +198,7 @@ void ViewProviderDimension::onChanged(const App::Property* p)
{
if ((p == &Font) ||
(p == &Fontsize) ||
(p == &Arrowsize) ||
(p == &LineWidth) ||
(p == &StandardAndStyle) ||
(p == &RenderingExtent) ||
@@ -240,6 +244,11 @@ double ViewProviderDimension::prefFontSize() const
return Preferences::dimFontSizeMM();
}
double ViewProviderDimension::prefArrowSize() const
{
return Preferences::dimArrowSize();
}
double ViewProviderDimension::prefWeight() const
{
return TechDraw::LineGroup::getDefaultWidth("Thin");

View File

@@ -45,6 +45,7 @@ public:
App::PropertyFont Font;
App::PropertyLength Fontsize;
App::PropertyLength Arrowsize;
App::PropertyLength LineWidth;
App::PropertyColor Color;
@@ -81,6 +82,7 @@ public:
App::Color prefColor() const;
std::string prefFont() const;
double prefFontSize() const;
double prefArrowSize() const;
double prefWeight() const;
int prefStandardAndStyle() const;
bool canDelete(App::DocumentObject* obj) const override;