diff --git a/src/Mod/TechDraw/Gui/TaskLeaderLine.cpp b/src/Mod/TechDraw/Gui/TaskLeaderLine.cpp index 5b87221bd9..870b4cbb4f 100644 --- a/src/Mod/TechDraw/Gui/TaskLeaderLine.cpp +++ b/src/Mod/TechDraw/Gui/TaskLeaderLine.cpp @@ -120,6 +120,10 @@ TaskLeaderLine::TaskLeaderLine(TechDrawGui::ViewProviderLeader* leadVP) : this, SLOT(onCancelEditClicked(bool))); ui->pbCancelEdit->setEnabled(false); + ui->dsbWeight->setUnit(Base::Unit::Length); + ui->dsbWeight->setMinimum(0); + ui->dsbWeight->setValue(0.5); + saveState(); m_trackerMode = QGTracker::TrackerMode::Line; @@ -165,6 +169,10 @@ TaskLeaderLine::TaskLeaderLine(TechDraw::DrawView* baseFeat, this, SLOT(onCancelEditClicked(bool))); ui->pbCancelEdit->setEnabled(false); + ui->dsbWeight->setUnit(Base::Unit::Length); + ui->dsbWeight->setMinimum(0); + ui->dsbWeight->setValue(0.5); + m_trackerMode = QGTracker::TrackerMode::Line; m_saveContextPolicy = m_mdi->contextMenuPolicy(); @@ -297,7 +305,7 @@ void TaskLeaderLine::createLeaderFeature(std::vector converted) App::Color ac; ac.setValue(ui->cpLineColor->color()); leadVP->Color.setValue(ac); - leadVP->LineWidth.setValue(ui->dsbWeight->value()); + leadVP->LineWidth.setValue(ui->dsbWeight->rawValue()); leadVP->LineStyle.setValue(ui->cboxStyle->currentIndex()); } } @@ -324,7 +332,7 @@ void TaskLeaderLine::updateLeaderFeature(void) App::Color ac; ac.setValue(ui->cpLineColor->color()); m_lineVP->Color.setValue(ac); - m_lineVP->LineWidth.setValue(ui->dsbWeight->value()); + m_lineVP->LineWidth.setValue(ui->dsbWeight->rawValue()); m_lineVP->LineStyle.setValue(ui->cboxStyle->currentIndex()); Gui::Command::updateActive(); diff --git a/src/Mod/TechDraw/Gui/TaskLeaderLine.ui b/src/Mod/TechDraw/Gui/TaskLeaderLine.ui index 51bbe1842e..ae4d7b84b3 100644 --- a/src/Mod/TechDraw/Gui/TaskLeaderLine.ui +++ b/src/Mod/TechDraw/Gui/TaskLeaderLine.ui @@ -313,6 +313,9 @@ + + Line color + 0 @@ -325,16 +328,22 @@ - Weight + Width - - + + + true + + + Line width + + 0.100000000000000 - + 0.500000000000000 @@ -348,6 +357,9 @@ + + Line style + 1 @@ -414,6 +426,11 @@ QPushButton
Gui/Widgets.h
+ + Gui::QuantitySpinBox + QWidget +
Gui/QuantitySpinBox.h
+
diff --git a/src/Mod/TechDraw/Gui/TaskRichAnno.cpp b/src/Mod/TechDraw/Gui/TaskRichAnno.cpp index 4b34908314..0a9ca70f0a 100644 --- a/src/Mod/TechDraw/Gui/TaskRichAnno.cpp +++ b/src/Mod/TechDraw/Gui/TaskRichAnno.cpp @@ -123,6 +123,9 @@ TaskRichAnno::TaskRichAnno(TechDrawGui::ViewProviderRichAnno* annoVP) : connect(ui->pbEditor, SIGNAL(clicked(bool)), this, SLOT(onEditorClicked(bool))); + ui->dsbWidth->setUnit(Base::Unit::Length); + ui->dsbWidth->setMinimum(0); + ui->dsbWidth->setValue(0.5); } //ctor for creation @@ -165,6 +168,9 @@ TaskRichAnno::TaskRichAnno(TechDraw::DrawView* baseFeat, connect(ui->pbEditor, SIGNAL(clicked(bool)), this, SLOT(onEditorClicked(bool))); + ui->dsbWidth->setUnit(Base::Unit::Length); + ui->dsbWidth->setMinimum(0); + ui->dsbWidth->setValue(0.5); } TaskRichAnno::~TaskRichAnno() @@ -204,6 +210,8 @@ void TaskRichAnno::enableTextUi(bool b) ui->teAnnoText->setEnabled(b); } +//switch widgets related to ViewProvider on/off +//there is no ViewProvider until some time after feature is created. void TaskRichAnno::enableVPUi(bool b) { Q_UNUSED(b); @@ -230,6 +238,12 @@ void TaskRichAnno::setUiEdit() ui->dsbMaxWidth->setValue(m_annoFeat->MaxWidth.getValue()); ui->cbShowFrame->setChecked(m_annoFeat->ShowFrame.getValue()); } + + if (m_annoVP != nullptr) { + ui->cpFrameColor->setColor(m_annoVP->LineColor.getValue().asValue()); + ui->dsbWidth->setValue(m_annoVP->LineWidth.getValue()); + ui->cFrameStyle->setCurrentIndex(m_annoVP->LineStyle.getValue()); + } } void TaskRichAnno::onEditorClicked(bool b) @@ -309,6 +323,18 @@ void TaskRichAnno::createAnnoFeature() m_annoFeat->Y.setValue(Rez::appX(vTemp.y)); } + if (m_annoFeat != nullptr) { + Gui::ViewProvider* vp = QGIView::getViewProvider(m_annoFeat); + auto annoVP = dynamic_cast(vp); + if (annoVP != nullptr) { + App::Color ac; + ac.setValue(ui->cpFrameColor->color()); + annoVP->LineColor.setValue(ac); + annoVP->LineWidth.setValue(ui->dsbWidth->rawValue()); + annoVP->LineStyle.setValue(ui->cFrameStyle->currentIndex()); + } + } + Gui::Command::updateActive(); Gui::Command::commitCommand(); @@ -327,6 +353,11 @@ void TaskRichAnno::updateAnnoFeature() // Base::Console().Message("TRA::updateAnnoFeature()\n"); Gui::Command::openCommand("Edit Anno"); commonFeatureUpdate(); + App::Color ac; + ac.setValue(ui->cpFrameColor->color()); + m_annoVP->LineColor.setValue(ac); + m_annoVP->LineWidth.setValue(ui->dsbWidth->rawValue()); + m_annoVP->LineStyle.setValue(ui->cFrameStyle->currentIndex()); Gui::Command::commitCommand(); m_annoFeat->requestPaint(); diff --git a/src/Mod/TechDraw/Gui/TaskRichAnno.ui b/src/Mod/TechDraw/Gui/TaskRichAnno.ui index 87719466d4..003fc92c2f 100644 --- a/src/Mod/TechDraw/Gui/TaskRichAnno.ui +++ b/src/Mod/TechDraw/Gui/TaskRichAnno.ui @@ -1,156 +1,301 @@ - - - TechDrawGui::TaskRichAnno - - - - 0 - 0 - 409 - 386 - - - - - 0 - 0 - - - - - 250 - 0 - - - - Rich Text Annotation Block - - - - :/icons/actions/techdraw-RichTextAnnotation.svg:/icons/actions/techdraw-RichTextAnnotation.svg - - - - - - - 0 - 0 - - - - QFrame::Box - - - QFrame::Raised - - - - - - - - 0 - - - - - -1.000000000000000 - - - -1.000000000000000 - - - - - - - Max Width - - - - - - - Base Feature - - - - - - - false - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Qt::LeftToRight - - - - - - - - - - Show Frame - - - - - - - - - Qt::Horizontal - - - - - - - true - - - Start Rich Text Editor - - - - - - - - 0 - 0 - - - - - - - - - - - - - - - - + + + TechDrawGui::TaskRichAnno + + + + 0 + 0 + 409 + 419 + + + + + 0 + 0 + + + + + 250 + 0 + + + + Rich Text Annotation Block + + + + :/icons/actions/techdraw-RichTextAnnotation.svg:/icons/actions/techdraw-RichTextAnnotation.svg + + + + + + + 0 + 0 + + + + QFrame::Box + + + QFrame::Raised + + + + + + + + Base Feature + + + + + + + false + + + + + + + Max Width + + + + + + + Maximal width, if -1 then automatic width + + + -1.000000000000000 + + + -1.000000000000000 + + + + + + + + + Qt::Horizontal + + + + + + + true + + + Start Rich Text Editor + + + + + + + + 0 + 0 + + + + + + + + + + Show Frame + + + + + + + Qt::LeftToRight + + + + + + + + + + Color + + + + + + + false + + + Line color + + + + 0 + 0 + 0 + + + + + + + + Width + + + + + + + false + + + Line width + + + 0.100000000000000 + + + 0.500000000000000 + + + + + + + Style + + + + + + + false + + + Line style + + + 1 + + + + NoLine + + + + + Solid + + + + + Dash + + + + + Dot + + + + + DashDot + + + + + DashDotDot + + + + + + + + + + + + + + Gui::ColorButton + QPushButton +
Gui/Widgets.h
+
+ + Gui::QuantitySpinBox + QWidget +
Gui/QuantitySpinBox.h
+
+
+ + + + + + cbShowFrame + toggled(bool) + cpFrameColor + setEnabled(bool) + + + 183 + 270 + + + 183 + 294 + + + + + cbShowFrame + toggled(bool) + cFrameStyle + setEnabled(bool) + + + 236 + 277 + + + 236 + 354 + + + + + cbShowFrame + toggled(bool) + dsbWidth + setEnabled(bool) + + + 236 + 277 + + + 236 + 328 + + + + +