Skip to content

Commit 1562436

Browse files
WandererFanchennes
authored andcommitted
[TD]Property types and spinboxes for Detail
1 parent 7ad9ffc commit 1562436

File tree

3 files changed

+125
-80
lines changed

3 files changed

+125
-80
lines changed

src/Mod/TechDraw/App/DrawViewDetail.cpp

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@ void DrawViewDetail::onChanged(const App::Property* prop)
139139

140140
App::DocumentObjectExecReturn* DrawViewDetail::execute()
141141
{
142-
// Base::Console().Message("DVD::execute() - %s\n", getNameInDocument());
143142
if (!keepUpdated()) {
144143
return DrawView::execute();
145144
}
@@ -254,6 +253,7 @@ void DrawViewDetail::makeDetailShape(const TopoDS_Shape& shape3d, DrawViewPart*
254253

255254
TopoDS_Face extrusionFace;
256255
Base::Vector3d extrudeVec = dirDetail * extrudeLength;
256+
257257
gp_Vec extrudeDir(extrudeVec.x, extrudeVec.y, extrudeVec.z);
258258
TopoDS_Shape tool;
259259
if (Preferences::mattingStyle()) {
@@ -381,7 +381,6 @@ void DrawViewDetail::makeDetailShape(const TopoDS_Shape& shape3d, DrawViewPart*
381381

382382
void DrawViewDetail::postHlrTasks(void)
383383
{
384-
// Base::Console().Message("DVD::postHlrTasks()\n");
385384
DrawViewPart::postHlrTasks();
386385

387386
geometryObject->pruneVertexGeom(Base::Vector3d(0.0, 0.0, 0.0),
@@ -465,9 +464,35 @@ bool DrawViewDetail::debugDetail() const
465464
return Preferences::getPreferenceGroup("debug")->GetBool("debugDetail", false);
466465
}
467466

467+
void DrawViewDetail::handleChangedPropertyType(Base::XMLReader &reader, const char * TypeName, App::Property * prop)
468+
{
469+
if (prop == &AnchorPoint) {
470+
// AnchorPoint was PropertyVector but is now PropertyPosition
471+
App::PropertyVector tmp;
472+
if (strcmp(tmp.getTypeId().getName(), TypeName)==0) {
473+
tmp.setContainer(this);
474+
tmp.Restore(reader);
475+
auto tmpValue = tmp.getValue();
476+
AnchorPoint.setValue(tmpValue);
477+
}
478+
return;
479+
}
480+
481+
if (prop == &Radius) {
482+
// Radius was PropertyFloat but is now PropertyLength
483+
App::PropertyLength tmp;
484+
if (strcmp(tmp.getTypeId().getName(), TypeName)==0) {
485+
tmp.setContainer(this);
486+
tmp.Restore(reader);
487+
auto tmpValue = tmp.getValue();
488+
Radius.setValue(tmpValue);
489+
}
490+
return;
491+
}
492+
}
493+
468494
void DrawViewDetail::unsetupObject()
469495
{
470-
// Base::Console().Message("DVD::unsetupObject()\n");
471496
App::DocumentObject* baseObj = BaseView.getValue();
472497
DrawView* base = dynamic_cast<DrawView*>(baseObj);
473498
if (base) {

src/Mod/TechDraw/App/DrawViewDetail.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ class TechDrawExport DrawViewDetail : public DrawViewPart
5757
~DrawViewDetail() override;
5858

5959
App::PropertyLink BaseView;
60-
App::PropertyVector AnchorPoint;
61-
App::PropertyFloat Radius;
60+
App::PropertyPosition AnchorPoint;
61+
App::PropertyLength Radius;
6262
App::PropertyString Reference;
6363

6464
App::PropertyBool ShowMatting;
@@ -71,6 +71,8 @@ class TechDrawExport DrawViewDetail : public DrawViewPart
7171
return "TechDrawGui::ViewProviderViewPart";
7272
}
7373
void unsetupObject() override;
74+
void handleChangedPropertyType(
75+
Base::XMLReader &reader, const char * TypeName, App::Property * prop) override;
7476

7577

7678
void detailExec(TopoDS_Shape& s,

src/Mod/TechDraw/Gui/TaskDetail.ui

Lines changed: 93 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,16 @@
66
<rect>
77
<x>0</x>
88
<y>0</y>
9-
<width>300</width>
10-
<height>264</height>
9+
<width>497</width>
10+
<height>367</height>
1111
</rect>
1212
</property>
13+
<property name="sizePolicy">
14+
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
15+
<horstretch>0</horstretch>
16+
<verstretch>0</verstretch>
17+
</sizepolicy>
18+
</property>
1319
<property name="windowTitle">
1420
<string>Detail Anchor</string>
1521
</property>
@@ -107,31 +113,31 @@
107113
</widget>
108114
</item>
109115
<item>
110-
<layout class="QGridLayout" name="gridLayout_2" columnstretch="2,0,0">
111-
<item row="0" column="0">
112-
<widget class="QLabel" name="label_2">
116+
<layout class="QGridLayout" name="gridLayout_2" columnstretch="1,0,2">
117+
<item row="3" column="0">
118+
<widget class="QLabel" name="label_9">
113119
<property name="text">
114-
<string notr="true">X</string>
120+
<string>Scale Type</string>
115121
</property>
116122
</widget>
117123
</item>
118-
<item row="0" column="1">
119-
<spacer name="horizontalSpacer_3">
120-
<property name="orientation">
121-
<enum>Qt::Horizontal</enum>
124+
<item row="5" column="2">
125+
<widget class="QLineEdit" name="leReference">
126+
<property name="toolTip">
127+
<string>reference label</string>
122128
</property>
123-
<property name="sizeHint" stdset="0">
124-
<size>
125-
<width>40</width>
126-
<height>20</height>
127-
</size>
129+
<property name="alignment">
130+
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
128131
</property>
129-
</spacer>
132+
</widget>
130133
</item>
131-
<item row="0" column="2">
132-
<widget class="Gui::QuantitySpinBox" name="qsbX">
134+
<item row="4" column="2">
135+
<widget class="Gui::QuantitySpinBox" name="qsbScale">
136+
<property name="enabled">
137+
<bool>false</bool>
138+
</property>
133139
<property name="toolTip">
134-
<string>x position of detail highlight within view</string>
140+
<string>scale factor for detail view</string>
135141
</property>
136142
<property name="alignment">
137143
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@@ -142,20 +148,22 @@
142148
<property name="unit" stdset="0">
143149
<string notr="true"/>
144150
</property>
145-
<property name="value">
146-
<double>0.000000000000000</double>
151+
<property name="singleStep">
152+
<double>1.000000000000000</double>
147153
</property>
148-
</widget>
149-
</item>
150-
<item row="1" column="0">
151-
<widget class="QLabel" name="label_3">
152-
<property name="text">
153-
<string notr="true">Y</string>
154+
<property name="value">
155+
<double>1.000000000000000</double>
154156
</property>
155157
</widget>
156158
</item>
157159
<item row="1" column="2">
158160
<widget class="Gui::QuantitySpinBox" name="qsbY">
161+
<property name="sizePolicy">
162+
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
163+
<horstretch>0</horstretch>
164+
<verstretch>0</verstretch>
165+
</sizepolicy>
166+
</property>
159167
<property name="toolTip">
160168
<string>y position of detail highlight within view</string>
161169
</property>
@@ -170,15 +178,21 @@
170178
</property>
171179
</widget>
172180
</item>
173-
<item row="2" column="0">
174-
<widget class="QLabel" name="label_6">
181+
<item row="4" column="0">
182+
<widget class="QLabel" name="label_8">
175183
<property name="text">
176-
<string>Radius</string>
184+
<string>Scale Factor</string>
177185
</property>
178186
</widget>
179187
</item>
180188
<item row="2" column="2">
181189
<widget class="Gui::QuantitySpinBox" name="qsbRadius">
190+
<property name="sizePolicy">
191+
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
192+
<horstretch>0</horstretch>
193+
<verstretch>0</verstretch>
194+
</sizepolicy>
195+
</property>
182196
<property name="toolTip">
183197
<string>size of detail view</string>
184198
</property>
@@ -196,10 +210,43 @@
196210
</property>
197211
</widget>
198212
</item>
199-
<item row="3" column="0">
200-
<widget class="QLabel" name="label_9">
213+
<item row="5" column="0">
214+
<widget class="QLabel" name="label_7">
201215
<property name="text">
202-
<string>Scale Type</string>
216+
<string>Reference</string>
217+
</property>
218+
</widget>
219+
</item>
220+
<item row="0" column="2">
221+
<widget class="Gui::QuantitySpinBox" name="qsbX">
222+
<property name="sizePolicy">
223+
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
224+
<horstretch>0</horstretch>
225+
<verstretch>0</verstretch>
226+
</sizepolicy>
227+
</property>
228+
<property name="toolTip">
229+
<string>x position of detail highlight within view</string>
230+
</property>
231+
<property name="alignment">
232+
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
233+
</property>
234+
<property name="unit" stdset="0">
235+
<string notr="true"/>
236+
</property>
237+
</widget>
238+
</item>
239+
<item row="2" column="0">
240+
<widget class="QLabel" name="label_6">
241+
<property name="text">
242+
<string>Radius</string>
243+
</property>
244+
</widget>
245+
</item>
246+
<item row="0" column="0">
247+
<widget class="QLabel" name="label_2">
248+
<property name="text">
249+
<string notr="true">X</string>
203250
</property>
204251
</widget>
205252
</item>
@@ -228,54 +275,25 @@ Custom: custom scale factor is used</string>
228275
</item>
229276
</widget>
230277
</item>
231-
<item row="4" column="0">
232-
<widget class="QLabel" name="label_8">
233-
<property name="text">
234-
<string>Scale Factor</string>
235-
</property>
236-
</widget>
237-
</item>
238-
<item row="4" column="2">
239-
<widget class="Gui::QuantitySpinBox" name="qsbScale">
240-
<property name="enabled">
241-
<bool>false</bool>
242-
</property>
243-
<property name="toolTip">
244-
<string>scale factor for detail view</string>
245-
</property>
246-
<property name="alignment">
247-
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
248-
</property>
249-
<property name="keyboardTracking">
250-
<bool>false</bool>
251-
</property>
252-
<property name="unit" stdset="0">
253-
<string notr="true"/>
254-
</property>
255-
<property name="singleStep">
256-
<double>1.000000000000000</double>
257-
</property>
258-
<property name="value">
259-
<double>1.000000000000000</double>
260-
</property>
261-
</widget>
262-
</item>
263-
<item row="5" column="0">
264-
<widget class="QLabel" name="label_7">
278+
<item row="1" column="0">
279+
<widget class="QLabel" name="label_3">
265280
<property name="text">
266-
<string>Reference</string>
281+
<string notr="true">Y</string>
267282
</property>
268283
</widget>
269284
</item>
270-
<item row="5" column="2">
271-
<widget class="QLineEdit" name="leReference">
272-
<property name="toolTip">
273-
<string>reference label</string>
285+
<item row="0" column="1">
286+
<spacer name="horizontalSpacer_3">
287+
<property name="orientation">
288+
<enum>Qt::Horizontal</enum>
274289
</property>
275-
<property name="alignment">
276-
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
290+
<property name="sizeHint" stdset="0">
291+
<size>
292+
<width>40</width>
293+
<height>20</height>
294+
</size>
277295
</property>
278-
</widget>
296+
</spacer>
279297
</item>
280298
</layout>
281299
</item>

0 commit comments

Comments
 (0)