New feature "Hide piece's main path".

In some cases users want to hide main path and work with "real" pattern pieces.
This new option allows to quickly disable main path for all pieces without need
to make manual adjustment for each piece. Do not ovveride piece options.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2019-07-18 20:18:48 +03:00
parent 8888437b07
commit a3e643b5dd
6 changed files with 66 additions and 2 deletions

View File

@ -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.

View File

@ -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<quint32> ids = pattern->DataPieces()->keys();
const bool updateChildren = false;
QGuiApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
for(auto &id : ids)
{
try
{
if (VToolSeamAllowance *tool = qobject_cast<VToolSeamAllowance *>(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);

View File

@ -1751,6 +1751,7 @@
<addaction name="separator"/>
<addaction name="actionLast_tool"/>
<addaction name="actionShowCurveDetails"/>
<addaction name="actionHideMainPath"/>
</widget>
<widget class="QMenu" name="menuMeasurements">
<property name="title">
@ -2833,6 +2834,20 @@
<string>Export recipe</string>
</property>
</action>
<action name="actionHideMainPath">
<property name="checkable">
<bool>true</bool>
</property>
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Hide main path</string>
</property>
<property name="toolTip">
<string>Globally hide pieces main path</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>

View File

@ -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
{

View File

@ -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();

View File

@ -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();