diff --git a/ChangeLog.txt b/ChangeLog.txt index cc4b38722..9ef2df60b 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -24,6 +24,7 @@ - New layout option --nestQuantity. - New feature Pattern recipe. - New options to hide all/show all visibility groups. +- New feature "Hide piece's main path". # Version 0.6.2 (unreleased) - [#903] Bug in tool Cut Spline path. diff --git a/src/app/valentina/mainwindow.cpp b/src/app/valentina/mainwindow.cpp index b78c34ad8..93a7723d3 100644 --- a/src/app/valentina/mainwindow.cpp +++ b/src/app/valentina/mainwindow.cpp @@ -3066,6 +3066,7 @@ void MainWindow::Clear() ui->actionFinalMeasurements->setEnabled(false); ui->actionLast_tool->setEnabled(false); ui->actionShowCurveDetails->setEnabled(false); + ui->actionHideMainPath->setEnabled(false); ui->actionLoadIndividual->setEnabled(false); ui->actionLoadMultisize->setEnabled(false); ui->actionUnloadMeasurements->setEnabled(false); @@ -3417,7 +3418,8 @@ void MainWindow::SetEnabledGUI(bool enabled) void MainWindow::SetEnableWidgets(bool enable) { const bool drawStage = (qApp->GetDrawMode() == Draw::Calculation); - const bool designStage = (drawStage || qApp->GetDrawMode() == Draw::Modeling); + const bool detailsStage = (qApp->GetDrawMode() == Draw::Modeling); + const bool designStage = (drawStage || detailsStage); comboBoxDraws->setEnabled(enable && drawStage); ui->actionOptionDraw->setEnabled(enable && drawStage); @@ -3441,6 +3443,7 @@ void MainWindow::SetEnableWidgets(bool enable) ui->actionZoomFitBestCurrent->setEnabled(enable && drawStage); ui->actionZoomOriginal->setEnabled(enable); ui->actionShowCurveDetails->setEnabled(enable && drawStage); + ui->actionHideMainPath->setEnabled(enable && detailsStage); ui->actionLoadIndividual->setEnabled(enable && designStage); ui->actionLoadMultisize->setEnabled(enable && designStage); ui->actionUnloadMeasurements->setEnabled(enable && designStage); @@ -4493,6 +4496,28 @@ void MainWindow::CreateActions() qApp->ValentinaSettings()->SetShowCurveDetails(checked); }); + ui->actionHideMainPath->setChecked(qApp->ValentinaSettings()->IsPieceHideMainPath()); + connect(ui->actionHideMainPath, &QAction::triggered, this, [this](bool checked) + { + qApp->ValentinaSettings()->SetPieceHideMainPath(checked); + const QList ids = pattern->DataPieces()->keys(); + const bool updateChildren = false; + QGuiApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); + for(auto &id : ids) + { + try + { + if (VToolSeamAllowance *tool = qobject_cast(VAbstractPattern::getTool(id))) + { + tool->RefreshGeometry(updateChildren); + } + } + catch(VExceptionBadId &) + {} + } + QGuiApplication::restoreOverrideCursor(); + }); + connect(ui->actionLoadIndividual, &QAction::triggered, this, &MainWindow::LoadIndividual); connect(ui->actionLoadMultisize, &QAction::triggered, this, &MainWindow::LoadMultisize); diff --git a/src/app/valentina/mainwindow.ui b/src/app/valentina/mainwindow.ui index 1d8fcf1e6..8bd89982e 100644 --- a/src/app/valentina/mainwindow.ui +++ b/src/app/valentina/mainwindow.ui @@ -1751,6 +1751,7 @@ + @@ -2833,6 +2834,20 @@ Export recipe + + + true + + + false + + + Hide main path + + + Globally hide pieces main path + + diff --git a/src/libs/vmisc/vcommonsettings.cpp b/src/libs/vmisc/vcommonsettings.cpp index 100b30335..31d0db754 100644 --- a/src/libs/vmisc/vcommonsettings.cpp +++ b/src/libs/vmisc/vcommonsettings.cpp @@ -76,6 +76,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternLabelFont, (QLatin1String Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternLineWidth, (QLatin1String("pattern/lineWidth"))) Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternCurveApproximationScale, (QLatin1String("pattern/curveApproximationScale"))) Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternShowCurveDetails, (QLatin1String("pattern/showCurveDetails"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternPieceHideMainPath, (QLatin1String("pattern/pieceHideMainPath"))) Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternLabelFontSize, (QLatin1String("pattern/labelFontSize"))) Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternHideLabels, (QLatin1String("pattern/hideLabels"))) @@ -107,6 +108,7 @@ qreal curveApproximationCached = -1; Q_GLOBAL_STATIC(QString, localeCached) qreal lineWidthCached = 0; int labelFontSizeCached = 0; +int pieceHideMainPath = -1; //--------------------------------------------------------------------------------------------------------------------- QStringList ClearFormats(const QStringList &predefinedFormats, QStringList formats) @@ -1145,6 +1147,23 @@ void VCommonSettings::SetShowCurveDetails(bool value) setValue(*settingPatternShowCurveDetails, value); } +//--------------------------------------------------------------------------------------------------------------------- +bool VCommonSettings::IsPieceHideMainPath() const +{ + if (pieceHideMainPath < 0) + { + pieceHideMainPath = value(*settingPatternPieceHideMainPath, 0).toInt(); + } + return pieceHideMainPath; +} + +//--------------------------------------------------------------------------------------------------------------------- +void VCommonSettings::SetPieceHideMainPath(bool value) +{ + pieceHideMainPath = value; + setValue(*settingPatternPieceHideMainPath, pieceHideMainPath); +} + //--------------------------------------------------------------------------------------------------------------------- qreal VCommonSettings::GetLineWidth() const { diff --git a/src/libs/vmisc/vcommonsettings.h b/src/libs/vmisc/vcommonsettings.h index 19a465902..f39abff44 100644 --- a/src/libs/vmisc/vcommonsettings.h +++ b/src/libs/vmisc/vcommonsettings.h @@ -212,6 +212,9 @@ public: bool IsShowCurveDetails() const; void SetShowCurveDetails(bool value); + bool IsPieceHideMainPath() const; + void SetPieceHideMainPath(bool value); + static qreal DefaultLineWidth(); static qreal MinimalLineWidth(); static qreal MaximalLineWidth(); diff --git a/src/libs/vtools/tools/vtoolseamallowance.cpp b/src/libs/vtools/tools/vtoolseamallowance.cpp index 4a0070e8b..0ea97b8b7 100644 --- a/src/libs/vtools/tools/vtoolseamallowance.cpp +++ b/src/libs/vtools/tools/vtoolseamallowance.cpp @@ -1312,7 +1312,8 @@ void VToolSeamAllowance::RefreshGeometry(bool updateChildren) QPainterPath path; - if (not detail.IsHideMainPath() || not detail.IsSeamAllowance() || detail.IsSeamAllowanceBuiltIn()) + if ((not qApp->Settings()->IsPieceHideMainPath() && not detail.IsHideMainPath()) || not detail.IsSeamAllowance() + || detail.IsSeamAllowanceBuiltIn()) { m_mainPath = QPainterPath(); m_mainPathRect = QRectF();