diff --git a/src/Mod/Fem/feminout/importZ88Mesh.py b/src/Mod/Fem/feminout/importZ88Mesh.py
index 7388ff9bc0..7bc92951d0 100644
--- a/src/Mod/Fem/feminout/importZ88Mesh.py
+++ b/src/Mod/Fem/feminout/importZ88Mesh.py
@@ -91,7 +91,7 @@ def export(
femnodes_mesh = obj.FemMesh.Nodes
femelement_table = meshtools.get_femelement_table(obj.FemMesh)
z88_element_type = get_z88_element_type(obj.FemMesh, femelement_table)
- f = pyopen(filename, "wb")
+ f = pyopen(filename, "w")
write_z88_mesh_to_file(femnodes_mesh, femelement_table, z88_element_type, f)
f.close()
diff --git a/src/Mod/TechDraw/App/DrawTile.cpp b/src/Mod/TechDraw/App/DrawTile.cpp
index 51af3ca07c..fbeb6b4c27 100644
--- a/src/Mod/TechDraw/App/DrawTile.cpp
+++ b/src/Mod/TechDraw/App/DrawTile.cpp
@@ -49,8 +49,17 @@ DrawTile::DrawTile(void)
ADD_PROPERTY_TYPE(TileParent,(0),group,(App::PropertyType)(App::Prop_None),
"Object to which this tile is attached");
- ADD_PROPERTY_TYPE(TileRow, (0), group, App::Prop_None, "Row in parent");
- ADD_PROPERTY_TYPE(TileColumn, (0), group, App::Prop_None, "Column in parent");
+ ADD_PROPERTY_TYPE(TileRow, (0), group, App::Prop_None, "Row in parent object\n 0 for arrow side, -1 for other side");
+ ADD_PROPERTY_TYPE(TileColumn, (0), group, App::Prop_None, "Column in parent object");
+
+ // there is currently only one column, this don't allow to edit
+ TileColumn.setStatus(App::Property::ReadOnly, true);
+ // the row can only have the value 0 or -1
+ // allow its editing because this way the tiles can be flipped
+ TileRowConstraints.LowerBound = -1;
+ TileRowConstraints.UpperBound = 0;
+ TileRowConstraints.StepSize = 1;
+ TileRow.setConstraints(&TileRowConstraints);
}
DrawTile::~DrawTile()
@@ -77,6 +86,18 @@ App::DocumentObjectExecReturn *DrawTile::execute(void)
return DocumentObject::execute();
}
+void DrawTile::handleChangedPropertyType(Base::XMLReader &reader, const char *TypeName, App::Property *prop)
+// transforms properties that had been changed
+{
+ // property TileRow had App::PropertyInteger and was changed to App::PropertyIntegerConstraint
+ if (prop == &TileRow && strcmp(TypeName, "App::PropertyInteger") == 0) {
+ App::PropertyInteger TileRowProperty;
+ // restore the PropertyInteger to be able to set its value
+ TileRowProperty.Restore(reader);
+ TileRow.setValue(TileRowProperty.getValue());
+ }
+}
+
DrawView* DrawTile::getParent(void) const
{
// Base::Console().Message("DT::getParent() - %s\n", getNameInDocument());
diff --git a/src/Mod/TechDraw/App/DrawTile.h b/src/Mod/TechDraw/App/DrawTile.h
index 1f3de65d43..221a35782d 100644
--- a/src/Mod/TechDraw/App/DrawTile.h
+++ b/src/Mod/TechDraw/App/DrawTile.h
@@ -40,9 +40,9 @@ public:
virtual ~DrawTile();
App::PropertyLink TileParent; //eg DrawWeldSymbol
- App::PropertyInteger TileRow;
+ App::PropertyIntegerConstraint TileRow;
+ App::PropertyIntegerConstraint::Constraints TileRowConstraints;
App::PropertyInteger TileColumn;
-/* App::PropertyVector TileOrigin; //sb call to TileParent - WeldingSymbol*/
virtual short mustExecute() const;
virtual App::DocumentObjectExecReturn *execute(void);
@@ -55,6 +55,7 @@ public:
protected:
virtual void onChanged(const App::Property* prop);
+ virtual void handleChangedPropertyType(Base::XMLReader &reader, const char *TypeName, App::Property * prop);
private:
};
diff --git a/src/Mod/TechDraw/App/DrawTileWeld.cpp b/src/Mod/TechDraw/App/DrawTileWeld.cpp
index 8be2991608..8d737d002e 100644
--- a/src/Mod/TechDraw/App/DrawTileWeld.cpp
+++ b/src/Mod/TechDraw/App/DrawTileWeld.cpp
@@ -53,18 +53,17 @@ DrawTileWeld::DrawTileWeld(void)
static const char *group = "TileWeld";
ADD_PROPERTY_TYPE(LeftText,(""),group,(App::PropertyType)(App::Prop_None),
- "Text LHS");
- ADD_PROPERTY_TYPE(RightText, (0), group, App::Prop_None, "Text RHS");
- ADD_PROPERTY_TYPE(CenterText, (0), group, App::Prop_None, "Text above Symbol");
- ADD_PROPERTY_TYPE(SymbolFile, (prefSymbol()), group, App::Prop_None, "Symbol Symbol File");
- ADD_PROPERTY_TYPE(SymbolIncluded, (""), group,App::Prop_None,
+ "Text before symbol");
+ ADD_PROPERTY_TYPE(RightText, (0), group, App::Prop_None, "Text after symbol");
+ ADD_PROPERTY_TYPE(CenterText, (0), group, App::Prop_None, "Text above/below symbol");
+ ADD_PROPERTY_TYPE(SymbolFile, (prefSymbol()), group, App::Prop_None, "Symbol File");
+ ADD_PROPERTY_TYPE(SymbolIncluded, (""), group, App::Prop_None,
"Embedded Symbol. System use only."); // n/a to end users
// SymbolFile.setStatus(App::Property::ReadOnly,true);
std::string svgFilter("Symbol files (*.svg *.SVG);;All files (*)");
SymbolFile.setFilter(svgFilter);
-
}
DrawTileWeld::~DrawTileWeld()
diff --git a/src/Mod/TechDraw/App/DrawView.cpp b/src/Mod/TechDraw/App/DrawView.cpp
index 8302613477..873e934a98 100644
--- a/src/Mod/TechDraw/App/DrawView.cpp
+++ b/src/Mod/TechDraw/App/DrawView.cpp
@@ -116,6 +116,9 @@ void DrawView::checkScale(void)
void DrawView::onChanged(const App::Property* prop)
{
+//Coding note: calling execute, recompute or recomputeFeature inside an onChanged
+//method can create infinite loops. In general don't do this! There may be
+//situations where it is OK, but careful analysis is a must.
if (!isRestoring()) {
if (prop == &ScaleType) {
auto page = findParentPage();
@@ -144,14 +147,9 @@ void DrawView::onChanged(const App::Property* prop)
handleXYLock();
LockPosition.purgeTouched();
}
- if ((prop == &Caption) ||
- (prop == &Label)) {
- requestPaint();
- } // rotation and scaling requires recompute
- else if ((prop == &Rotation) ||
- (prop == &Scale) ||
- (prop == &ScaleType)) {
- recompute();
+ if ((prop == &Caption) ||
+ (prop == &Label)) {
+ requestPaint();
}
}
App::DocumentObject::onChanged(prop);
diff --git a/src/Mod/TechDraw/Gui/DlgTemplateField.ui b/src/Mod/TechDraw/Gui/DlgTemplateField.ui
index ecd80bbc7e..6565a9d86b 100644
--- a/src/Mod/TechDraw/Gui/DlgTemplateField.ui
+++ b/src/Mod/TechDraw/Gui/DlgTemplateField.ui
@@ -9,8 +9,8 @@
0
0
- 420
- 160
+ 340
+ 90
@@ -19,68 +19,46 @@
true
-
- -
-
-
-
- 0
- 0
-
+
+
-
+
+
-
+
+
+ Text Name:
+
+
+
+ -
+
+
+ TextLabel
+
+
+
+ -
+
+
+ Value:
+
+
+
+ -
+
+
+
+
+ -
+
+
+ Qt::Horizontal
-
- QFrame::StyledPanel
+
+ QDialogButtonBox::Cancel|QDialogButtonBox::Ok
-
- QFrame::Raised
+
+ false
-
-
-
-
-
-
-
-
-
-
-
- Text Name:
-
-
-
- -
-
-
- TextLabel
-
-
-
- -
-
-
- Value:
-
-
-
- -
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
- QDialogButtonBox::Cancel|QDialogButtonBox::Ok
-
-
- false
-
-
-
-
-
-
diff --git a/src/Mod/TechDraw/Gui/SymbolChooser.cpp b/src/Mod/TechDraw/Gui/SymbolChooser.cpp
index fac665daf4..6cc636663b 100644
--- a/src/Mod/TechDraw/Gui/SymbolChooser.cpp
+++ b/src/Mod/TechDraw/Gui/SymbolChooser.cpp
@@ -48,10 +48,6 @@ SymbolChooser::SymbolChooser(QWidget *parent,
m_source(source)
{
ui->setupUi(this);
- connect(ui->pbOK, SIGNAL(clicked(bool)),
- this, SLOT(onOKClicked(bool)));
- connect(ui->pbCancel, SIGNAL(clicked(bool)),
- this, SLOT(onCancelClicked(bool)));
connect(ui->fcSymbolDir, SIGNAL(fileNameSelected(const QString&)),
this, SLOT(onDirectorySelected(const QString&)));
connect(ui->lwSymbols, SIGNAL(itemClicked(QListWidgetItem*)), //double click?
@@ -85,10 +81,9 @@ void SymbolChooser::setUiPrimary()
ui->lwSymbols->setAcceptDrops(false);
}
-void SymbolChooser::onOKClicked(bool b)
+void SymbolChooser::onOKClicked()
{
- Q_UNUSED(b);
-// Base::Console().Message("SC::OnOKClicked()\n");
+ QDialog::accept();
QListWidgetItem* sourceItem = ui->lwSymbols->currentItem();
if (!sourceItem)
return;
@@ -98,15 +93,11 @@ void SymbolChooser::onOKClicked(bool b)
QString::fromUtf8(".svg");
Q_EMIT symbolSelected(m_symbolPath, m_source);
-// Base::Console().Message("SC::onOKClicked - symbol; %s\n", qPrintable(m_symbolPath));
- accept();
}
-void SymbolChooser::onCancelClicked(bool b)
+void SymbolChooser::onCancelClicked()
{
- Q_UNUSED(b);
-// Base::Console().Message("SC::OnCancelCicked()\n");
- reject();
+ QDialog::reject();
}
void SymbolChooser::onItemClicked(QListWidgetItem* item)
diff --git a/src/Mod/TechDraw/Gui/SymbolChooser.h b/src/Mod/TechDraw/Gui/SymbolChooser.h
index d45fc58eee..dbd9fe7556 100644
--- a/src/Mod/TechDraw/Gui/SymbolChooser.h
+++ b/src/Mod/TechDraw/Gui/SymbolChooser.h
@@ -40,8 +40,8 @@ public:
QString source = QString());
public Q_SLOTS:
- void onOKClicked(bool b);
- void onCancelClicked(bool b);
+ void onOKClicked();
+ void onCancelClicked();
void onItemClicked(QListWidgetItem* item);
void onDirectorySelected(const QString& newDir);
diff --git a/src/Mod/TechDraw/Gui/SymbolChooser.ui b/src/Mod/TechDraw/Gui/SymbolChooser.ui
index 634b025821..c7bc556075 100644
--- a/src/Mod/TechDraw/Gui/SymbolChooser.ui
+++ b/src/Mod/TechDraw/Gui/SymbolChooser.ui
@@ -1,7 +1,7 @@
- SymbolChooser
-
+ TechDrawGui::SymbolChooser
+
Qt::WindowModal
@@ -9,108 +9,59 @@
0
0
- 400
- 394
+ 360
+ 280
- SymbolChooser
+ Symbol Chooser
true
-
-
-
- 19
- 19
- 361
- 341
-
-
-
-
- 0
- 0
-
-
-
- QFrame::StyledPanel
-
-
- QFrame::Raised
-
-
- 2
-
-
-
-
- 9
- 19
- 341
- 191
-
-
-
- -
-
-
-
-
-
-
-
- 10
- 220
- 341
- 41
-
-
-
- -
-
-
- Cancel
-
-
-
- -
-
-
- OK
-
-
-
-
-
-
-
-
- 10
- 280
- 341
- 35
-
-
-
- -
+
+
-
+
+
+ Select a symbol that should be used
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QDialogButtonBox::Cancel|QDialogButtonBox::Ok
+
+
+ false
+
+
+
+ -
+
+
-
Symbol Dir
- -
+
-
+
+ Directory to welding symbols.
+
Gui::FileChooser::Directory
-
-
+
+
@@ -120,5 +71,38 @@
-
+
+
+ bbButtons
+ accepted()
+ TechDrawGui::SymbolChooser
+ accept()
+
+
+ 179
+ 228
+
+
+ 179
+ 139
+
+
+
+
+ bbButtons
+ rejected()
+ TechDrawGui::SymbolChooser
+ reject()
+
+
+ 179
+ 228
+
+
+ 179
+ 139
+
+
+
+
diff --git a/src/Mod/TechDraw/Gui/TaskActiveView.cpp b/src/Mod/TechDraw/Gui/TaskActiveView.cpp
index 1bb61b5623..a7f123e4cf 100644
--- a/src/Mod/TechDraw/Gui/TaskActiveView.cpp
+++ b/src/Mod/TechDraw/Gui/TaskActiveView.cpp
@@ -73,11 +73,15 @@ TaskActiveView::TaskActiveView(TechDraw::DrawPage* pageFeat) :
// Base::Console().Message("TAV::TAV() - create mode\n");
if (m_pageFeat == nullptr) {
//should be caught in CMD caller
- Base::Console().Error("TaskActiveView - bad parameters. Can not proceed.\n");
+ Base::Console().Error("TaskActiveView - bad parameters. Can not proceed.\n");
return;
}
ui->setupUi(this);
+ ui->qsbWidth->setUnit(Base::Unit::Length);
+ ui->qsbHeight->setUnit(Base::Unit::Length);
+ ui->qsbBorder->setUnit(Base::Unit::Length);
+
setUiPrimary();
}
diff --git a/src/Mod/TechDraw/Gui/TaskActiveView.ui b/src/Mod/TechDraw/Gui/TaskActiveView.ui
index 70a5860dbb..4f7dda1a0c 100644
--- a/src/Mod/TechDraw/Gui/TaskActiveView.ui
+++ b/src/Mod/TechDraw/Gui/TaskActiveView.ui
@@ -1,243 +1,284 @@
-
-
- TaskActiveView
-
-
-
- 0
- 0
- 423
- 317
-
-
-
-
- 0
- 0
-
-
-
-
- 250
- 0
-
-
-
- ActiveView to TD View
-
-
-
- :/icons/actions/techdraw-ActiveView.svg:/icons/actions/techdraw-activeview.svg
-
-
- -
-
-
-
- 0
- 0
-
-
-
- QFrame::Box
-
-
- QFrame::Raised
-
-
-
-
-
-
-
-
-
- QFormLayout::AllNonFixedFieldsGrow
-
-
-
-
-
- Width
-
-
-
- -
-
-
- Width of generated view
-
-
-
-
-
- 0.000000000000000
-
-
- 297.000000000000000
-
-
-
- -
-
-
- Height
-
-
-
- -
-
-
- Border
-
-
-
- -
-
-
- Unused area around view
-
-
-
-
-
- 0.000000000000000
-
-
-
- -
-
-
- Paint background yes/no
-
-
- Background
-
-
-
- -
-
-
- Background color
-
-
-
- -
-
-
- Line Width
-
-
-
- -
-
-
- Width of lines in generated view.
-
-
-
-
-
- 0.000000000000000
-
-
- 0.500000000000000
-
-
-
- -
-
-
- Render Mode
-
-
-
- -
-
-
- Drawing style - see SoRenderManager
-
-
-
-
- AS_IS
-
-
- -
-
- WIREFRAME
-
-
- -
-
- POINTS
-
-
- -
-
- WIREFRAME_OVERLAY
-
-
- -
-
- HIDDEN_LINE
-
-
- -
-
- BOUNDING_BOX
-
-
-
-
- -
-
-
- Height of generated view
-
-
-
-
-
- 0.000000000000000
-
-
- 210.000000000000000
-
-
-
- -
-
-
- Qt::Vertical
-
-
-
- 20
- 40
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Gui::QuantitySpinBox
- QWidget
-
-
-
- Gui::ColorButton
- QPushButton
-
-
-
-
-
-
-
-
+
+
+ TaskActiveView
+
+
+
+ 0
+ 0
+ 375
+ 176
+
+
+
+
+ 0
+ 0
+
+
+
+
+ 0
+ 0
+
+
+
+ ActiveView to TD View
+
+
+
+ :/icons/actions/techdraw-ActiveView.svg:/icons/actions/techdraw-ActiveView.svg
+
+
+ -
+
+
-
+
+
+ Width
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Width of generated view
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+
+
+
+ 0.000000000000000
+
+
+ 297.000000000000000
+
+
+
+ -
+
+
+ Height
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Height of generated view
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+
+
+
+ 0.000000000000000
+
+
+ 210.000000000000000
+
+
+
+ -
+
+
+ Border
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Minimal distance of the object from
+the top and left view border
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+
+
+
+ 0.000000000000000
+
+
+
+ -
+
+
+ Paint background yes/no
+
+
+ Background
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 28
+ 20
+
+
+
+
+ -
+
+
+ false
+
+
+
+ 0
+ 0
+
+
+
+ Background color
+
+
+
+ -
+
+
+ Line Width
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Width of lines in generated view
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+
+
+
+ 0.000000000000000
+
+
+ 0.100000000000000
+
+
+ 0.500000000000000
+
+
+
+ -
+
+
+ Render Mode
+
+
+
+ -
+
+
+ Drawing style - see SoRenderManager
+
+
-
+
+ AS_IS
+
+
+ -
+
+ WIREFRAME
+
+
+ -
+
+ POINTS
+
+
+ -
+
+ WIREFRAME_OVERLAY
+
+
+ -
+
+ HIDDEN_LINE
+
+
+ -
+
+ BOUNDING_BOX
+
+
+
+
+
+
+
+
+
+
+ Gui::QuantitySpinBox
+ QWidget
+
+
+
+ Gui::ColorButton
+ QPushButton
+
+
+
+
+
+
+
+
+ cbbg
+ toggled(bool)
+ ccBgColor
+ setEnabled(bool)
+
+
+ 49
+ 99
+
+
+ 295
+ 99
+
+
+
+
+
diff --git a/src/Mod/TechDraw/Gui/TaskGeomHatch.cpp b/src/Mod/TechDraw/Gui/TaskGeomHatch.cpp
index 6447649c24..def79cfdd2 100644
--- a/src/Mod/TechDraw/Gui/TaskGeomHatch.cpp
+++ b/src/Mod/TechDraw/Gui/TaskGeomHatch.cpp
@@ -105,11 +105,11 @@ void TaskGeomHatch::updateValues()
QString cText = ui->cbName->currentText();
m_name = cText.toUtf8().constData();
m_hatch->NamePattern.setValue(m_name);
- m_scale = ui->sbScale->value();
+ m_scale = ui->sbScale->value().getValue();
m_hatch->ScalePattern.setValue(m_scale);
m_color.setValue(ui->ccColor->color());
m_Vp->ColorPattern.setValue(m_color);
- m_weight = ui->sbWeight->value();
+ m_weight = ui->sbWeight->value().getValue();
m_Vp->WeightPattern.setValue(m_weight);
}
@@ -152,13 +152,13 @@ void TaskGeomHatch::onNameChanged()
void TaskGeomHatch::onScaleChanged()
{
- m_hatch->ScalePattern.setValue(ui->sbScale->value());
+ m_hatch->ScalePattern.setValue(ui->sbScale->value().getValue());
m_source->getDocument()->recompute();
}
void TaskGeomHatch::onLineWeightChanged()
{
- m_Vp->WeightPattern.setValue(ui->sbWeight->value());
+ m_Vp->WeightPattern.setValue(ui->sbWeight->value().getValue());
m_source->getDocument()->recompute();
}
diff --git a/src/Mod/TechDraw/Gui/TaskGeomHatch.ui b/src/Mod/TechDraw/Gui/TaskGeomHatch.ui
index 52785cec31..44e72ce644 100644
--- a/src/Mod/TechDraw/Gui/TaskGeomHatch.ui
+++ b/src/Mod/TechDraw/Gui/TaskGeomHatch.ui
@@ -7,11 +7,11 @@
0
0
385
- 265
+ 191
-
+
0
0
@@ -25,8 +25,8 @@
Apply Geometric Hatch to Face
-
- -
+
+
-
@@ -37,8 +37,8 @@
Define your pattern
-
-
-
+
+
-
-
@@ -62,7 +62,7 @@
- -
+
-
-
@@ -107,6 +107,12 @@
-
+
+
+ 0
+ 22
+
+
Name of pattern within file
@@ -114,26 +120,56 @@
-
+
+
+ 0
+ 22
+
+
Color of pattern lines
-
-
+
+
+
+ 0
+ 22
+
+
Enlarges/shrinks the pattern
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+ 0.100000000000000
+
1.000000000000000
-
-
+
+
+
+ 0
+ 22
+
+
Thickness of lines within the pattern
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+ 0.100000000000000
+
1.000000000000000
@@ -144,19 +180,6 @@
- -
-
-
- Qt::Vertical
-
-
-
- 20
- 40
-
-
-
-
@@ -165,6 +188,11 @@
QWidget
+
+ Gui::QuantitySpinBox
+ QWidget
+
+
Gui::ColorButton
QPushButton
diff --git a/src/Mod/TechDraw/Gui/TaskRestoreLines.ui b/src/Mod/TechDraw/Gui/TaskRestoreLines.ui
index db6338b64c..f8199ce9d3 100644
--- a/src/Mod/TechDraw/Gui/TaskRestoreLines.ui
+++ b/src/Mod/TechDraw/Gui/TaskRestoreLines.ui
@@ -7,7 +7,7 @@
0
0
227
- 180
+ 130
diff --git a/src/Mod/TechDraw/Gui/TaskSectionView.cpp b/src/Mod/TechDraw/Gui/TaskSectionView.cpp
index fcb879ccfd..36e5dc1e93 100644
--- a/src/Mod/TechDraw/Gui/TaskSectionView.cpp
+++ b/src/Mod/TechDraw/Gui/TaskSectionView.cpp
@@ -94,19 +94,12 @@ TaskSectionView::TaskSectionView(TechDraw::DrawViewPart* base) :
m_saveBaseName = m_base->getNameInDocument();
m_savePageName = m_base->findParentPage()->getNameInDocument();
-
- ui->setupUi(this);
+ ui->setupUi(this);
- connect(ui->pbUp, SIGNAL(clicked(bool)),
- this, SLOT(onUpClicked(bool)));
- connect(ui->pbDown, SIGNAL(clicked(bool)),
- this, SLOT(onDownClicked(bool)));
- connect(ui->pbRight, SIGNAL(clicked(bool)),
- this, SLOT(onRightClicked(bool)));
- connect(ui->pbLeft, SIGNAL(clicked(bool)),
- this, SLOT(onLeftClicked(bool)));
- connect(ui->pbApply, SIGNAL(clicked(bool)),
- this, SLOT(onApplyClicked(bool)));
+ connect(ui->pbUp, SIGNAL(clicked(bool)), this, SLOT(onUpClicked()));
+ connect(ui->pbDown, SIGNAL(clicked(bool)), this, SLOT(onDownClicked()));
+ connect(ui->pbRight, SIGNAL(clicked(bool)), this, SLOT(onRightClicked()));
+ connect(ui->pbLeft, SIGNAL(clicked(bool)), this, SLOT(onLeftClicked()));
setUiPrimary();
}
@@ -143,16 +136,10 @@ TaskSectionView::TaskSectionView(TechDraw::DrawViewSection* section) :
ui->setupUi(this);
- connect(ui->pbUp, SIGNAL(clicked(bool)),
- this, SLOT(onUpClicked(bool)));
- connect(ui->pbDown, SIGNAL(clicked(bool)),
- this, SLOT(onDownClicked(bool)));
- connect(ui->pbRight, SIGNAL(clicked(bool)),
- this, SLOT(onRightClicked(bool)));
- connect(ui->pbLeft, SIGNAL(clicked(bool)),
- this, SLOT(onLeftClicked(bool)));
- connect(ui->pbApply, SIGNAL(clicked(bool)),
- this, SLOT(onApplyClicked(bool)));
+ connect(ui->pbUp, SIGNAL(clicked(bool)), this, SLOT(onUpClicked()));
+ connect(ui->pbDown, SIGNAL(clicked(bool)), this, SLOT(onDownClicked()));
+ connect(ui->pbRight, SIGNAL(clicked(bool)), this, SLOT(onRightClicked()));
+ connect(ui->pbLeft, SIGNAL(clicked(bool)), this, SLOT(onLeftClicked()));
m_dirName = m_section->SectionDirection.getValueAsString();
saveSectionState();
@@ -167,7 +154,7 @@ TaskSectionView::~TaskSectionView()
void TaskSectionView::setUiPrimary()
{
// Base::Console().Message("TSV::setUiPrimary()\n");
- setWindowTitle(QObject::tr("Create SectionView"));
+ setWindowTitle(QObject::tr("Create Section View"));
std::string temp = m_base->getNameInDocument();
QString qTemp = Base::Tools::fromStdString(temp);
ui->leBaseView->setText(qTemp);
@@ -177,29 +164,54 @@ void TaskSectionView::setUiPrimary()
ui->sbScale->setValue(m_base->getScale());
Base::Vector3d origin = m_base->getOriginalCentroid();
+ ui->sbOrgX->setUnit(Base::Unit::Length);
ui->sbOrgX->setValue(origin.x);
+ ui->sbOrgY->setUnit(Base::Unit::Length);
ui->sbOrgY->setValue(origin.y);
+ ui->sbOrgZ->setUnit(Base::Unit::Length);
ui->sbOrgZ->setValue(origin.z);
+
+ // before the user did not select an orientation,
+ // the section properties cannot be changed
+ this->setToolTip(QObject::tr("Select at first an orientation"));
+ enableAll(false);
+
+ // now connect and not earlier to avoid premature apply() calls
+ connect(ui->leSymbol, SIGNAL(textChanged(QString)), this, SLOT(onIdentifierChanged()));
+ connect(ui->sbScale, SIGNAL(valueChanged(double)), this, SLOT(onScaleChanged()));
+ connect(ui->sbOrgX, SIGNAL(valueChanged(double)), this, SLOT(onXChanged()));
+ connect(ui->sbOrgY, SIGNAL(valueChanged(double)), this, SLOT(onYChanged()));
+ connect(ui->sbOrgZ, SIGNAL(valueChanged(double)), this, SLOT(onZChanged()));
}
void TaskSectionView::setUiEdit()
{
// Base::Console().Message("TSV::setUiEdit()\n");
- setWindowTitle(QObject::tr("Edit SectionView"));
+ setWindowTitle(QObject::tr("Edit Section View"));
std::string temp = m_base->getNameInDocument();
QString qTemp = Base::Tools::fromStdString(temp);
ui->leBaseView->setText(qTemp);
temp = m_section->SectionSymbol.getValue();
- qTemp = Base::Tools::fromStdString(temp);
+ qTemp = Base::Tools::fromStdString(temp);
ui->leSymbol->setText(qTemp);
ui->sbScale->setValue(m_section->getScale());
Base::Vector3d origin = m_section->SectionOrigin.getValue();
+ ui->sbOrgX->setUnit(Base::Unit::Length);
ui->sbOrgX->setValue(origin.x);
+ ui->sbOrgY->setUnit(Base::Unit::Length);
ui->sbOrgY->setValue(origin.y);
+ ui->sbOrgZ->setUnit(Base::Unit::Length);
ui->sbOrgZ->setValue(origin.z);
+
+ // connect affter initializing the object values
+ connect(ui->leSymbol, SIGNAL(textChanged(QString)), this, SLOT(onIdentifierChanged()));
+ connect(ui->sbScale, SIGNAL(valueChanged(double)), this, SLOT(onScaleChanged()));
+ connect(ui->sbOrgX, SIGNAL(valueChanged(double)), this, SLOT(onXChanged()));
+ connect(ui->sbOrgY, SIGNAL(valueChanged(double)), this, SLOT(onYChanged()));
+ connect(ui->sbOrgZ, SIGNAL(valueChanged(double)), this, SLOT(onZChanged()));
}
//save the start conditions
@@ -231,51 +243,64 @@ void TaskSectionView::restoreSectionState()
}
}
-void TaskSectionView::blockButtons(bool b)
-{
- Q_UNUSED(b);
-}
-
-void TaskSectionView::onUpClicked(bool b)
+void TaskSectionView::onUpClicked()
{
// Base::Console().Message("TSV::onUpClicked()\n");
- Q_UNUSED(b);
checkAll(false);
ui->pbUp->setChecked(true);
applyQuick("Up");
}
-void TaskSectionView::onDownClicked(bool b)
+void TaskSectionView::onDownClicked()
{
// Base::Console().Message("TSV::onDownClicked()\n");
- Q_UNUSED(b);
checkAll(false);
ui->pbDown->setChecked(true);
applyQuick("Down");
}
-void TaskSectionView::onLeftClicked(bool b)
+void TaskSectionView::onLeftClicked()
{
// Base::Console().Message("TSV::onLeftClicked()\n");
checkAll(false);
ui->pbLeft->setChecked(true);
- Q_UNUSED(b);
applyQuick("Left");
}
-void TaskSectionView::onRightClicked(bool b)
+void TaskSectionView::onRightClicked()
{
// Base::Console().Message("TSV::onRightClicked()\n");
- Q_UNUSED(b);
checkAll(false);
ui->pbRight->setChecked(true);
applyQuick("Right");
}
-void TaskSectionView::onApplyClicked(bool b)
+void TaskSectionView::onIdentifierChanged()
+{
+ checkAll(false);
+ apply();
+}
+
+void TaskSectionView::onScaleChanged()
+{
+ checkAll(false);
+ apply();
+}
+
+void TaskSectionView::onXChanged()
+{
+ checkAll(false);
+ apply();
+}
+
+void TaskSectionView::onYChanged()
+{
+ checkAll(false);
+ apply();
+}
+
+void TaskSectionView::onZChanged()
{
-// Base::Console().Message("TSV::onApplyClicked()\n");
- Q_UNUSED(b);
checkAll(false);
apply();
}
@@ -288,13 +313,22 @@ void TaskSectionView::checkAll(bool b)
ui->pbLeft->setChecked(b);
}
+void TaskSectionView::enableAll(bool b)
+{
+ ui->leSymbol->setEnabled(b);
+ ui->sbScale->setEnabled(b);
+ ui->sbOrgX->setEnabled(b);
+ ui->sbOrgY->setEnabled(b);
+ ui->sbOrgZ->setEnabled(b);
+}
+
//******************************************************************************
bool TaskSectionView::apply(void)
{
// Base::Console().Message("TSV::apply() - m_dirName: %s\n", m_dirName.c_str());
if (m_dirName.empty()) {
std::string msg =
- Base::Tools::toStdString(tr("TSV::apply - Nothing to apply. No section direction picked yet"));
+ Base::Tools::toStdString(tr("Nothing to apply. No section direction picked yet"));
Base::Console().Error((msg + "\n").c_str());
return false;
}
@@ -318,6 +352,11 @@ void TaskSectionView::applyQuick(std::string dir)
if (isSectionValid()) {
updateSectionView();
m_section->recomputeFeature();
+ this->setToolTip(QObject::tr("Select at first an orientation"));
+ // we can in any case enable all objects in the dialog
+ // and remove the dialog-wide tooltip if there was one
+ enableAll(true);
+ this->setToolTip(QString());
} else {
failNoObject(m_sectionName);
}
@@ -420,7 +459,7 @@ void TaskSectionView::updateSectionView(void)
lblText.c_str());
Command::doCommand(Command::Doc,"App.activeDocument().%s.Scale = %0.6f",
m_sectionName.c_str(),
- ui->sbScale->value());
+ ui->sbScale->value().getValue());
m_section->setCSFromBase(m_dirName.c_str());
}
}
diff --git a/src/Mod/TechDraw/Gui/TaskSectionView.h b/src/Mod/TechDraw/Gui/TaskSectionView.h
index acd2f74d30..955df54a1d 100644
--- a/src/Mod/TechDraw/Gui/TaskSectionView.h
+++ b/src/Mod/TechDraw/Gui/TaskSectionView.h
@@ -51,15 +51,17 @@ public:
virtual bool reject();
protected Q_SLOTS:
- void onUpClicked(bool b);
- void onDownClicked(bool b);
- void onLeftClicked(bool b);
- void onRightClicked(bool b);
- void onApplyClicked(bool b);
+ void onUpClicked();
+ void onDownClicked();
+ void onLeftClicked();
+ void onRightClicked();
+ void onIdentifierChanged();
+ void onScaleChanged();
+ void onXChanged();
+ void onYChanged();
+ void onZChanged();
protected:
- void blockButtons(bool b);
-
void changeEvent(QEvent *e);
void saveSectionState();
void restoreSectionState();
@@ -75,6 +77,7 @@ protected:
void setUiEdit();
void checkAll(bool b);
+ void enableAll(bool b);
void failNoObject(std::string objName);
bool isBaseValid(void);
diff --git a/src/Mod/TechDraw/Gui/TaskSectionView.ui b/src/Mod/TechDraw/Gui/TaskSectionView.ui
index 95cf59f30e..158dd94da4 100644
--- a/src/Mod/TechDraw/Gui/TaskSectionView.ui
+++ b/src/Mod/TechDraw/Gui/TaskSectionView.ui
@@ -1,468 +1,433 @@
-
-
- TechDrawGui::TaskSectionView
-
-
-
- 0
- 0
- 368
- 450
-
-
-
-
- 0
- 0
-
-
-
-
- 250
- 450
-
-
-
- Section Parameters
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 350
- 400
-
-
-
- QFrame::StyledPanel
-
-
- QFrame::Raised
-
-
-
-
-
-
- QFormLayout::AllNonFixedFieldsGrow
-
-
-
-
-
- BaseView
-
-
-
- -
-
-
- false
-
-
-
- -
-
-
- Identifier
-
-
-
- -
-
-
-
- 0
- 32
-
-
-
- Identifier for this section
-
-
-
- -
-
-
-
- 0
- 32
-
-
-
-
- 0
- 0
-
-
-
- 4
-
-
- 0.000000000000000
-
-
- 999.000000000000000
-
-
- 1.000000000000000
-
-
-
- -
-
-
- Scale
-
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- -
-
-
- Section Orientation
-
-
-
- -
-
-
-
-
-
- Looking right
-
-
-
-
-
-
- :/icons/actions/section-right.svg
-
-
-
-
- 48
- 48
-
-
-
- true
-
-
-
- -
-
-
- Looking up
-
-
-
-
-
-
-
-
-
-
-
-
- :/icons/actions/section-up.svg
-
-
-
-
- 48
- 48
-
-
-
- true
-
-
-
- -
-
-
- Looking left
-
-
-
-
-
-
- :/icons/actions/section-left.svg
-
-
-
-
- 48
- 48
-
-
-
- true
-
-
-
- -
-
-
- Looking down
-
-
-
-
-
-
- :/icons/actions/section-down.svg
-
-
-
-
- 48
- 48
-
-
-
- true
-
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- -
-
-
- Section Plane Location
-
-
- Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
-
-
-
- -
-
-
- QFormLayout::AllNonFixedFieldsGrow
-
-
-
-
-
-
- 0
- 0
-
-
-
-
- 150
- 0
-
-
-
- X
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 150
- 32
-
-
-
- <html><head/><body><p>Location of section plane in 3D coordinates</p></body></html>
-
-
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 150
- 0
-
-
-
- Y
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 150
- 32
-
-
-
- <html><head/><body><p>Location of section plane in 3D coordinates</p></body></html>
-
-
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 150
- 0
-
-
-
- Z
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 150
- 32
-
-
-
- <html><head/><body><p>Location of section plane in 3D coordinates</p></body></html>
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
- Apply
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
-
-
- -
-
-
- Qt::Vertical
-
-
-
- 20
- 40
-
-
-
-
-
-
-
-
-
-
-
- Gui::QuantitySpinBox
- QWidget
-
-
-
-
-
-
-
-
+
+
+ TechDrawGui::TaskSectionView
+
+
+
+ 0
+ 0
+ 370
+ 326
+
+
+
+
+ 0
+ 0
+
+
+
+ Section Parameters
+
+
+ -
+
+
-
+
+
+ BaseView
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+ false
+
+
+
+ 0
+ 22
+
+
+
+
+ -
+
+
+ Identifier
+
+
+
+ -
+
+
+
+ 0
+ 22
+
+
+
+ Identifier for this section
+
+
+
+ -
+
+
+ Scale
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 0
+ 22
+
+
+
+
+ 0
+ 0
+
+
+
+ Scale factor for the section view
+
+
+ 0.000000000000000
+
+
+ 999.000000000000000
+
+
+ 1.000000000000000
+
+
+ 4
+
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ -
+
+
+ Section Orientation
+
+
+
-
+
+
-
+
+
+
+ 50
+ 50
+
+
+
+ Looking up
+
+
+
+
+
+
+
+
+
+
+
+
+ :/icons/actions/section-up.svg
+
+
+
+
+ 48
+ 48
+
+
+
+ true
+
+
+
+ -
+
+
+
+ 50
+ 50
+
+
+
+ Looking down
+
+
+
+
+
+
+ :/icons/actions/section-down.svg
+
+
+
+
+ 48
+ 48
+
+
+
+ true
+
+
+
+ -
+
+
+
+ 50
+ 50
+
+
+
+ Looking left
+
+
+
+
+
+
+ :/icons/actions/section-left.svg
+
+
+
+
+ 48
+ 48
+
+
+
+ true
+
+
+
+ -
+
+
+
+ 50
+ 50
+
+
+
+ Looking right
+
+
+
+
+
+
+ :/icons/actions/section-right.svg
+
+
+
+
+ 48
+ 48
+
+
+
+ true
+
+
+
+
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ -
+
+
+ Position from the 3D origin of the object in the view
+
+
+ Section Plane Location
+
+
+
-
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+
+ 0
+ 0
+
+
+
+ X
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 150
+ 22
+
+
+
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 0
+ 0
+
+
+
+ Y
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 150
+ 22
+
+
+
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 0
+ 0
+
+
+
+ Z
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 150
+ 22
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Gui::QuantitySpinBox
+ QWidget
+
+
+
+
+
+
+
+
diff --git a/src/Mod/TechDraw/Gui/TaskWeldingSymbol.cpp b/src/Mod/TechDraw/Gui/TaskWeldingSymbol.cpp
index 2f53579f5b..215e2706bb 100644
--- a/src/Mod/TechDraw/Gui/TaskWeldingSymbol.cpp
+++ b/src/Mod/TechDraw/Gui/TaskWeldingSymbol.cpp
@@ -83,44 +83,29 @@ TaskWeldingSymbol::TaskWeldingSymbol(TechDraw::DrawLeaderLine* leader) :
m_leadFeat(leader),
m_weldFeat(nullptr),
m_createMode(true),
- m_arrowDirty(false),
m_otherDirty(false)
{
//TODO: why does DWS need DLL as parent?
// Base::Console().Message("TWS::TWS() - create mode\n");
if (m_leadFeat == nullptr) {
//should be caught in CMD caller
- Base::Console().Error("TaskWeldingSymbol - bad parameters. Can not proceed.\n");
+ Base::Console().Error("TaskWeldingSymbol - bad parameters. Can not proceed.\n");
return;
}
ui->setupUi(this);
- connect(ui->pbArrowSymbol, SIGNAL(clicked(bool)),
- this, SLOT(onArrowSymbolClicked(bool)));
- connect(ui->pbOtherSymbol, SIGNAL(clicked(bool)),
- this, SLOT(onOtherSymbolClicked(bool)));
- connect(ui->pbOtherErase, SIGNAL(clicked(bool)),
- this, SLOT(onOtherEraseClicked(bool)));
+ setUiPrimary();
+ connect(ui->pbArrowSymbol, SIGNAL(clicked(bool)),
+ this, SLOT(onArrowSymbolCreateClicked()));
+ connect(ui->pbOtherSymbol, SIGNAL(clicked(bool)),
+ this, SLOT(onOtherSymbolCreateClicked()));
+ connect(ui->pbOtherErase, SIGNAL(clicked(bool)),
+ this, SLOT(onOtherEraseCreateClicked()));
+ connect(ui->pbFlipSides, SIGNAL(clicked(bool)),
+ this, SLOT(onFlipSidesCreateClicked()));
connect(ui->fcSymbolDir, SIGNAL(fileNameSelected(const QString&)),
this, SLOT(onDirectorySelected(const QString&)));
-
- connect(ui->leArrowTextL, SIGNAL(textEdited(const QString&)),
- this, SLOT(onArrowTextChanged(const QString&)));
- connect(ui->leArrowTextR, SIGNAL(textEdited(const QString&)),
- this, SLOT(onArrowTextChanged(const QString&)));
- connect(ui->leArrowTextC, SIGNAL(textEdited(const QString&)),
- this, SLOT(onArrowTextChanged(const QString&)));
-
- connect(ui->leOtherTextL, SIGNAL(textEdited(const QString&)),
- this, SLOT(onOtherTextChanged(const QString&)));
- connect(ui->leOtherTextR, SIGNAL(textEdited(const QString&)),
- this, SLOT(onOtherTextChanged(const QString&)));
- connect(ui->leOtherTextC, SIGNAL(textEdited(const QString&)),
- this, SLOT(onOtherTextChanged(const QString&)));
-
-
- setUiPrimary();
}
//ctor for edit
@@ -129,7 +114,6 @@ TaskWeldingSymbol::TaskWeldingSymbol(TechDraw::DrawWeldSymbol* weld) :
m_leadFeat(nullptr),
m_weldFeat(weld),
m_createMode(false),
- m_arrowDirty(false),
m_otherDirty(false)
{
// Base::Console().Message("TWS::TWS() - edit mode\n");
@@ -150,33 +134,42 @@ TaskWeldingSymbol::TaskWeldingSymbol(TechDraw::DrawWeldSymbol* weld) :
ui->setupUi(this);
- connect(ui->pbArrowSymbol, SIGNAL(clicked(bool)),
- this, SLOT(onArrowSymbolClicked(bool)));
+ setUiEdit();
+ connect(ui->pbArrowSymbol, SIGNAL(clicked(bool)),
+ this, SLOT(onArrowSymbolClicked()));
connect(ui->pbOtherSymbol, SIGNAL(clicked(bool)),
- this, SLOT(onOtherSymbolClicked(bool)));
+ this, SLOT(onOtherSymbolClicked()));
connect(ui->pbOtherErase, SIGNAL(clicked(bool)),
- this, SLOT(onOtherEraseClicked(bool)));
+ this, SLOT(onOtherEraseClicked()));
+ connect(ui->pbFlipSides, SIGNAL(clicked(bool)),
+ this, SLOT(onFlipSidesClicked()));
connect(ui->fcSymbolDir, SIGNAL(fileNameSelected(const QString&)),
- this, SLOT(onDirectorySelected(const QString&)));
+ this, SLOT(onDirectorySelected(const QString&)));
- connect(ui->leArrowTextL, SIGNAL(textEdited(const QString&)),
- this, SLOT(onArrowTextChanged(const QString&)));
- connect(ui->leArrowTextR, SIGNAL(textEdited(const QString&)),
- this, SLOT(onArrowTextChanged(const QString&)));
- connect(ui->leArrowTextC, SIGNAL(textEdited(const QString&)),
- this, SLOT(onArrowTextChanged(const QString&)));
+ connect(ui->leArrowTextL, SIGNAL(textEdited(QString)),
+ this, SLOT(onArrowTextChanged()));
+ connect(ui->leArrowTextR, SIGNAL(textEdited(QString)),
+ this, SLOT(onArrowTextChanged()));
+ connect(ui->leArrowTextC, SIGNAL(textEdited(QString)),
+ this, SLOT(onArrowTextChanged()));
- connect(ui->leOtherTextL, SIGNAL(textEdited(const QString&)),
- this, SLOT(onOtherTextChanged(const QString&)));
- connect(ui->leOtherTextR, SIGNAL(textEdited(const QString&)),
- this, SLOT(onOtherTextChanged(const QString&)));
- connect(ui->leOtherTextC, SIGNAL(textEdited(const QString&)),
- this, SLOT(onOtherTextChanged(const QString&)));
+ connect(ui->leOtherTextL, SIGNAL(textEdited(QString)),
+ this, SLOT(onOtherTextChanged()));
+ connect(ui->leOtherTextR, SIGNAL(textEdited(QString)),
+ this, SLOT(onOtherTextChanged()));
+ connect(ui->leOtherTextC, SIGNAL(textEdited(QString)),
+ this, SLOT(onOtherTextChanged()));
- saveState();
- setUiEdit();
+ connect(ui->leTailText, SIGNAL(textEdited(QString)),
+ this, SLOT(onWeldingChanged()));
+ connect(ui->cbFieldWeld, SIGNAL(toggled(bool)),
+ this, SLOT(onWeldingChanged()));
+ connect(ui->cbAllAround, SIGNAL(toggled(bool)),
+ this, SLOT(onWeldingChanged()));
+ connect(ui->cbAltWeld, SIGNAL(toggled(bool)),
+ this, SLOT(onWeldingChanged()));
}
TaskWeldingSymbol::~TaskWeldingSymbol()
@@ -212,6 +205,9 @@ void TaskWeldingSymbol::setUiPrimary()
m_otherOut.init();
m_otherPath = QString();
m_otherSymbol = QString();
+
+ // we must mark the other side dirty to assure it gets created
+ m_otherDirty = true;
}
void TaskWeldingSymbol::setUiEdit()
@@ -241,12 +237,12 @@ void TaskWeldingSymbol::setUiEdit()
if (fi.isReadable()) {
qTemp = QString::fromUtf8(m_arrowFeat->SymbolFile.getValue());
QIcon targetIcon(qTemp);
- QSize iconSize(32,32);
+ QSize iconSize(32, 32);
ui->pbArrowSymbol->setIcon(targetIcon);
ui->pbArrowSymbol->setIconSize(iconSize);
ui->pbArrowSymbol->setText(QString());
} else {
- ui->pbArrowSymbol->setText(QString::fromUtf8("Symbol"));
+ ui->pbArrowSymbol->setText(tr("Symbol"));
}
}
@@ -263,78 +259,156 @@ void TaskWeldingSymbol::setUiEdit()
if (fi.isReadable()) {
qTemp = QString::fromUtf8(m_otherFeat->SymbolFile.getValue());
QIcon targetIcon(qTemp);
- QSize iconSize(32,32);
+ QSize iconSize(32, 32);
ui->pbOtherSymbol->setIcon(targetIcon);
ui->pbOtherSymbol->setIconSize(iconSize);
ui->pbOtherSymbol->setText(QString());
} else {
- ui->pbOtherSymbol->setText(QString::fromUtf8("Symbol"));
+ ui->pbOtherSymbol->setText(tr("Symbol"));
}
}
ui->pbArrowSymbol->setFocus();
}
-void TaskWeldingSymbol::onArrowSymbolClicked(bool b)
+void TaskWeldingSymbol::onArrowSymbolCreateClicked()
{
-// Base::Console().Message("TWS::OnArrowSymbolClicked()\n");
- Q_UNUSED(b);
+ QString source = tr("arrow");
+ SymbolChooser* dlg = new SymbolChooser(this, m_currDir, source);
+ connect(dlg, SIGNAL(symbolSelected(QString, QString)),
+ this, SLOT(onSymbolSelected(QString, QString)));
+ dlg->setAttribute(Qt::WA_DeleteOnClose);
+ dlg->exec();
+}
- QString source = QString::fromUtf8("arrow");
+void TaskWeldingSymbol::onArrowSymbolClicked()
+{
+ QString source = tr("arrow");
SymbolChooser* dlg = new SymbolChooser(this, m_currDir, source);
connect(dlg, SIGNAL(symbolSelected(QString, QString)),
this, SLOT(onSymbolSelected(QString, QString)));
dlg->setAttribute(Qt::WA_DeleteOnClose);
- //int rc =
+ dlg->exec();
+ updateTiles();
+ m_weldFeat->requestPaint();
+}
+
+void TaskWeldingSymbol::onOtherSymbolCreateClicked()
+{
+ QString source = tr("other");
+ SymbolChooser* dlg = new SymbolChooser(this, m_currDir, source);
+ connect(dlg, SIGNAL(symbolSelected(QString, QString)),
+ this, SLOT(onSymbolSelected(QString, QString)));
+ dlg->setAttribute(Qt::WA_DeleteOnClose);
dlg->exec();
}
-void TaskWeldingSymbol::onOtherSymbolClicked(bool b)
+void TaskWeldingSymbol::onOtherSymbolClicked()
{
-// Base::Console().Message("TWS::OnOtherSymbolClicked()\n");
- Q_UNUSED(b);
-
- QString source = QString::fromUtf8("other");
+ QString source = tr("other");
SymbolChooser* dlg = new SymbolChooser(this, m_currDir, source);
connect(dlg, SIGNAL(symbolSelected(QString, QString)),
this, SLOT(onSymbolSelected(QString, QString)));
dlg->setAttribute(Qt::WA_DeleteOnClose);
-
-// int rc =
dlg->exec();
+ updateTiles();
+ m_weldFeat->requestPaint();
}
-void TaskWeldingSymbol::onOtherEraseClicked(bool b)
+void TaskWeldingSymbol::onOtherEraseCreateClicked()
{
-// Base::Console().Message("TWS::onOtherEraseClicked()\n");
- Q_UNUSED(b);
- m_otherDirty = true;
- m_otherOut.init();
-
ui->leOtherTextL->setText(QString());
ui->leOtherTextC->setText(QString());
ui->leOtherTextR->setText(QString());
ui->pbOtherSymbol->setIcon(QIcon());
- ui->pbOtherSymbol->setText(QString::fromUtf8("Symbol"));
+ ui->pbOtherSymbol->setText(tr("Symbol"));
m_otherOut.init();
m_otherPath = QString();
}
-void TaskWeldingSymbol::onArrowTextChanged(const QString& qs)
+void TaskWeldingSymbol::onOtherEraseClicked()
{
-// Base::Console().Message("TWS::onArrowTextChanged(%s)\n", qPrintable(qs));
- Q_UNUSED(qs);
- m_arrowDirty = true;
-}
-
-void TaskWeldingSymbol::onOtherTextChanged(const QString& qs)
-{
-// Base::Console().Message("TWS::onOtherTextChanged(%s)\n", qPrintable(qs));
- Q_UNUSED(qs);
m_otherDirty = true;
+ ui->leOtherTextL->setText(QString());
+ ui->leOtherTextC->setText(QString());
+ ui->leOtherTextR->setText(QString());
+ ui->pbOtherSymbol->setIcon(QIcon());
+ ui->pbOtherSymbol->setText(tr("Symbol"));
+ m_otherOut.init();
+ m_otherPath = QString();
+ updateTiles();
+ m_weldFeat->requestPaint();
}
+void TaskWeldingSymbol::onFlipSidesCreateClicked()
+{
+ QString tempText = ui->leOtherTextL->text();
+ ui->leOtherTextL->setText(ui->leArrowTextL->text());
+ ui->leArrowTextL->setText(tempText);
+ tempText = ui->leOtherTextC->text();
+ ui->leOtherTextC->setText(ui->leArrowTextC->text());
+ ui->leArrowTextC->setText(tempText);
+ tempText = ui->leOtherTextR->text();
+ ui->leOtherTextR->setText(ui->leArrowTextR->text());
+ ui->leArrowTextR->setText(tempText);
+
+ QString tempPathArrow = m_otherPath;
+ m_otherPath = m_arrowPath;
+ m_arrowPath = tempPathArrow;
+ tempText = ui->pbOtherSymbol->text();
+ ui->pbOtherSymbol->setText(ui->pbArrowSymbol->text());
+ ui->pbArrowSymbol->setText(tempText);
+ QIcon tempIcon = ui->pbOtherSymbol->icon();
+ ui->pbOtherSymbol->setIcon(ui->pbArrowSymbol->icon());
+ ui->pbArrowSymbol->setIcon(tempIcon);
+}
+
+void TaskWeldingSymbol::onFlipSidesClicked()
+{
+ QString tempText = ui->leOtherTextL->text();
+ ui->leOtherTextL->setText(ui->leArrowTextL->text());
+ ui->leArrowTextL->setText(tempText);
+ tempText = ui->leOtherTextC->text();
+ ui->leOtherTextC->setText(ui->leArrowTextC->text());
+ ui->leArrowTextC->setText(tempText);
+ tempText = ui->leOtherTextR->text();
+ ui->leOtherTextR->setText(ui->leArrowTextR->text());
+ ui->leArrowTextR->setText(tempText);
+
+ // one cannot get the path from the icon therfore read out
+ // the path property
+ auto tempPathArrow = m_arrowFeat->SymbolFile.getValue();
+ auto tempPathOther = m_otherFeat->SymbolFile.getValue();
+ m_otherPath = QString::fromLatin1(tempPathArrow);
+ m_arrowPath = QString::fromLatin1(tempPathOther);
+ QIcon tempIcon = ui->pbOtherSymbol->icon();
+ ui->pbOtherSymbol->setIcon(ui->pbArrowSymbol->icon());
+ ui->pbArrowSymbol->setIcon(tempIcon);
+
+ m_otherDirty = true;
+ updateTiles();
+ m_weldFeat->requestPaint();
+}
+
+void TaskWeldingSymbol::onArrowTextChanged()
+{
+ updateTiles();
+ m_weldFeat->requestPaint();
+}
+
+void TaskWeldingSymbol::onOtherTextChanged()
+{
+ m_otherDirty = true;
+ updateTiles();
+ m_weldFeat->requestPaint();
+}
+
+void TaskWeldingSymbol::onWeldingChanged()
+{
+ updateWeldingSymbol();
+ m_weldFeat->requestPaint();
+}
void TaskWeldingSymbol::onDirectorySelected(const QString& newDir)
{
@@ -349,10 +423,9 @@ void TaskWeldingSymbol::onSymbolSelected(QString symbolPath,
// qPrintable(symbolPath), qPrintable(source));
QIcon targetIcon(symbolPath);
QSize iconSize(32,32);
- QString arrow = QString::fromUtf8("arrow");
- QString other = QString::fromUtf8("other");
+ QString arrow = tr("arrow");
+ QString other = tr("other");
if (source == arrow) {
- m_arrowDirty = true;
ui->pbArrowSymbol->setIcon(targetIcon);
ui->pbArrowSymbol->setIconSize(iconSize);
ui->pbArrowSymbol->setText(QString());
@@ -366,16 +439,6 @@ void TaskWeldingSymbol::onSymbolSelected(QString symbolPath,
}
}
-void TaskWeldingSymbol::blockButtons(bool b)
-{
- Q_UNUSED(b);
-}
-
-//obsolete. tiles are only updated on accept.
-void TaskWeldingSymbol::saveState(void)
-{
-}
-
void TaskWeldingSymbol::collectArrowData(void)
{
// Base::Console().Message("TWS::collectArrowData()\n");
@@ -383,10 +446,10 @@ void TaskWeldingSymbol::collectArrowData(void)
m_arrowOut.arrowSide = false;
m_arrowOut.row = 0;
m_arrowOut.col = 0;
- m_arrowOut.leftText = Base::Tools::toStdString(ui->leArrowTextL->text());
- m_arrowOut.centerText = Base::Tools::toStdString(ui->leArrowTextC->text());
- m_arrowOut.rightText = Base::Tools::toStdString(ui->leArrowTextR->text());
- m_arrowOut.symbolPath= Base::Tools::toStdString(m_arrowPath);
+ m_arrowOut.leftText = ui->leArrowTextL->text().toStdString();
+ m_arrowOut.centerText = ui->leArrowTextC->text().toStdString();
+ m_arrowOut.rightText = ui->leArrowTextR->text().toStdString();
+ m_arrowOut.symbolPath= m_arrowPath.toStdString();
m_arrowOut.tileName = "";
}
@@ -397,10 +460,10 @@ void TaskWeldingSymbol::collectOtherData(void)
m_otherOut.arrowSide = false;
m_otherOut.row = -1;
m_otherOut.col = 0;
- m_otherOut.leftText = Base::Tools::toStdString(ui->leOtherTextL->text());
- m_otherOut.centerText = Base::Tools::toStdString(ui->leOtherTextC->text());
- m_otherOut.rightText = Base::Tools::toStdString(ui->leOtherTextR->text());
- m_otherOut.symbolPath = Base::Tools::toStdString(m_otherPath);
+ m_otherOut.leftText = ui->leOtherTextL->text().toStdString();
+ m_otherOut.centerText = ui->leOtherTextC->text().toStdString();
+ m_otherOut.rightText = ui->leOtherTextR->text().toStdString();
+ m_otherOut.symbolPath = m_otherPath.toStdString();
m_otherOut.tileName = "";
}
@@ -462,7 +525,7 @@ TechDraw::DrawWeldSymbol* TaskWeldingSymbol::createWeldingSymbol(void)
Command::doCommand(Command::Doc,"App.activeDocument().%s.AlternatingWeld = %s",
symbolName.c_str(), altWeldText.c_str());
- std::string tailText = Base::Tools::toStdString(ui->leTailText->text());
+ std::string tailText = ui->leTailText->text().toStdString();
tailText = Base::Tools::escapeEncodeString(tailText);
Command::doCommand(Command::Doc,"App.activeDocument().%s.TailText = '%s'",
symbolName.c_str(), tailText.c_str());
@@ -497,7 +560,7 @@ void TaskWeldingSymbol::updateWeldingSymbol(void)
Command::doCommand(Command::Doc,"App.activeDocument().%s.AlternatingWeld = %s",
symbolName.c_str(), altWeldText.c_str());
- std::string tailText = Base::Tools::toStdString(ui->leTailText->text());
+ std::string tailText = ui->leTailText->text().toStdString();
tailText = Base::Tools::escapeEncodeString(tailText);
Command::doCommand(Command::Doc,"App.activeDocument().%s.TailText = '%s'",
symbolName.c_str(), tailText.c_str());
diff --git a/src/Mod/TechDraw/Gui/TaskWeldingSymbol.h b/src/Mod/TechDraw/Gui/TaskWeldingSymbol.h
index f3acf1007e..6702f82bd4 100644
--- a/src/Mod/TechDraw/Gui/TaskWeldingSymbol.h
+++ b/src/Mod/TechDraw/Gui/TaskWeldingSymbol.h
@@ -102,14 +102,17 @@ public:
~TaskWeldingSymbol();
public Q_SLOTS:
- void onArrowSymbolClicked(bool b);
-
- void onOtherSymbolClicked(bool b);
- void onOtherEraseClicked(bool b);
-
- void onArrowTextChanged(const QString& qs);
- void onOtherTextChanged(const QString& qs);
-
+ void onArrowSymbolCreateClicked();
+ void onArrowSymbolClicked();
+ void onOtherSymbolCreateClicked();
+ void onOtherSymbolClicked();
+ void onOtherEraseCreateClicked();
+ void onOtherEraseClicked();
+ void onFlipSidesCreateClicked();
+ void onFlipSidesClicked();
+ void onArrowTextChanged();
+ void onOtherTextChanged();
+ void onWeldingChanged();
void onDirectorySelected(const QString& newDir);
void onSymbolSelected(QString symbolPath, QString source);
@@ -125,8 +128,6 @@ protected Q_SLOTS:
protected:
void changeEvent(QEvent *e);
-
- void blockButtons(bool b);
void setUiPrimary(void);
void setUiEdit();
@@ -141,7 +142,6 @@ protected:
void collectOtherData(void);
std::string prefSymbolDir();
- void saveState(void);
QString m_currDir;
@@ -163,14 +163,10 @@ private:
QString m_arrowSymbol;
QString m_otherSymbol;
-/* std::vector m_toRemove;*/
-
QPushButton* m_btnOK;
QPushButton* m_btnCancel;
bool m_createMode;
-
- bool m_arrowDirty;
bool m_otherDirty;
};
diff --git a/src/Mod/TechDraw/Gui/TaskWeldingSymbol.ui b/src/Mod/TechDraw/Gui/TaskWeldingSymbol.ui
index 22e2949735..504f12f6b9 100644
--- a/src/Mod/TechDraw/Gui/TaskWeldingSymbol.ui
+++ b/src/Mod/TechDraw/Gui/TaskWeldingSymbol.ui
@@ -6,12 +6,12 @@
0
0
- 423
- 374
+ 400
+ 244
-
+
0
0
@@ -29,268 +29,282 @@
:/icons/actions/techdraw-weldsymbol.svg:/icons/actions/techdraw-weldsymbol.svg
-
+
-
-
-
-
- 0
- 0
-
+
+
-
+
+
-
+
+
-
+
+
+ Text before arrow side symbol
+
+
+
+ -
+
+
+ Text after arrow side symbol
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 0
+ 0
+
+
+
+
+ 0
+ 32
+
+
+
+ Pick arrow side symbol
+
+
+
+
+
+ Symbol
+
+
+ false
+
+
+
+ -
+
+
+ Text above arrow side symbol
+
+
+
+
+
+
+
+ -
+
+
+ QFrame::Plain
+
+
+ 5
+
+
+ Qt::Horizontal
+
+
+
+ -
+
+
-
+
+
-
+
+
+ Pick other side symbol
+
+
+ Symbol
+
+
+
+ -
+
+
+ Text below other side symbol
+
+
+
+ -
+
+
+ Text after other side symbol
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 60
+ 30
+
+
+
+
+ 60
+ 30
+
+
+
+
+ 60
+ 30
+
+
+
+ Flips the sides
+
+
+ Flip Sides
+
+
+
+ -
+
+
+ Text before other side symbol
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 60
+ 30
+
+
+
+
+ 60
+ 30
+
+
+
+
+ 60
+ 30
+
+
+
+ Remove other side symbol
+
+
+ Delete
+
+
+
+
+
+
+
+
+
+ -
+
+
+ Qt::Horizontal
-
- QFrame::Box
-
-
- QFrame::Raised
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Text before arrow side symbol
-
-
-
- -
-
-
- Text after arrow side symbol
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 0
- 32
-
-
-
-
- 0
- 32
-
-
-
- Pick arrow side symbol
-
-
-
-
-
- Symbol
-
-
- false
-
-
-
- -
-
-
- Text above arrow side symbol
-
-
-
-
-
-
-
- -
-
-
- QFrame::Plain
-
-
- 5
-
-
- Qt::Horizontal
-
-
-
- -
-
-
-
-
-
-
-
-
- Text after other side symbol
-
-
-
- -
-
-
- Pick other side symbol
-
-
- Symbol
-
-
-
- -
-
-
- Text before other side symbol
-
-
-
- -
-
-
- Text below other side symbol
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 60
- 30
-
-
-
-
- 60
- 30
-
-
-
-
- 60
- 30
-
-
-
- Remove other side symbol
-
-
- Delete
-
-
-
-
-
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- -
-
-
-
-
-
-
-
-
- Field Weld
-
-
-
- -
-
-
- All Around
-
-
-
- -
-
-
- Alternating
-
-
-
-
-
- -
-
-
- QFormLayout::AllNonFixedFieldsGrow
-
-
-
-
-
- Tail Text
-
-
-
- -
-
-
- Text at end of symbol
-
-
-
- -
-
-
- Symbol Directory
-
-
-
- -
-
-
- Pick a directory of welding symbols
-
-
- Gui::FileChooser::Directory
-
-
- *.svg
-
-
-
-
-
-
-
- -
-
-
- Qt::Vertical
-
-
-
- 20
- 40
-
-
-
-
-
+ -
+
+
-
+
+
+ Adds the 'Field Weld' symbol (flag)
+at the kink in the leader line
+
+
+ Field Weld
+
+
+
+ -
+
+
+ Adds the 'All Around' symbol (circle)
+at the kink in the leader line
+
+
+ All Around
+
+
+
+ -
+
+
+ Offsets the lower symbol to indicate alternating welds
+
+
+ Alternating
+
+
+
+
+
+ -
+
+
-
+
+
+ Directory to welding symbols.
+This directory will be used for the symbol selection.
+
+
+ Gui::FileChooser::Directory
+
+
+ *.svg
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Text at end of symbol
+
+
+
+ -
+
+
+ Symbol Directory
+
+
+
+ -
+
+
+ Tail Text
+
+
+
+
+