Add Diameter Symbol preference for fonts without glyph

This commit is contained in:
WandererFan 2016-12-08 14:46:55 -05:00
parent 5b630c0e36
commit bb081266b7
3 changed files with 49 additions and 8 deletions

View File

@ -379,14 +379,20 @@ void CmdTechDrawNewDiameterDimension::activated(int iMsg)
QObject::tr(edgeMsg.str().c_str()));
return;
}
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Dimensions");
std::string diamSym = hGrp->GetASCII("DiameterSymbol","\xe2\x8c\x80");
const char * format = "%value%";
char formatSpec[80];
std::strcpy (formatSpec,diamSym.c_str());
std::strcat (formatSpec,format);
openCommand("Create Dimension");
doCommand(Doc,"App.activeDocument().addObject('TechDraw::DrawViewDimension','%s')",FeatName.c_str());
doCommand(Doc,"App.activeDocument().%s.Type = '%s'",FeatName.c_str()
,"Diameter");
const char * format = "\xe2\x8c\x80%value%";
doCommand(Doc, "App.activeDocument().%s.FormatSpec = '%s'", FeatName.c_str(),format);
doCommand(Doc, "App.activeDocument().%s.FormatSpec = '%s'", FeatName.c_str(),formatSpec);
dim = dynamic_cast<TechDraw::DrawViewDimension *>(getDocument()->getObject(FeatName.c_str()));
if (!dim) {

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>521</width>
<height>384</height>
<height>420</height>
</rect>
</property>
<property name="windowTitle">
@ -19,7 +19,7 @@
<x>10</x>
<y>20</y>
<width>501</width>
<height>141</height>
<height>161</height>
</rect>
</property>
<property name="title">
@ -31,7 +31,7 @@
<x>20</x>
<y>30</y>
<width>471</width>
<height>90</height>
<height>125</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout" columnstretch="1,2,1">
@ -108,6 +108,34 @@
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Diameter Symbol</string>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="Gui::PrefLineEdit" name="leDiameter">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>⌀</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="prefEntry" stdset="0">
<cstring>DiameterSymbol</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>/Mod/TechDraw/Dimensions</cstring>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
@ -115,7 +143,7 @@
<property name="geometry">
<rect>
<x>10</x>
<y>160</y>
<y>190</y>
<width>501</width>
<height>201</height>
</rect>
@ -346,6 +374,11 @@
<extends>QComboBox</extends>
<header>Gui/PrefWidgets.h</header>
</customwidget>
<customwidget>
<class>Gui::PrefLineEdit</class>
<extends>QLineEdit</extends>
<header>Gui/PrefWidgets.h</header>
</customwidget>
<customwidget>
<class>Gui::PrefDoubleSpinBox</class>
<extends>QDoubleSpinBox</extends>

View File

@ -46,6 +46,7 @@ void DlgPrefsTechDraw2Imp::saveSettings()
cbShowUnits->onSave();
dsbFontSize->onSave();
colDimColor->onSave();
leDiameter->onSave();
pcbMatting->onSave();
pcbCenterStyle->onSave();
colCenterLine->onSave();
@ -58,6 +59,7 @@ void DlgPrefsTechDraw2Imp::loadSettings()
cbShowUnits->onRestore();
dsbFontSize->onRestore();
colDimColor->onRestore();
leDiameter->onRestore();
pcbMatting->onRestore();
pcbCenterStyle->onRestore();
colCenterLine->onRestore();