From 2fbd3729b76e200eeb9e4ab5ca171d175991083a Mon Sep 17 00:00:00 2001 From: donovaly Date: Sun, 29 Mar 2020 17:57:45 +0200 Subject: [PATCH 01/14] [TD] Section dialog overhaul - replace use uniformly Gui::QuantitySpinBox - fix and uniform size of all objects in the dialog - apply changes immediately once the section is created because this speeds up the workflow a lot, especially for when changing the plane position - some code cleanup: remove unused void, avoid unused variables --- src/Mod/TechDraw/Gui/TaskSectionView.cpp | 113 ++- src/Mod/TechDraw/Gui/TaskSectionView.h | 17 +- src/Mod/TechDraw/Gui/TaskSectionView.ui | 901 +++++++++++------------ 3 files changed, 516 insertions(+), 515 deletions(-) diff --git a/src/Mod/TechDraw/Gui/TaskSectionView.cpp b/src/Mod/TechDraw/Gui/TaskSectionView.cpp index fcb879ccfd..8e86e9a150 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(); @@ -180,6 +167,18 @@ void TaskSectionView::setUiPrimary() ui->sbOrgX->setValue(origin.x); ui->sbOrgY->setValue(origin.y); 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() @@ -200,6 +199,13 @@ void TaskSectionView::setUiEdit() ui->sbOrgX->setValue(origin.x); ui->sbOrgY->setValue(origin.y); 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 +237,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 +307,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 +346,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 +453,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 -
Gui/QuantitySpinBox.h
-
-
- - - - -
+ + + 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 +
Gui/QuantitySpinBox.h
+
+
+ + + + +
From 286c50e99d1e44e9d422a30f9b911be43e70bead Mon Sep 17 00:00:00 2001 From: donovaly Date: Sun, 29 Mar 2020 18:03:17 +0200 Subject: [PATCH 02/14] TaskSectionView.cpp: fix a typo --- src/Mod/TechDraw/Gui/TaskSectionView.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Mod/TechDraw/Gui/TaskSectionView.cpp b/src/Mod/TechDraw/Gui/TaskSectionView.cpp index 8e86e9a150..a2b32248b0 100644 --- a/src/Mod/TechDraw/Gui/TaskSectionView.cpp +++ b/src/Mod/TechDraw/Gui/TaskSectionView.cpp @@ -154,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); @@ -184,7 +184,7 @@ void TaskSectionView::setUiPrimary() 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); From ccbdf1c11f4559530550d23e2d3a51b2d07872a5 Mon Sep 17 00:00:00 2001 From: donovaly Date: Sun, 29 Mar 2020 18:19:22 +0200 Subject: [PATCH 03/14] TaskSectionView.cpp: add missing unit initialization --- src/Mod/TechDraw/Gui/TaskSectionView.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Mod/TechDraw/Gui/TaskSectionView.cpp b/src/Mod/TechDraw/Gui/TaskSectionView.cpp index a2b32248b0..36e5dc1e93 100644 --- a/src/Mod/TechDraw/Gui/TaskSectionView.cpp +++ b/src/Mod/TechDraw/Gui/TaskSectionView.cpp @@ -164,8 +164,11 @@ 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, @@ -191,13 +194,16 @@ void TaskSectionView::setUiEdit() 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 From 0f477df6ed29485c92c5c8eeb2bb4f4421068598 Mon Sep 17 00:00:00 2001 From: wandererfan Date: Sun, 29 Mar 2020 13:04:47 -0400 Subject: [PATCH 04/14] [TD]prevent loop with AutoScale --- src/Mod/TechDraw/App/DrawView.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) 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); From f520737a289834e519fb76bc75ee15ad6b7be64e Mon Sep 17 00:00:00 2001 From: donovaly Date: Sun, 29 Mar 2020 20:27:40 +0200 Subject: [PATCH 05/14] [TD] sanitize active view dialog - add missing enable slot - fix size policies - add missing unit initialization - add and fix tooltips --- src/Mod/TechDraw/Gui/TaskActiveView.cpp | 6 +- src/Mod/TechDraw/Gui/TaskActiveView.ui | 527 +++++++++++++----------- 2 files changed, 289 insertions(+), 244 deletions(-) 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/QuantitySpinBox.h
-
- - Gui::ColorButton - QPushButton -
Gui/Widgets.h
-
-
- - - - -
+ + + 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/QuantitySpinBox.h
+
+ + Gui::ColorButton + QPushButton +
Gui/Widgets.h
+
+
+ + + + + + cbbg + toggled(bool) + ccBgColor + setEnabled(bool) + + + 49 + 99 + + + 295 + 99 + + + + +
From f516c4af0535052eeaf7d436d35eeaab2102e3d7 Mon Sep 17 00:00:00 2001 From: Bernd Hahnebach Date: Mon, 30 Mar 2020 11:31:15 +0200 Subject: [PATCH 06/14] FEM: z88 mesh exporter, fix file handle type --- src/Mod/Fem/feminout/importZ88Mesh.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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() From adde500f295b8e0d115de3257165bf95f0ec056e Mon Sep 17 00:00:00 2001 From: donovaly Date: Sun, 29 Mar 2020 23:25:28 +0200 Subject: [PATCH 07/14] [TD] overhaul welding UI - make some strings translatable - remove some unused code - fix UI size policies - show changes while editing directly (only repaint necessary) - avoid unused variables - add tooltips --- src/Mod/TechDraw/Gui/SymbolChooser.ui | 117 ++--- src/Mod/TechDraw/Gui/TaskRestoreLines.ui | 2 +- src/Mod/TechDraw/Gui/TaskWeldingSymbol.cpp | 211 ++++----- src/Mod/TechDraw/Gui/TaskWeldingSymbol.h | 24 +- src/Mod/TechDraw/Gui/TaskWeldingSymbol.ui | 502 ++++++++++----------- 5 files changed, 409 insertions(+), 447 deletions(-) diff --git a/src/Mod/TechDraw/Gui/SymbolChooser.ui b/src/Mod/TechDraw/Gui/SymbolChooser.ui index 634b025821..355a9ef2e2 100644 --- a/src/Mod/TechDraw/Gui/SymbolChooser.ui +++ b/src/Mod/TechDraw/Gui/SymbolChooser.ui @@ -9,8 +9,8 @@ 0 0 - 400 - 394 + 360 + 280 @@ -19,98 +19,79 @@ true - - - - 19 - 19 - 361 - 341 - - - - - 0 - 0 - - - - QFrame::StyledPanel - - - QFrame::Raised - - - 2 - - - - - 9 - 19 - 341 - 191 - - - - - - - - - - - - 10 - 220 - 341 - 41 - - - - + + + + + Select a symbol that should be used + + + + + + + + + 0 + 0 + + Cancel - + + + + 0 + 0 + + OK + + + + Qt::Horizontal + + + + 40 + 20 + + + + - - - - - 10 - 280 - 341 - 35 - - - - + + + + Symbol Dir - + + + Directory to welding symbols. + Gui::FileChooser::Directory - - + + 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/TaskWeldingSymbol.cpp b/src/Mod/TechDraw/Gui/TaskWeldingSymbol.cpp index 2f53579f5b..5b2ed4f49f 100644 --- a/src/Mod/TechDraw/Gui/TaskWeldingSymbol.cpp +++ b/src/Mod/TechDraw/Gui/TaskWeldingSymbol.cpp @@ -83,44 +83,27 @@ 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))); - - 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(); + + 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->fcSymbolDir, SIGNAL(fileNameSelected(QString)), + this, SLOT(onDirectorySelected(const QString))); } //ctor for edit @@ -129,7 +112,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 +132,41 @@ TaskWeldingSymbol::TaskWeldingSymbol(TechDraw::DrawWeldSymbol* weld) : ui->setupUi(this); + setUiEdit(); + connect(ui->pbArrowSymbol, SIGNAL(clicked(bool)), - this, SLOT(onArrowSymbolClicked(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->fcSymbolDir, SIGNAL(fileNameSelected(const QString&)), - this, SLOT(onDirectorySelected(const QString&))); + connect(ui->fcSymbolDir, SIGNAL(fileNameSelected(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() @@ -246,7 +236,7 @@ void TaskWeldingSymbol::setUiEdit() ui->pbArrowSymbol->setIconSize(iconSize); ui->pbArrowSymbol->setText(QString()); } else { - ui->pbArrowSymbol->setText(QString::fromUtf8("Symbol")); + ui->pbArrowSymbol->setText(tr("Symbol")); } } @@ -263,78 +253,106 @@ 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::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 +367,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 +383,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 +390,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 +404,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 +469,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 +504,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..84f4b44530 100644 --- a/src/Mod/TechDraw/Gui/TaskWeldingSymbol.h +++ b/src/Mod/TechDraw/Gui/TaskWeldingSymbol.h @@ -102,14 +102,15 @@ 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 onArrowTextChanged(); + void onOtherTextChanged(); + void onWeldingChanged(); void onDirectorySelected(const QString& newDir); void onSymbolSelected(QString symbolPath, QString source); @@ -125,8 +126,6 @@ protected Q_SLOTS: protected: void changeEvent(QEvent *e); - - void blockButtons(bool b); void setUiPrimary(void); void setUiEdit(); @@ -141,7 +140,6 @@ protected: void collectOtherData(void); std::string prefSymbolDir(); - void saveState(void); QString m_currDir; @@ -163,14 +161,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..c1955ee51a 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,248 @@ :/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 + + + + + + + + + + + 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 - - 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 + + + + + From 5da2b423511f6476e8bdda85db1c8c59207ef457 Mon Sep 17 00:00:00 2001 From: donovaly Date: Sun, 29 Mar 2020 23:31:24 +0200 Subject: [PATCH 08/14] TaskWeldingSymbol.cpp: revert an unintended change --- src/Mod/TechDraw/Gui/TaskWeldingSymbol.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Mod/TechDraw/Gui/TaskWeldingSymbol.cpp b/src/Mod/TechDraw/Gui/TaskWeldingSymbol.cpp index 5b2ed4f49f..1e49c58d7b 100644 --- a/src/Mod/TechDraw/Gui/TaskWeldingSymbol.cpp +++ b/src/Mod/TechDraw/Gui/TaskWeldingSymbol.cpp @@ -102,8 +102,8 @@ TaskWeldingSymbol::TaskWeldingSymbol(TechDraw::DrawLeaderLine* leader) : this, SLOT(onOtherSymbolCreateClicked())); connect(ui->pbOtherErase, SIGNAL(clicked(bool)), this, SLOT(onOtherEraseCreateClicked())); - connect(ui->fcSymbolDir, SIGNAL(fileNameSelected(QString)), - this, SLOT(onDirectorySelected(const QString))); + connect(ui->fcSymbolDir, SIGNAL(fileNameSelected(const QString&)), + this, SLOT(onDirectorySelected(const QString&))); } //ctor for edit @@ -142,8 +142,8 @@ TaskWeldingSymbol::TaskWeldingSymbol(TechDraw::DrawWeldSymbol* weld) : connect(ui->pbOtherErase, SIGNAL(clicked(bool)), this, SLOT(onOtherEraseClicked())); - connect(ui->fcSymbolDir, SIGNAL(fileNameSelected(QString)), - this, SLOT(onDirectorySelected(const QString))); + connect(ui->fcSymbolDir, SIGNAL(fileNameSelected(const QString&)), + this, SLOT(onDirectorySelected(const QString&))); connect(ui->leArrowTextL, SIGNAL(textEdited(QString)), this, SLOT(onArrowTextChanged())); From 954d4e64f5b3d7ef492bfe93417ff96ac7f082a8 Mon Sep 17 00:00:00 2001 From: donovaly Date: Mon, 30 Mar 2020 00:28:13 +0200 Subject: [PATCH 09/14] SymbolChooser: use Qt's OK|Cancel buttons - use the standard Qt buttons for the OK/Cancel action (QDialogButtonBox) advantage: better layout and cleaner than 2 own and separate buttons --- src/Mod/TechDraw/Gui/SymbolChooser.cpp | 17 ++--- src/Mod/TechDraw/Gui/SymbolChooser.h | 4 +- src/Mod/TechDraw/Gui/SymbolChooser.ui | 93 +++++++++++++------------- 3 files changed, 54 insertions(+), 60 deletions(-) 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 355a9ef2e2..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 @@ -14,7 +14,7 @@ - SymbolChooser + Symbol Chooser true @@ -28,47 +28,17 @@ - - - - - - 0 - 0 - - - - Cancel - - - - - - - - 0 - 0 - - - - OK - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + false + + @@ -101,5 +71,38 @@ - + + + bbButtons + accepted() + TechDrawGui::SymbolChooser + accept() + + + 179 + 228 + + + 179 + 139 + + + + + bbButtons + rejected() + TechDrawGui::SymbolChooser + reject() + + + 179 + 228 + + + 179 + 139 + + + + From fe333b219fd2238a20269b1b3e48031159974a3c Mon Sep 17 00:00:00 2001 From: donovaly Date: Mon, 30 Mar 2020 03:34:44 +0200 Subject: [PATCH 10/14] fix tile properties - make TileColumn read-only - restrict TileRow to what is possible - improve tooltips - add button to flip the sides (the symbol is not mirrored, just flipped) --- src/Mod/TechDraw/App/DrawTile.cpp | 25 ++++++++- src/Mod/TechDraw/App/DrawTile.h | 5 +- src/Mod/TechDraw/App/DrawTileWeld.cpp | 11 ++-- src/Mod/TechDraw/Gui/TaskWeldingSymbol.cpp | 57 +++++++++++++++++++- src/Mod/TechDraw/Gui/TaskWeldingSymbol.h | 2 + src/Mod/TechDraw/Gui/TaskWeldingSymbol.ui | 62 +++++++++++++++++----- 6 files changed, 136 insertions(+), 26 deletions(-) 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/Gui/TaskWeldingSymbol.cpp b/src/Mod/TechDraw/Gui/TaskWeldingSymbol.cpp index 1e49c58d7b..a2a236b2b5 100644 --- a/src/Mod/TechDraw/Gui/TaskWeldingSymbol.cpp +++ b/src/Mod/TechDraw/Gui/TaskWeldingSymbol.cpp @@ -102,6 +102,8 @@ TaskWeldingSymbol::TaskWeldingSymbol(TechDraw::DrawLeaderLine* leader) : 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&))); } @@ -136,11 +138,12 @@ TaskWeldingSymbol::TaskWeldingSymbol(TechDraw::DrawWeldSymbol* weld) : connect(ui->pbArrowSymbol, SIGNAL(clicked(bool)), this, SLOT(onArrowSymbolClicked())); - connect(ui->pbOtherSymbol, SIGNAL(clicked(bool)), this, SLOT(onOtherSymbolClicked())); connect(ui->pbOtherErase, SIGNAL(clicked(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&))); @@ -231,7 +234,7 @@ 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()); @@ -335,6 +338,56 @@ void TaskWeldingSymbol::onOtherEraseClicked() 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(); diff --git a/src/Mod/TechDraw/Gui/TaskWeldingSymbol.h b/src/Mod/TechDraw/Gui/TaskWeldingSymbol.h index 84f4b44530..6702f82bd4 100644 --- a/src/Mod/TechDraw/Gui/TaskWeldingSymbol.h +++ b/src/Mod/TechDraw/Gui/TaskWeldingSymbol.h @@ -108,6 +108,8 @@ public Q_SLOTS: void onOtherSymbolClicked(); void onOtherEraseCreateClicked(); void onOtherEraseClicked(); + void onFlipSidesCreateClicked(); + void onFlipSidesClicked(); void onArrowTextChanged(); void onOtherTextChanged(); void onWeldingChanged(); diff --git a/src/Mod/TechDraw/Gui/TaskWeldingSymbol.ui b/src/Mod/TechDraw/Gui/TaskWeldingSymbol.ui index c1955ee51a..504f12f6b9 100644 --- a/src/Mod/TechDraw/Gui/TaskWeldingSymbol.ui +++ b/src/Mod/TechDraw/Gui/TaskWeldingSymbol.ui @@ -112,13 +112,6 @@ - - - - Text after other side symbol - - - @@ -129,13 +122,6 @@ - - - - Text before other side symbol - - - @@ -143,6 +129,54 @@ + + + + Text after other side symbol + + + + + + + + 0 + 0 + + + + + 60 + 30 + + + + + 60 + 30 + + + + + 60 + 30 + + + + Flips the sides + + + Flip Sides + + + + + + + Text before other side symbol + + + From c92ab7efb4febde712923eaae57842e0c6f71a4e Mon Sep 17 00:00:00 2001 From: donovaly Date: Mon, 30 Mar 2020 03:52:38 +0200 Subject: [PATCH 11/14] TaskDlgWeldingSymbol: fix creation issue - assure that the other side is always created, also if it has no symbol yet Now everything should be correct and I won't change the PR further --- src/Mod/TechDraw/Gui/TaskWeldingSymbol.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Mod/TechDraw/Gui/TaskWeldingSymbol.cpp b/src/Mod/TechDraw/Gui/TaskWeldingSymbol.cpp index a2a236b2b5..215e2706bb 100644 --- a/src/Mod/TechDraw/Gui/TaskWeldingSymbol.cpp +++ b/src/Mod/TechDraw/Gui/TaskWeldingSymbol.cpp @@ -103,7 +103,7 @@ TaskWeldingSymbol::TaskWeldingSymbol(TechDraw::DrawLeaderLine* leader) : connect(ui->pbOtherErase, SIGNAL(clicked(bool)), this, SLOT(onOtherEraseCreateClicked())); connect(ui->pbFlipSides, SIGNAL(clicked(bool)), - this, SLOT(onFlipSidesCreateClicked())); + this, SLOT(onFlipSidesCreateClicked())); connect(ui->fcSymbolDir, SIGNAL(fileNameSelected(const QString&)), this, SLOT(onDirectorySelected(const QString&))); } @@ -205,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() From 316be97da8dc93df0d26b41c7157c556cc2e8234 Mon Sep 17 00:00:00 2001 From: donovaly Date: Sun, 29 Mar 2020 23:55:20 +0200 Subject: [PATCH 12/14] [TD] DlgTemplateField.ui: size policy - compact the dialog size --- src/Mod/TechDraw/Gui/DlgTemplateField.ui | 112 ++++++++++------------- 1 file changed, 47 insertions(+), 65 deletions(-) diff --git a/src/Mod/TechDraw/Gui/DlgTemplateField.ui b/src/Mod/TechDraw/Gui/DlgTemplateField.ui index ecd80bbc7e..f595b1717e 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,69 +19,51 @@ true - - - - - - 0 - 0 - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - - - - - Text Name: - - - - - - - TextLabel - - - - - - - Value: - - - - - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - false - - - - - - - + + + + + + + + + Text Name: + + + + + + + TextLabel + + + + + + + Value: + + + + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + false + + + + From 5316d5d7093b78399f57b488181ba36bd709988a Mon Sep 17 00:00:00 2001 From: donovaly Date: Mon, 30 Mar 2020 00:33:02 +0200 Subject: [PATCH 13/14] DlgTemplateField.ui: remove unnecessary layout --- src/Mod/TechDraw/Gui/DlgTemplateField.ui | 76 +++++++++++------------- 1 file changed, 36 insertions(+), 40 deletions(-) diff --git a/src/Mod/TechDraw/Gui/DlgTemplateField.ui b/src/Mod/TechDraw/Gui/DlgTemplateField.ui index f595b1717e..6565a9d86b 100644 --- a/src/Mod/TechDraw/Gui/DlgTemplateField.ui +++ b/src/Mod/TechDraw/Gui/DlgTemplateField.ui @@ -19,52 +19,48 @@ true - + - - - - - - - Text Name: - - - - - - - TextLabel - - - - - - - Value: - - - - - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - false + + + + + Text Name: + + + + TextLabel + + + + + + + Value: + + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + false + + + From 7c9d5fe57c94eeec0289317e6be8a99bdceea11f Mon Sep 17 00:00:00 2001 From: donovaly Date: Sun, 29 Mar 2020 23:44:43 +0200 Subject: [PATCH 14/14] [TD] geometric Hatch dialog - use Gui::QuantitySpinBox - some UI file size policy adjustments --- src/Mod/TechDraw/Gui/TaskGeomHatch.cpp | 8 +-- src/Mod/TechDraw/Gui/TaskGeomHatch.ui | 72 ++++++++++++++++++-------- 2 files changed, 54 insertions(+), 26 deletions(-) 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/FileDialog.h
+ + Gui::QuantitySpinBox + QWidget +
Gui/QuantitySpinBox.h
+
Gui::ColorButton QPushButton