Refactoring.
Merge "if" statement with the enclosing one.
This commit is contained in:
parent
8c83c50991
commit
a81f878cd6
|
@ -408,15 +408,8 @@ auto VPPiece::PathsSuperposition(const QVector<QPointF> &path1, const QVector<QP
|
|||
const QRectF path2Rect = VLayoutPiece::BoundingRect(path2);
|
||||
const QPainterPath path2Path = VGObject::PainterPath(path2);
|
||||
|
||||
if (path1Rect.intersects(path2Rect) || path2Rect.contains(path1Rect) || path1Rect.contains(path2Rect))
|
||||
{
|
||||
if (path1Path.contains(path2Path) || path2Path.contains(path1Path) || path1Path.intersects(path2Path))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return (path1Rect.intersects(path2Rect) || path2Rect.contains(path1Rect) || path1Rect.contains(path2Rect)) &&
|
||||
(path1Path.contains(path2Path) || path2Path.contains(path1Path) || path1Path.intersects(path2Path));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -681,11 +674,11 @@ auto VPPiece::StickyPieces(VStickyDistance &match) const -> bool
|
|||
CastTo(piece->GetMappedExternalContourPoints(), piecePath);
|
||||
QRectF const pieceBoundingRect = VLayoutPiece::BoundingRect(piecePath);
|
||||
|
||||
if (stickyZone.intersects(pieceBoundingRect) || pieceBoundingRect.contains(stickyZone) ||
|
||||
stickyZone.contains(pieceBoundingRect))
|
||||
{
|
||||
if (not VPPiece::PathsSuperposition(path, piecePath))
|
||||
if ((stickyZone.intersects(pieceBoundingRect) || pieceBoundingRect.contains(stickyZone) ||
|
||||
stickyZone.contains(pieceBoundingRect)) &&
|
||||
not VPPiece::PathsSuperposition(path, piecePath))
|
||||
{
|
||||
|
||||
QVector<QPointF> const pieceStickyPath = PrepareStickyPath(piecePath);
|
||||
if (QLineF const distance = ClosestDistance(stickyPath, pieceStickyPath);
|
||||
match.m_closestDistance.isNull() || distance.length() < match.m_closestDistance.length())
|
||||
|
@ -695,7 +688,6 @@ auto VPPiece::StickyPieces(VStickyDistance &match) const -> bool
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -255,18 +255,15 @@ void VPGraphicsPiece::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
|||
|
||||
if (VPPiecePtr const piece = m_piece.toStrongRef(); not piece.isNull())
|
||||
{
|
||||
if (VPLayoutPtr const layout = piece->Layout(); not layout.isNull())
|
||||
if (VPLayoutPtr const layout = piece->Layout();
|
||||
not layout.isNull() && (layout->LayoutSettings().IsStickyEdges() && m_hasStickyPosition))
|
||||
{
|
||||
if (layout->LayoutSettings().IsStickyEdges() && m_hasStickyPosition)
|
||||
{
|
||||
auto *command =
|
||||
new VPUndoPieceMove(piece, m_stickyTranslateX, m_stickyTranslateY, m_allowChangeMerge);
|
||||
auto *command = new VPUndoPieceMove(piece, m_stickyTranslateX, m_stickyTranslateY, m_allowChangeMerge);
|
||||
layout->UndoStack()->push(command);
|
||||
|
||||
SetStickyPoints(QVector<QPointF>());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_allowChangeMerge = false;
|
||||
m_hasStickyPosition = false;
|
||||
|
@ -1184,9 +1181,7 @@ void VPGraphicsPiece::PieceZValueChanged(const VPPiecePtr &piece)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VPGraphicsPiece::itemChange(GraphicsItemChange change, const QVariant &value) -> QVariant
|
||||
{
|
||||
if (scene() != nullptr)
|
||||
{
|
||||
if (change == ItemSelectedHasChanged)
|
||||
if (scene() != nullptr && change == ItemSelectedHasChanged)
|
||||
{
|
||||
VPPiecePtr const piece = m_piece.toStrongRef();
|
||||
if (not piece.isNull())
|
||||
|
@ -1200,7 +1195,6 @@ auto VPGraphicsPiece::itemChange(GraphicsItemChange change, const QVariant &valu
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return QGraphicsObject::itemChange(change, value);
|
||||
}
|
||||
|
|
|
@ -305,9 +305,7 @@ void VPMainGraphicsView::keyReleaseEvent(QKeyEvent *event)
|
|||
break;
|
||||
}
|
||||
|
||||
if (event->key() == Qt::Key_BracketLeft || event->key() == Qt::Key_BracketRight)
|
||||
{
|
||||
if (not event->isAutoRepeat())
|
||||
if ((event->key() == Qt::Key_BracketLeft || event->key() == Qt::Key_BracketRight) && not event->isAutoRepeat())
|
||||
{
|
||||
VPLayoutPtr const layout = m_layout.toStrongRef();
|
||||
if (layout.isNull())
|
||||
|
@ -322,7 +320,6 @@ void VPMainGraphicsView::keyReleaseEvent(QKeyEvent *event)
|
|||
sheet->SceneData()->RotationControls()->on_HideHandles(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
VMainGraphicsView::keyReleaseEvent(event);
|
||||
}
|
||||
|
||||
|
@ -690,9 +687,7 @@ void VPMainGraphicsView::MovePiece(QKeyEvent *event)
|
|||
}
|
||||
|
||||
if (const QList<VPGraphicsPiece *> &graphicsPieces = sheet->SceneData()->GraphicsPieces();
|
||||
m_hasStickyPosition && not graphicsPieces.isEmpty())
|
||||
{
|
||||
if (layout->LayoutSettings().IsStickyEdges())
|
||||
m_hasStickyPosition && not graphicsPieces.isEmpty() && layout->LayoutSettings().IsStickyEdges())
|
||||
{
|
||||
auto PreparePieces = [layout]()
|
||||
{
|
||||
|
@ -718,7 +713,6 @@ void VPMainGraphicsView::MovePiece(QKeyEvent *event)
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_allowChangeMerge = false;
|
||||
m_hasStickyPosition = false;
|
||||
|
|
|
@ -163,16 +163,13 @@ void VPUndoPiecesMove::undo()
|
|||
for (const auto &piece : qAsConst(m_pieces))
|
||||
{
|
||||
VPPiecePtr const p = piece.toStrongRef();
|
||||
if (not p.isNull())
|
||||
{
|
||||
if (m_oldTransforms.contains(p->GetUniqueID()))
|
||||
if (not p.isNull() && m_oldTransforms.contains(p->GetUniqueID()))
|
||||
{
|
||||
p->SetMatrix(m_oldTransforms.value(p->GetUniqueID()));
|
||||
emit layout->PieceTransformationChanged(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPUndoPiecesMove::redo()
|
||||
|
|
|
@ -202,9 +202,7 @@ void VPUndoPiecesRotate::undo()
|
|||
for (const auto &piece : qAsConst(m_pieces))
|
||||
{
|
||||
VPPiecePtr const p = piece.toStrongRef();
|
||||
if (not p.isNull())
|
||||
{
|
||||
if (m_oldTransforms.contains(p->GetUniqueID()))
|
||||
if (not p.isNull() && m_oldTransforms.contains(p->GetUniqueID()))
|
||||
{
|
||||
p->SetMatrix(m_oldTransforms.value(p->GetUniqueID()));
|
||||
if (m_followGrainline || p->IsFollowGrainline())
|
||||
|
@ -215,7 +213,6 @@ void VPUndoPiecesRotate::undo()
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPUndoPiecesRotate::redo()
|
||||
|
|
|
@ -109,16 +109,13 @@ void VPUndoPieceZValueMove::undo()
|
|||
|
||||
for (const auto &p : pieces)
|
||||
{
|
||||
if (not p.isNull())
|
||||
{
|
||||
if (m_oldValues.contains(p->GetUniqueID()))
|
||||
if (not p.isNull() && m_oldValues.contains(p->GetUniqueID()))
|
||||
{
|
||||
p->SetZValue(m_oldValues.value(p->GetUniqueID()));
|
||||
emit layout->PieceZValueChanged(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPUndoPieceZValueMove::redo()
|
||||
|
@ -326,16 +323,13 @@ void VPUndoPiecesZValueMove::undo()
|
|||
|
||||
for (const auto &p : pieces)
|
||||
{
|
||||
if (not p.isNull())
|
||||
{
|
||||
if (m_oldValues.contains(p->GetUniqueID()))
|
||||
if (not p.isNull() && m_oldValues.contains(p->GetUniqueID()))
|
||||
{
|
||||
p->SetZValue(m_oldValues.value(p->GetUniqueID()));
|
||||
emit layout->PieceZValueChanged(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPUndoPiecesZValueMove::redo()
|
||||
|
|
|
@ -239,11 +239,8 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
|
|||
break;
|
||||
}
|
||||
|
||||
if (type == QtWarningMsg || type == QtCriticalMsg || type == QtFatalMsg)
|
||||
{
|
||||
if (VPApplication::VApp()->IsAppInGUIMode())
|
||||
{
|
||||
if (topWinAllowsPop)
|
||||
if ((type == QtWarningMsg || type == QtCriticalMsg || type == QtFatalMsg) &&
|
||||
VPApplication::VApp()->IsAppInGUIMode() && topWinAllowsPop)
|
||||
{
|
||||
messageBox.setText(msg);
|
||||
messageBox.setStandardButtons(QMessageBox::Ok);
|
||||
|
@ -257,8 +254,6 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
|
|||
QGuiApplication::restoreOverrideCursor();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (QtFatalMsg == type)
|
||||
{
|
||||
|
|
|
@ -216,14 +216,12 @@ void SetPrinterSheetPageSettings(const QSharedPointer<QPrinter> &printer, const
|
|||
printer->setPageOrientation(sheetOrientation);
|
||||
printer->setFullPage(sheet->IgnoreMargins());
|
||||
|
||||
if (not sheet->IgnoreMargins())
|
||||
{
|
||||
if (not printer->setPageMargins(UnitConvertor(margins, Unit::Px, Unit::Mm), QPageLayout::Millimeter))
|
||||
if (not sheet->IgnoreMargins() &&
|
||||
not printer->setPageMargins(UnitConvertor(margins, Unit::Px, Unit::Mm), QPageLayout::Millimeter))
|
||||
{
|
||||
qWarning() << QObject::tr("Cannot set printer margins");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void SetPrinterTiledPageSettings(const QSharedPointer<QPrinter> &printer, const VPLayoutPtr &layout,
|
||||
|
@ -266,14 +264,12 @@ void SetPrinterTiledPageSettings(const QSharedPointer<QPrinter> &printer, const
|
|||
printer->setPageOrientation(orientation);
|
||||
printer->setFullPage(layout->LayoutSettings().IgnoreTilesMargins());
|
||||
|
||||
if (not layout->LayoutSettings().IgnoreTilesMargins())
|
||||
{
|
||||
if (not printer->setPageMargins(layout->LayoutSettings().GetTilesMargins(Unit::Mm), QPageLayout::Millimeter))
|
||||
if (not layout->LayoutSettings().IgnoreTilesMargins() &&
|
||||
not printer->setPageMargins(layout->LayoutSettings().GetTilesMargins(Unit::Mm), QPageLayout::Millimeter))
|
||||
{
|
||||
qWarning() << QObject::tr("Cannot set printer margins");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto IsValidFileName(const QString &fileName) -> bool
|
||||
|
@ -488,13 +484,10 @@ auto VPMainWindow::LoadFile(const QString &path) -> bool
|
|||
|
||||
VlpCreateLock(lock, path);
|
||||
|
||||
if (not lock->IsLocked())
|
||||
{
|
||||
if (not IgnoreLocking(lock->GetLockError(), path, m_cmd->IsGuiEnabled()))
|
||||
if (not lock->IsLocked() && not IgnoreLocking(lock->GetLockError(), path, m_cmd->IsGuiEnabled()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -803,9 +796,7 @@ void VPMainWindow::ShowFullPieceToggled(bool checked)
|
|||
if (selectedPieces.size() == 1)
|
||||
{
|
||||
const VPPiecePtr &selectedPiece = selectedPieces.constFirst();
|
||||
if (not selectedPiece.isNull())
|
||||
{
|
||||
if (selectedPiece->IsShowFullPiece() != checked)
|
||||
if (not selectedPiece.isNull() && selectedPiece->IsShowFullPiece() != checked)
|
||||
{
|
||||
selectedPiece->SetShowFullPiece(checked);
|
||||
LayoutWasSaved(false);
|
||||
|
@ -813,7 +804,6 @@ void VPMainWindow::ShowFullPieceToggled(bool checked)
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPMainWindow::ShowMirrorLineToggled(bool checked)
|
||||
|
@ -822,9 +812,7 @@ void VPMainWindow::ShowMirrorLineToggled(bool checked)
|
|||
if (selectedPieces.size() == 1)
|
||||
{
|
||||
const VPPiecePtr &selectedPiece = selectedPieces.constFirst();
|
||||
if (not selectedPiece.isNull())
|
||||
{
|
||||
if (selectedPiece->IsShowMirrorLine() != checked)
|
||||
if (not selectedPiece.isNull() && selectedPiece->IsShowMirrorLine() != checked)
|
||||
{
|
||||
selectedPiece->SetShowMirrorLine(checked);
|
||||
LayoutWasSaved(false);
|
||||
|
@ -832,7 +820,6 @@ void VPMainWindow::ShowMirrorLineToggled(bool checked)
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPMainWindow::CurrentPieceVerticallyFlippedToggled(bool checked)
|
||||
|
@ -841,9 +828,7 @@ void VPMainWindow::CurrentPieceVerticallyFlippedToggled(bool checked)
|
|||
if (selectedPieces.size() == 1)
|
||||
{
|
||||
const VPPiecePtr &selectedPiece = selectedPieces.constFirst();
|
||||
if (not selectedPiece.isNull())
|
||||
{
|
||||
if (selectedPiece->IsVerticallyFlipped() != checked)
|
||||
if (not selectedPiece.isNull() && selectedPiece->IsVerticallyFlipped() != checked)
|
||||
{
|
||||
selectedPiece->FlipVertically();
|
||||
LayoutWasSaved(false);
|
||||
|
@ -851,7 +836,6 @@ void VPMainWindow::CurrentPieceVerticallyFlippedToggled(bool checked)
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPMainWindow::CurrentPieceHorizontallyFlippedToggled(bool checked)
|
||||
|
@ -860,9 +844,7 @@ void VPMainWindow::CurrentPieceHorizontallyFlippedToggled(bool checked)
|
|||
if (selectedPieces.size() == 1)
|
||||
{
|
||||
const VPPiecePtr &selectedPiece = selectedPieces.constFirst();
|
||||
if (not selectedPiece.isNull())
|
||||
{
|
||||
if (selectedPiece->IsHorizontallyFlipped() != checked)
|
||||
if (not selectedPiece.isNull() && selectedPiece->IsHorizontallyFlipped() != checked)
|
||||
{
|
||||
selectedPiece->FlipHorizontally();
|
||||
LayoutWasSaved(false);
|
||||
|
@ -870,7 +852,6 @@ void VPMainWindow::CurrentPieceHorizontallyFlippedToggled(bool checked)
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPMainWindow::InitPropertyTabCurrentPiece()
|
||||
|
@ -3004,9 +2985,8 @@ auto VPMainWindow::AskLayoutIsInvalid(const QList<VPSheetPtr> &sheets) -> bool
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VPMainWindow::CheckPiecesOutOfBound(const VPPiecePtr &piece, bool &outOfBoundChecked) -> bool
|
||||
{
|
||||
if (m_layout->LayoutSettings().GetWarningPiecesOutOfBound())
|
||||
{
|
||||
if (not outOfBoundChecked && not piece.isNull() && piece->OutOfBound())
|
||||
if (m_layout->LayoutSettings().GetWarningPiecesOutOfBound() && not outOfBoundChecked && not piece.isNull() &&
|
||||
piece->OutOfBound())
|
||||
{
|
||||
QMessageBox msgBox(this);
|
||||
msgBox.setIcon(QMessageBox::Question);
|
||||
|
@ -3026,16 +3006,14 @@ auto VPMainWindow::CheckPiecesOutOfBound(const VPPiecePtr &piece, bool &outOfBou
|
|||
|
||||
outOfBoundChecked = true; // no need to ask more
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VPMainWindow::CheckSuperpositionOfPieces(const VPPiecePtr &piece, bool &pieceSuperpositionChecked) -> bool
|
||||
{
|
||||
if (m_layout->LayoutSettings().GetWarningSuperpositionOfPieces())
|
||||
{
|
||||
if (not pieceSuperpositionChecked && not piece.isNull() && piece->HasSuperpositionWithPieces())
|
||||
if (m_layout->LayoutSettings().GetWarningSuperpositionOfPieces() && not pieceSuperpositionChecked &&
|
||||
not piece.isNull() && piece->HasSuperpositionWithPieces())
|
||||
{
|
||||
QMessageBox msgBox(this);
|
||||
msgBox.setIcon(QMessageBox::Question);
|
||||
|
@ -3056,7 +3034,6 @@ auto VPMainWindow::CheckSuperpositionOfPieces(const VPPiecePtr &piece, bool &pie
|
|||
|
||||
pieceSuperpositionChecked = true; // no need to ask more
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -3064,9 +3041,8 @@ auto VPMainWindow::CheckSuperpositionOfPieces(const VPPiecePtr &piece, bool &pie
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VPMainWindow::CheckPieceGapePosition(const VPPiecePtr &piece, bool &pieceGapePositionChecked) -> bool
|
||||
{
|
||||
if (m_layout->LayoutSettings().GetWarningPieceGapePosition())
|
||||
{
|
||||
if (not pieceGapePositionChecked && not piece.isNull() && piece->HasInvalidPieceGapPosition())
|
||||
if (m_layout->LayoutSettings().GetWarningPieceGapePosition() && not pieceGapePositionChecked &&
|
||||
not piece.isNull() && piece->HasInvalidPieceGapPosition())
|
||||
{
|
||||
QMessageBox msgBox(this);
|
||||
msgBox.setIcon(QMessageBox::Question);
|
||||
|
@ -3087,7 +3063,6 @@ auto VPMainWindow::CheckPieceGapePosition(const VPPiecePtr &piece, bool &pieceGa
|
|||
|
||||
pieceGapePositionChecked = true; // no need to ask more
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -3166,8 +3141,8 @@ auto VPMainWindow::PrintLayoutSheetPage(QPrinter *printer, QPainter &painter, co
|
|||
|
||||
if (not sheet->IgnoreMargins())
|
||||
{
|
||||
QMarginsF const margins = sheet->GetSheetMargins();
|
||||
if (not printer->setPageMargins(UnitConvertor(margins, Unit::Px, Unit::Mm), QPageLayout::Millimeter))
|
||||
if (QMarginsF const margins = sheet->GetSheetMargins();
|
||||
not printer->setPageMargins(UnitConvertor(margins, Unit::Px, Unit::Mm), QPageLayout::Millimeter))
|
||||
{
|
||||
qWarning() << QObject::tr("Cannot set printer margins");
|
||||
}
|
||||
|
|
|
@ -367,33 +367,24 @@ auto DialogMeasurementsCSVColumns::ColumnsValid() -> bool
|
|||
|
||||
if (m_type == MeasurementsType::Multisize)
|
||||
{
|
||||
if (not m_dimensions.empty())
|
||||
{
|
||||
if (not ColumnValid(MultisizeMeasurementsColumns::ShiftA))
|
||||
if (not m_dimensions.empty() && not ColumnValid(MultisizeMeasurementsColumns::ShiftA))
|
||||
{
|
||||
ChangeColor(ui->labelShiftA, errorColor);
|
||||
columnShiftAFlag = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_dimensions.size() > 1)
|
||||
{
|
||||
if (not ColumnValid(MultisizeMeasurementsColumns::ShiftB))
|
||||
if (m_dimensions.size() > 1 && not ColumnValid(MultisizeMeasurementsColumns::ShiftB))
|
||||
{
|
||||
ChangeColor(ui->labelShiftB, errorColor);
|
||||
columnShiftBFlag = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_dimensions.size() > 2)
|
||||
{
|
||||
if (not ColumnValid(MultisizeMeasurementsColumns::ShiftC))
|
||||
if (m_dimensions.size() > 2 && not ColumnValid(MultisizeMeasurementsColumns::ShiftC))
|
||||
{
|
||||
ChangeColor(ui->labelShiftC, errorColor);
|
||||
columnShiftCFlag = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ChangeColumnColor(ui->labelFullName, columnFullNameFlag, MultisizeMeasurementsColumns::FullName,
|
||||
IndividualMeasurementsColumns::FullName);
|
||||
|
|
|
@ -405,16 +405,13 @@ void DialogSetupMultisize::CheckDimension(QGroupBox *group, QGroupBox *nameGroup
|
|||
return;
|
||||
}
|
||||
|
||||
if (nameGroup->isChecked() && lineEdit->text().isEmpty())
|
||||
{
|
||||
if (ui->labelError->text().isEmpty())
|
||||
if (nameGroup->isChecked() && lineEdit->text().isEmpty() && ui->labelError->text().isEmpty())
|
||||
{
|
||||
ui->labelError->setText(tr("Please, provide custom name for dimension %1").arg(dimension->Axis()));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSetupMultisize::CheckState()
|
||||
|
|
|
@ -275,11 +275,8 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
|
|||
break;
|
||||
}
|
||||
|
||||
if (type == QtWarningMsg || type == QtCriticalMsg || type == QtFatalMsg)
|
||||
{
|
||||
if (not MApplication::VApp()->IsTestMode())
|
||||
{
|
||||
if (topWinAllowsPop)
|
||||
if ((type == QtWarningMsg || type == QtCriticalMsg || type == QtFatalMsg) &&
|
||||
not MApplication::VApp()->IsTestMode() && topWinAllowsPop)
|
||||
{
|
||||
messageBox.setText(VAbstractApplication::ClearMessage(logMsg));
|
||||
messageBox.setStandardButtons(QMessageBox::Ok);
|
||||
|
@ -293,8 +290,6 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
|
|||
QGuiApplication::restoreOverrideCursor();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (QtFatalMsg == type)
|
||||
{
|
||||
|
@ -898,15 +893,12 @@ void MApplication::RepopulateMeasurementsDatabase(const QString &path)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void MApplication::KnownMeasurementsPathChanged(const QString &oldPath, const QString &newPath)
|
||||
{
|
||||
if (oldPath != newPath)
|
||||
{
|
||||
if (m_knownMeasurementsDatabase != nullptr)
|
||||
if (oldPath != newPath && m_knownMeasurementsDatabase != nullptr)
|
||||
{
|
||||
RestartKnownMeasurementsDatabaseWatcher();
|
||||
RepopulateMeasurementsDatabase(newPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void MApplication::SyncKnownMeasurements()
|
||||
|
|
|
@ -196,13 +196,11 @@ auto TKMMainWindow::LoadFile(const QString &path) -> bool
|
|||
|
||||
VlpCreateLock(m_lock, path);
|
||||
|
||||
if (not m_lock->IsLocked())
|
||||
{
|
||||
if (not IgnoreLocking(m_lock->GetLockError(), path, MApplication::VApp()->IsAppInGUIMode()))
|
||||
if (not m_lock->IsLocked() &&
|
||||
not IgnoreLocking(m_lock->GetLockError(), path, MApplication::VApp()->IsAppInGUIMode()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
|
|
|
@ -433,13 +433,11 @@ auto TMainWindow::LoadFile(const QString &path) -> bool
|
|||
|
||||
VlpCreateLock(m_lock, path);
|
||||
|
||||
if (not m_lock->IsLocked())
|
||||
{
|
||||
if (not IgnoreLocking(m_lock->GetLockError(), path, MApplication::VApp()->IsAppInGUIMode()))
|
||||
if (not m_lock->IsLocked() &&
|
||||
not IgnoreLocking(m_lock->GetLockError(), path, MApplication::VApp()->IsAppInGUIMode()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -4097,13 +4095,11 @@ auto TMainWindow::LoadFromExistingFile(const QString &path) -> bool
|
|||
|
||||
VlpCreateLock(m_lock, path);
|
||||
|
||||
if (not m_lock->IsLocked())
|
||||
{
|
||||
if (not IgnoreLocking(m_lock->GetLockError(), path, MApplication::VApp()->IsAppInGUIMode()))
|
||||
if (not m_lock->IsLocked() &&
|
||||
not IgnoreLocking(m_lock->GetLockError(), path, MApplication::VApp()->IsAppInGUIMode()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
|
|
|
@ -287,9 +287,7 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
|
|||
|
||||
if (isGuiThread)
|
||||
{
|
||||
if (type == QtWarningMsg || type == QtCriticalMsg || type == QtFatalMsg)
|
||||
{
|
||||
if (VApplication::IsGUIMode())
|
||||
if ((type == QtWarningMsg || type == QtCriticalMsg || type == QtFatalMsg) && VApplication::IsGUIMode())
|
||||
{
|
||||
// fixme: trying to make sure there are no save/load dialogs are opened, because error message during
|
||||
// them will lead to crash
|
||||
|
@ -335,7 +333,6 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
|
|||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (QtFatalMsg == type)
|
||||
{
|
||||
|
@ -783,15 +780,12 @@ void VApplication::RepopulateMeasurementsDatabase(const QString &path)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VApplication::KnownMeasurementsPathChanged(const QString &oldPath, const QString &newPath)
|
||||
{
|
||||
if (oldPath != newPath)
|
||||
{
|
||||
if (m_knownMeasurementsDatabase != nullptr)
|
||||
if (oldPath != newPath && m_knownMeasurementsDatabase != nullptr)
|
||||
{
|
||||
RestartKnownMeasurementsDatabaseWatcher();
|
||||
RepopulateMeasurementsDatabase(newPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VApplication::IsGUIMode() -> bool
|
||||
|
|
|
@ -139,14 +139,11 @@ auto VCommandLine::DefaultGenerator() const -> VLayoutGeneratorPtr
|
|||
}
|
||||
}
|
||||
|
||||
if (IsOptionSet(LONG_OPTION_SHIFTUNITS))
|
||||
{
|
||||
if (!diag.SelectLayoutUnit(OptionValue(LONG_OPTION_SHIFTUNITS)))
|
||||
if (IsOptionSet(LONG_OPTION_SHIFTUNITS) && !diag.SelectLayoutUnit(OptionValue(LONG_OPTION_SHIFTUNITS)))
|
||||
{
|
||||
qCritical() << translate("VCommandLine", "Unsupported layout units.") << "\n";
|
||||
const_cast<VCommandLine *>(this)->parser.showHelp(V_EX_USAGE);
|
||||
}
|
||||
}
|
||||
|
||||
if (IsOptionSet(LONG_OPTION_GAPWIDTH))
|
||||
{
|
||||
|
|
|
@ -554,13 +554,10 @@ auto VToolOptionsPropertyBrowser::ComboBoxPalette() const -> QPalette
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolOptionsPropertyBrowser::itemClicked(QGraphicsItem *item)
|
||||
{
|
||||
if (item != nullptr)
|
||||
{
|
||||
if (not item->isEnabled())
|
||||
if (item != nullptr && not item->isEnabled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_currentItem == item && item != nullptr)
|
||||
{
|
||||
|
|
|
@ -192,9 +192,7 @@ void VWidgetDetails::ToggleSectionDetails(bool select)
|
|||
for (int i = 0; i < ui->tableWidget->rowCount(); ++i)
|
||||
{
|
||||
const quint32 id = ui->tableWidget->item(i, PieceColumn::InLayout)->data(Qt::UserRole).toUInt();
|
||||
if (allDetails->contains(id))
|
||||
{
|
||||
if (not(select == allDetails->value(id).IsInLayout()))
|
||||
if (allDetails->contains(id) && not(select == allDetails->value(id).IsInLayout()))
|
||||
{
|
||||
auto *togglePrint = new TogglePieceInLayout(id, select, m_data, m_doc);
|
||||
connect(togglePrint, &TogglePieceInLayout::Toggled, this, &VWidgetDetails::ToggledPiece);
|
||||
|
@ -202,7 +200,6 @@ void VWidgetDetails::ToggleSectionDetails(bool select)
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VWidgetDetails::ToggledPieceItem(QTableWidgetItem *item)
|
||||
|
|
|
@ -358,13 +358,10 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
connect(doc, &VPattern::CheckLayout, this,
|
||||
[this]()
|
||||
{
|
||||
if (pattern->DataPieces()->isEmpty())
|
||||
{
|
||||
if (not ui->actionDraw->isChecked())
|
||||
if (pattern->DataPieces()->isEmpty() && not ui->actionDraw->isChecked())
|
||||
{
|
||||
ActionDraw(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
connect(doc, &VPattern::SetCurrentPP, this, &MainWindow::GlobalChangePP);
|
||||
connect(doc, &VPattern::MadeProgress, this, &MainWindow::ShowProgress);
|
||||
|
@ -2334,29 +2331,20 @@ void MainWindow::StoreMultisizeMDimensions()
|
|||
|
||||
QList<MeasurementDimension_p> const dimensions = m_m->Dimensions().values();
|
||||
|
||||
if (not dimensions.isEmpty())
|
||||
{
|
||||
if (not m_dimensionALabel.isNull())
|
||||
if (not dimensions.isEmpty() && not m_dimensionALabel.isNull())
|
||||
{
|
||||
m_dimensionALabel->setText(dimensions.at(0)->Name() + ':'_L1);
|
||||
}
|
||||
}
|
||||
|
||||
if (dimensions.size() > 1)
|
||||
{
|
||||
if (not m_dimensionBLabel.isNull())
|
||||
if (dimensions.size() > 1 && not m_dimensionBLabel.isNull())
|
||||
{
|
||||
m_dimensionBLabel->setText(dimensions.at(1)->Name() + ':'_L1);
|
||||
}
|
||||
}
|
||||
|
||||
if (dimensions.size() > 2)
|
||||
{
|
||||
if (not m_dimensionCLabel.isNull())
|
||||
if (dimensions.size() > 2 && not m_dimensionCLabel.isNull())
|
||||
{
|
||||
m_dimensionCLabel->setText(dimensions.at(2)->Name() + ':'_L1);
|
||||
}
|
||||
}
|
||||
|
||||
StoreMultisizeMDimension(dimensions, 0, m_currentDimensionA);
|
||||
StoreMultisizeMDimension(dimensions, 1, m_currentDimensionB);
|
||||
|
@ -3909,9 +3897,7 @@ void MainWindow::ActionDetails(bool checked)
|
|||
ui->actionDetails->setChecked(true);
|
||||
ui->actionLayout->setChecked(false);
|
||||
|
||||
if (not VAbstractValApplication::VApp()->getOpeningPattern())
|
||||
{
|
||||
if (pattern->DataPieces()->isEmpty())
|
||||
if (not VAbstractValApplication::VApp()->getOpeningPattern() && pattern->DataPieces()->isEmpty())
|
||||
{
|
||||
QMessageBox::information(this, tr("Detail mode"),
|
||||
tr("You can't use Detail mode yet. "
|
||||
|
@ -3920,7 +3906,6 @@ void MainWindow::ActionDetails(bool checked)
|
|||
ActionDraw(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
m_detailsWidget->UpdateList();
|
||||
|
||||
|
@ -6782,13 +6767,10 @@ void MainWindow::ExportLayoutAs(bool checked)
|
|||
|
||||
auto Uncheck = qScopeGuard([this] { ui->actionLayoutExportAs->setChecked(false); });
|
||||
|
||||
if (m_layoutSettings->IsLayoutStale())
|
||||
{
|
||||
if (VPrintLayout::ContinueIfLayoutStale(this) == QMessageBox::No)
|
||||
if (m_layoutSettings->IsLayoutStale() && VPrintLayout::ContinueIfLayoutStale(this) == QMessageBox::No)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
|
|
|
@ -400,13 +400,11 @@ auto MainWindowsNoGUI::GenerateLayout(VLayoutGenerator &lGenerator) -> bool
|
|||
}
|
||||
|
||||
if (nestingState == LayoutErrors::NoError && not qFuzzyIsNull(lGenerator.GetEfficiencyCoefficient()) &&
|
||||
efficiency >= lGenerator.GetEfficiencyCoefficient())
|
||||
{
|
||||
if (not lGenerator.IsPreferOneSheetSolution() || lGenerator.PapersCount() == 1)
|
||||
efficiency >= lGenerator.GetEfficiencyCoefficient() &&
|
||||
(not lGenerator.IsPreferOneSheetSolution() || lGenerator.PapersCount() == 1))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (IsTimeout())
|
||||
{
|
||||
|
|
|
@ -446,16 +446,13 @@ auto VPattern::SPointActiveDraw() -> quint32
|
|||
if (not domNode.isNull() && domNode.isElement())
|
||||
{
|
||||
const QDomElement domElement = domNode.toElement();
|
||||
if (not domElement.isNull())
|
||||
{
|
||||
if (domElement.tagName() == TagPoint &&
|
||||
if (not domElement.isNull() && domElement.tagName() == TagPoint &&
|
||||
domElement.attribute(AttrType, QString()) == VToolBasePoint::ToolType)
|
||||
{
|
||||
return GetParametrId(domElement);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1332,14 +1329,11 @@ void VPattern::ParseDetails(const QDomElement &domElement, const Document &parse
|
|||
if (domNode.isElement())
|
||||
{
|
||||
QDomElement domElement = domNode.toElement();
|
||||
if (domElement.isNull() == false)
|
||||
{
|
||||
if (domElement.tagName() == TagDetail)
|
||||
if (domElement.isNull() == false && domElement.tagName() == TagDetail)
|
||||
{
|
||||
ParseDetailElement(domElement, parse);
|
||||
}
|
||||
}
|
||||
}
|
||||
domNode = domNode.nextSibling();
|
||||
}
|
||||
|
||||
|
@ -2903,9 +2897,7 @@ void VPattern::ParseOldToolSplinePath(VMainGraphicsScene *scene, QDomElement &do
|
|||
for (qint32 i = 0; i < num; ++i)
|
||||
{
|
||||
const QDomElement element = nodeList.at(i).toElement();
|
||||
if (element.isNull() == false)
|
||||
{
|
||||
if (element.tagName() == AttrPathPoint)
|
||||
if (element.isNull() == false && element.tagName() == AttrPathPoint)
|
||||
{
|
||||
const qreal kAsm1 = GetParametrDouble(element, AttrKAsm1, QStringLiteral("1.0"));
|
||||
const qreal angle = GetParametrDouble(element, AttrAngle, QChar('0'));
|
||||
|
@ -2924,7 +2916,6 @@ void VPattern::ParseOldToolSplinePath(VMainGraphicsScene *scene, QDomElement &do
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
auto *path = new VSplinePath(points, kCurve);
|
||||
if (duplicate > 0)
|
||||
|
@ -3069,9 +3060,7 @@ void VPattern::ParseToolCubicBezierPath(VMainGraphicsScene *scene, const QDomEle
|
|||
for (qint32 i = 0; i < num; ++i)
|
||||
{
|
||||
const QDomElement element = nodeList.at(i).toElement();
|
||||
if (element.isNull() == false)
|
||||
{
|
||||
if (element.tagName() == AttrPathPoint)
|
||||
if (element.isNull() == false && element.tagName() == AttrPathPoint)
|
||||
{
|
||||
const quint32 pSpline = GetParametrUInt(element, AttrPSpline, NULL_ID_STR);
|
||||
const VPointF p = *data->GeometricObject<VPointF>(pSpline);
|
||||
|
@ -3082,7 +3071,6 @@ void VPattern::ParseToolCubicBezierPath(VMainGraphicsScene *scene, const QDomEle
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
initData.path = new VCubicBezierPath(points);
|
||||
if (duplicate > 0)
|
||||
|
@ -4187,10 +4175,8 @@ void VPattern::ParseIncrementsElement(const QDomNode &node, const Document &pars
|
|||
{
|
||||
if (domNode.isElement())
|
||||
{
|
||||
const QDomElement domElement = domNode.toElement();
|
||||
if (not domElement.isNull())
|
||||
{
|
||||
if (domElement.tagName() == TagIncrement)
|
||||
if (const QDomElement domElement = domNode.toElement();
|
||||
not domElement.isNull() && domElement.tagName() == TagIncrement)
|
||||
{
|
||||
const QString name = GetParametrString(domElement, AttrName, QString()).simplified();
|
||||
const QString desc = GetParametrEmptyString(domElement, AttrDescription);
|
||||
|
@ -4213,7 +4199,6 @@ void VPattern::ParseIncrementsElement(const QDomNode &node, const Document &pars
|
|||
data->AddUniqueVariable(increment);
|
||||
}
|
||||
}
|
||||
}
|
||||
domNode = domNode.nextSibling();
|
||||
}
|
||||
|
||||
|
@ -4514,15 +4499,12 @@ void VPattern::SetLabelPrefix(const QString &prefix)
|
|||
{
|
||||
QDomElement pattern = documentElement();
|
||||
|
||||
if (not pattern.isNull())
|
||||
{
|
||||
if (ConvertToSet<QString>(VApplication::LabelLanguages()).contains(prefix))
|
||||
if (not pattern.isNull() && ConvertToSet<QString>(VApplication::LabelLanguages()).contains(prefix))
|
||||
{
|
||||
SetAttribute(pattern, AttrLabelPrefix, prefix);
|
||||
modified = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPattern::PrepareForParse(const Document &parse)
|
||||
|
|
|
@ -431,9 +431,8 @@ auto FvUpdater::xmlParseFeed() -> bool
|
|||
const QXmlStreamAttributes attribs = m_xml.attributes();
|
||||
const auto fervorPlatform = QStringLiteral("fervor:platform");
|
||||
|
||||
if (attribs.hasAttribute(fervorPlatform))
|
||||
{
|
||||
if (CurrentlyRunningOnPlatform(attribs.value(fervorPlatform).toString().trimmed()))
|
||||
if (attribs.hasAttribute(fervorPlatform) &&
|
||||
CurrentlyRunningOnPlatform(attribs.value(fervorPlatform).toString().trimmed()))
|
||||
{
|
||||
xmlEnclosurePlatform = attribs.value(fervorPlatform).toString().trimmed();
|
||||
|
||||
|
@ -459,10 +458,7 @@ auto FvUpdater::xmlParseFeed() -> bool
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (m_xml.isEndElement())
|
||||
{
|
||||
if (m_xml.name() == "item"_L1)
|
||||
else if (m_xml.isEndElement() && m_xml.name() == "item"_L1)
|
||||
{
|
||||
// That's it - we have analyzed a single <item> and we'll stop
|
||||
// here (because the topmost is the most recent one, and thus
|
||||
|
@ -470,7 +466,6 @@ auto FvUpdater::xmlParseFeed() -> bool
|
|||
|
||||
return searchDownloadedFeedForUpdates(xmlEnclosureUrl, xmlEnclosureVersion, xmlEnclosurePlatform);
|
||||
}
|
||||
}
|
||||
|
||||
if (m_xml.error() && m_xml.error() != QXmlStreamReader::PrematureEndOfDocumentError)
|
||||
{
|
||||
|
@ -555,14 +550,11 @@ auto FvUpdater::VersionIsIgnored(const QString &version) -> bool
|
|||
}
|
||||
|
||||
const unsigned lastSkippedVersion = VAbstractApplication::VApp()->Settings()->GetLatestSkippedVersion();
|
||||
if (lastSkippedVersion != 0x0)
|
||||
{
|
||||
if (decVersion == lastSkippedVersion)
|
||||
if (lastSkippedVersion != 0x0 && decVersion == lastSkippedVersion)
|
||||
{
|
||||
// Implicitly skipped version - skip
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (decVersion > AppVersion())
|
||||
{
|
||||
|
@ -635,14 +627,11 @@ auto FvUpdater::CurrentlyRunningOnPlatform(const QString &platform) -> bool
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void FvUpdater::showErrorDialog(const QString &message, bool showEvenInSilentMode)
|
||||
{
|
||||
if (m_silentAsMuchAsItCouldGet)
|
||||
{
|
||||
if (not showEvenInSilentMode)
|
||||
if (m_silentAsMuchAsItCouldGet && not showEvenInSilentMode)
|
||||
{
|
||||
// Don't show errors in the silent mode
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
QMessageBox dlFailedMsgBox;
|
||||
dlFailedMsgBox.setIcon(QMessageBox::Critical);
|
||||
|
@ -653,14 +642,11 @@ void FvUpdater::showErrorDialog(const QString &message, bool showEvenInSilentMod
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void FvUpdater::showInformationDialog(const QString &message, bool showEvenInSilentMode)
|
||||
{
|
||||
if (m_silentAsMuchAsItCouldGet)
|
||||
{
|
||||
if (not showEvenInSilentMode)
|
||||
if (m_silentAsMuchAsItCouldGet && not showEvenInSilentMode)
|
||||
{
|
||||
// Don't show information dialogs in the silent mode
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
QMessageBox dlInformationMsgBox;
|
||||
dlInformationMsgBox.setIcon(QMessageBox::Information);
|
||||
|
|
|
@ -443,14 +443,11 @@ auto VAbstractPattern::CheckExistNamePP(const QString &name) const -> bool
|
|||
for (qint32 i = 0; i < elements.count(); i++)
|
||||
{
|
||||
const QDomElement elem = elements.at(i).toElement();
|
||||
if (elem.isNull() == false)
|
||||
{
|
||||
if (GetParametrString(elem, AttrName) == name)
|
||||
if (elem.isNull() == false && GetParametrString(elem, AttrName) == name)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -498,10 +495,8 @@ void VAbstractPattern::ParseGroups(const QDomElement &domElement)
|
|||
{
|
||||
if (domNode.isElement())
|
||||
{
|
||||
const QDomElement domElement = domNode.toElement();
|
||||
if (not domElement.isNull())
|
||||
{
|
||||
if (domElement.tagName() == TagGroup)
|
||||
if (const QDomElement domElement = domNode.toElement();
|
||||
not domElement.isNull() && domElement.tagName() == TagGroup)
|
||||
{
|
||||
VContainer::UpdateId(GetParametrUInt(domElement, AttrId, NULL_ID_STR), valentinaNamespace);
|
||||
|
||||
|
@ -521,7 +516,6 @@ void VAbstractPattern::ParseGroups(const QDomElement &domElement)
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
domNode = domNode.nextSibling();
|
||||
}
|
||||
|
||||
|
@ -562,16 +556,13 @@ auto VAbstractPattern::GetPPElement(const QString &name) -> QDomElement
|
|||
|
||||
for (qint32 i = 0; i < elements.count(); i++)
|
||||
{
|
||||
QDomElement const element = elements.at(i).toElement();
|
||||
if (not element.isNull())
|
||||
{
|
||||
if (element.attribute(AttrName) == name)
|
||||
if (QDomElement const element = elements.at(i).toElement();
|
||||
not element.isNull() && element.attribute(AttrName) == name)
|
||||
{
|
||||
return element;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return QDomElement();
|
||||
}
|
||||
|
||||
|
@ -2623,10 +2614,8 @@ auto VAbstractPattern::GetGroups(const QString &patternPieceName) -> QMap<quint3
|
|||
{
|
||||
if (domNode.isElement())
|
||||
{
|
||||
const QDomElement group = domNode.toElement();
|
||||
if (not group.isNull())
|
||||
{
|
||||
if (group.tagName() == TagGroup)
|
||||
if (const QDomElement group = domNode.toElement();
|
||||
not group.isNull() && group.tagName() == TagGroup)
|
||||
{
|
||||
VGroupData groupData;
|
||||
const quint32 id = GetParametrUInt(group, AttrId, QChar('0'));
|
||||
|
@ -2658,7 +2647,6 @@ auto VAbstractPattern::GetGroups(const QString &patternPieceName) -> QMap<quint3
|
|||
data.insert(id, groupData);
|
||||
}
|
||||
}
|
||||
}
|
||||
domNode = domNode.nextSibling();
|
||||
}
|
||||
}
|
||||
|
@ -2703,10 +2691,8 @@ auto VAbstractPattern::GetGroupsContainingItem(quint32 toolId, quint32 objectId,
|
|||
{
|
||||
if (domNode.isElement())
|
||||
{
|
||||
const QDomElement group = domNode.toElement();
|
||||
if (group.isNull() == false)
|
||||
{
|
||||
if (group.tagName() == TagGroup)
|
||||
if (const QDomElement group = domNode.toElement();
|
||||
group.isNull() == false && group.tagName() == TagGroup)
|
||||
{
|
||||
bool const groupHasItem = GroupHasItem(group, toolId, objectId);
|
||||
if ((containItem && groupHasItem) || (not containItem && not groupHasItem))
|
||||
|
@ -2718,7 +2704,6 @@ auto VAbstractPattern::GetGroupsContainingItem(quint32 toolId, quint32 objectId,
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
domNode = domNode.nextSibling();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -382,15 +382,11 @@ auto VDomDocument::find(QHash<quint32, QDomElement> &cache, const QDomElement &n
|
|||
|
||||
for (qint32 i = 0; i < node.childNodes().length(); ++i)
|
||||
{
|
||||
const QDomNode n = node.childNodes().at(i);
|
||||
if (n.isElement())
|
||||
{
|
||||
if (VDomDocument::find(cache, n.toElement(), id))
|
||||
if (const QDomNode n = node.childNodes().at(i); n.isElement() && VDomDocument::find(cache, n.toElement(), id))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -643,10 +643,8 @@ auto VPatternConverter::FixIncrementsToV0_2_0() -> QSet<QString>
|
|||
{
|
||||
if (domNode.isElement())
|
||||
{
|
||||
QDomElement domElement = domNode.toElement();
|
||||
if (not domElement.isNull())
|
||||
{
|
||||
if (domElement.tagName() == *strIncrement)
|
||||
if (QDomElement domElement = domNode.toElement();
|
||||
not domElement.isNull() && domElement.tagName() == *strIncrement)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -669,7 +667,6 @@ auto VPatternConverter::FixIncrementsToV0_2_0() -> QSet<QString>
|
|||
domElement.removeAttribute(*strBase);
|
||||
}
|
||||
}
|
||||
}
|
||||
domNode = domNode.nextSibling();
|
||||
}
|
||||
return names;
|
||||
|
@ -1627,14 +1624,11 @@ void VPatternConverter::TagRemoveAttributeTypeObjectInV0_4_0()
|
|||
QDomNode domNode = modeling.firstChild();
|
||||
while (not domNode.isNull())
|
||||
{
|
||||
QDomElement domElement = domNode.toElement();
|
||||
if (not domElement.isNull())
|
||||
{
|
||||
if (domElement.hasAttribute(*strTypeObject))
|
||||
if (QDomElement domElement = domNode.toElement();
|
||||
not domElement.isNull() && domElement.hasAttribute(*strTypeObject))
|
||||
{
|
||||
domElement.removeAttribute(*strTypeObject);
|
||||
}
|
||||
}
|
||||
domNode = domNode.nextSibling();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -302,14 +302,12 @@ void DRW_Arc::applyExtrusion()
|
|||
{
|
||||
DRW_Circle::applyExtrusion();
|
||||
|
||||
if (haveExtrusion)
|
||||
{
|
||||
// If the extrusion vector has a z value less than 0, the angles for the arc
|
||||
// have to be mirrored since DXF files use the right hand rule.
|
||||
// Note that the following code only handles the special case where there is a 2D
|
||||
// drawing with the z axis heading into the paper (or rather screen). An arbitrary
|
||||
// extrusion axis (with x and y values greater than 1/64) may still have issues.
|
||||
if (fabs(extPoint.x) < 0.015625 && fabs(extPoint.y) < 0.015625 && extPoint.z < 0.0)
|
||||
if (haveExtrusion && fabs(extPoint.x) < 0.015625 && fabs(extPoint.y) < 0.015625 && extPoint.z < 0.0)
|
||||
{
|
||||
staangle = M_PI - staangle;
|
||||
endangle = M_PI - endangle;
|
||||
|
@ -319,7 +317,6 @@ void DRW_Arc::applyExtrusion()
|
|||
endangle = temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
auto DRW_Arc::parseCode(int code, const std::unique_ptr<dxfReader> &reader) -> bool
|
||||
{
|
||||
|
|
|
@ -677,9 +677,8 @@ void DRW_Header::write(const std::unique_ptr<dxfWriter> &writer, DRW::Version ve
|
|||
else
|
||||
writer->writeString(1, "STANDARD");
|
||||
// verify if exist "$DIMLUNIT" or obsolete "$DIMUNIT" (pre v2000)
|
||||
if (!getInt("$DIMLUNIT", &varInt))
|
||||
if (!getInt("$DIMLUNIT", &varInt) && !getInt("$DIMUNIT", &varInt))
|
||||
{
|
||||
if (!getInt("$DIMUNIT", &varInt))
|
||||
varInt = 2;
|
||||
}
|
||||
// verify valid values from 1 to 6
|
||||
|
|
|
@ -204,15 +204,12 @@ auto dxfRW::writeEntity(DRW_Entity *ent) -> bool
|
|||
if (version < DRW::AC1012)
|
||||
{
|
||||
int varInt = 0;
|
||||
if (header.getInt("$HANDLING", &varInt))
|
||||
{
|
||||
if (varInt != 0)
|
||||
if (header.getInt("$HANDLING", &varInt) && varInt != 0)
|
||||
{
|
||||
ent->handle = static_cast<duint32>(++entCount);
|
||||
writer->writeString(5, toHexStr(static_cast<int>(ent->handle)));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ent->handle = static_cast<duint32>(++entCount);
|
||||
|
@ -410,9 +407,7 @@ auto dxfRW::writeTextstyle(DRW_Textstyle *ent) -> bool
|
|||
// stringstream cause crash in OS/X, bug#3597944
|
||||
std::string name = ent->name;
|
||||
transform(name.begin(), name.end(), name.begin(), toupper);
|
||||
if (!dimstyleStd)
|
||||
{
|
||||
if (name == "STANDARD")
|
||||
if (!dimstyleStd && name == "STANDARD")
|
||||
{
|
||||
// stringstream cause crash in OS/X, bug#3597944
|
||||
std::string name = ent->name;
|
||||
|
@ -420,7 +415,6 @@ auto dxfRW::writeTextstyle(DRW_Textstyle *ent) -> bool
|
|||
if (name == "STANDARD")
|
||||
dimstyleStd = true;
|
||||
}
|
||||
}
|
||||
if (version > DRW::AC1009)
|
||||
{
|
||||
writer->writeString(5, toHexStr(++entCount));
|
||||
|
@ -679,16 +673,13 @@ auto dxfRW::writeDimstyle(DRW_Dimstyle *ent) -> bool
|
|||
writer->writeUtf8String(340, toHexStr(txstyHandle));
|
||||
}
|
||||
}
|
||||
if (version > DRW::AC1014)
|
||||
{
|
||||
if (blockMap.count(ent->dimldrblk) > 0)
|
||||
if (version > DRW::AC1014 && blockMap.count(ent->dimldrblk) > 0)
|
||||
{
|
||||
int const blkHandle = (*(blockMap.find(ent->dimldrblk))).second;
|
||||
writer->writeUtf8String(341, toHexStr(blkHandle));
|
||||
writer->writeInt16(371, ent->dimlwd);
|
||||
writer->writeInt16(372, ent->dimlwe);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -2639,14 +2630,11 @@ auto dxfRW::processLType() -> bool
|
|||
return true; // found ENDTAB terminate
|
||||
}
|
||||
}
|
||||
else if (reading)
|
||||
{
|
||||
if (!ltype.parseCode(code, reader))
|
||||
else if (reading && !ltype.parseCode(code, reader))
|
||||
{
|
||||
return setError(DRW::BAD_CODE_PARSED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return setError(DRW::BAD_READ_TABLES);
|
||||
}
|
||||
|
@ -2679,14 +2667,11 @@ auto dxfRW::processLayer() -> bool
|
|||
return true; // found ENDTAB terminate
|
||||
}
|
||||
}
|
||||
else if (reading)
|
||||
{
|
||||
if (!layer.parseCode(code, reader))
|
||||
else if (reading && !layer.parseCode(code, reader))
|
||||
{
|
||||
return setError(DRW::BAD_CODE_PARSED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return setError(DRW::BAD_READ_TABLES);
|
||||
}
|
||||
|
@ -2719,14 +2704,11 @@ auto dxfRW::processDimStyle() -> bool
|
|||
return true; // found ENDTAB terminate
|
||||
}
|
||||
}
|
||||
else if (reading)
|
||||
{
|
||||
if (!dimSty.parseCode(code, reader))
|
||||
else if (reading && !dimSty.parseCode(code, reader))
|
||||
{
|
||||
return setError(DRW::BAD_CODE_PARSED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return setError(DRW::BAD_READ_TABLES);
|
||||
}
|
||||
|
@ -2759,14 +2741,11 @@ auto dxfRW::processTextStyle() -> bool
|
|||
return true; // found ENDTAB terminate
|
||||
}
|
||||
}
|
||||
else if (reading)
|
||||
{
|
||||
if (!TxtSty.parseCode(code, reader))
|
||||
else if (reading && !TxtSty.parseCode(code, reader))
|
||||
{
|
||||
return setError(DRW::BAD_CODE_PARSED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return setError(DRW::BAD_READ_TABLES);
|
||||
}
|
||||
|
@ -2799,14 +2778,11 @@ auto dxfRW::processVports() -> bool
|
|||
return true; // found ENDTAB terminate
|
||||
}
|
||||
}
|
||||
else if (reading)
|
||||
{
|
||||
if (!vp.parseCode(code, reader))
|
||||
else if (reading && !vp.parseCode(code, reader))
|
||||
{
|
||||
return setError(DRW::BAD_CODE_PARSED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return setError(DRW::BAD_READ_TABLES);
|
||||
}
|
||||
|
@ -2839,14 +2815,11 @@ auto dxfRW::processAppId() -> bool
|
|||
return true; // found ENDTAB terminate
|
||||
}
|
||||
}
|
||||
else if (reading)
|
||||
{
|
||||
if (!vp.parseCode(code, reader))
|
||||
else if (reading && !vp.parseCode(code, reader))
|
||||
{
|
||||
return setError(DRW::BAD_CODE_PARSED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return setError(DRW::BAD_READ_TABLES);
|
||||
}
|
||||
|
|
|
@ -1047,9 +1047,8 @@ void VDxfEngine::ExportAAMANotch(const QSharedPointer<dx_ifaceBlock> &detailBloc
|
|||
{
|
||||
ExportNotch(passmark.baseLine.p1(), passmark.baseLine.length(), passmark.baseLine.angle());
|
||||
|
||||
if (!mirrorLine.isNull() && detail.IsShowFullPiece())
|
||||
{
|
||||
if (!VGObject::IsPointOnLineviaPDP(passmark.baseLine.p1(), mirrorLine.p1(), mirrorLine.p2()))
|
||||
if (!mirrorLine.isNull() && detail.IsShowFullPiece() &&
|
||||
!VGObject::IsPointOnLineviaPDP(passmark.baseLine.p1(), mirrorLine.p1(), mirrorLine.p2()))
|
||||
{
|
||||
const QTransform matrix = VGObject::FlippingMatrix(mirrorLine);
|
||||
QLineF const baseLine = matrix.map(passmark.baseLine);
|
||||
|
@ -1058,7 +1057,6 @@ void VDxfEngine::ExportAAMANotch(const QSharedPointer<dx_ifaceBlock> &detailBloc
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VDxfEngine::ExportAAMAGrainline(const QSharedPointer<dx_ifaceBlock> &detailBlock, const VLayoutPiece &detail)
|
||||
|
@ -1694,9 +1692,8 @@ void VDxfEngine::ExportASTMNotches(const QSharedPointer<dx_ifaceBlock> &detailBl
|
|||
ExportPassmark(passmark);
|
||||
|
||||
const QLineF mirrorLine = detail.GetMappedSeamMirrorLine();
|
||||
if (!mirrorLine.isNull() && detail.IsShowFullPiece())
|
||||
{
|
||||
if (!VGObject::IsPointOnLineviaPDP(passmark.baseLine.p1(), mirrorLine.p1(), mirrorLine.p2()))
|
||||
if (!mirrorLine.isNull() && detail.IsShowFullPiece() &&
|
||||
!VGObject::IsPointOnLineviaPDP(passmark.baseLine.p1(), mirrorLine.p1(), mirrorLine.p2()))
|
||||
{
|
||||
const QTransform matrix = VGObject::FlippingMatrix(mirrorLine);
|
||||
const VLayoutPassmark mirroredPassmark = VLayoutPiece::MapPassmark(passmark, matrix, false);
|
||||
|
@ -1705,7 +1702,6 @@ void VDxfEngine::ExportASTMNotches(const QSharedPointer<dx_ifaceBlock> &detailBl
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VDxfEngine::ExportASTMMirrorLine(const QSharedPointer<dx_ifaceBlock> &detailBlock, const VLayoutPiece &detail)
|
||||
|
@ -1776,15 +1772,13 @@ auto VDxfEngine::ExportASTMNotch(const VLayoutPassmark &passmark) -> DRW_ASTMNot
|
|||
notch->angle = passmark.baseLine.angle();
|
||||
|
||||
PassmarkLineType type = passmark.type;
|
||||
if (m_compatibilityMode == DXFApparelCompatibility::RPCADV08 ||
|
||||
if ((m_compatibilityMode == DXFApparelCompatibility::RPCADV08 ||
|
||||
m_compatibilityMode == DXFApparelCompatibility::RPCADV09 ||
|
||||
m_compatibilityMode == DXFApparelCompatibility::RPCADV10)
|
||||
{
|
||||
if (type == PassmarkLineType::ExternalVMark || type == PassmarkLineType::InternalVMark)
|
||||
m_compatibilityMode == DXFApparelCompatibility::RPCADV10) &&
|
||||
(type == PassmarkLineType::ExternalVMark || type == PassmarkLineType::InternalVMark))
|
||||
{
|
||||
type = PassmarkLineType::CheckMark;
|
||||
}
|
||||
}
|
||||
|
||||
switch (type)
|
||||
{
|
||||
|
|
|
@ -854,15 +854,12 @@ auto VMeasurements::MeasurementForDimension(IMD type) const -> QString
|
|||
|
||||
for (int i = 0; i < list.size(); ++i)
|
||||
{
|
||||
const QDomElement domElement = list.at(i).toElement();
|
||||
if (!domElement.isNull())
|
||||
{
|
||||
if (domElement.attribute(AttrDimension) == d)
|
||||
if (const QDomElement domElement = list.at(i).toElement();
|
||||
!domElement.isNull() && domElement.attribute(AttrDimension) == d)
|
||||
{
|
||||
return domElement.attribute(AttrName);
|
||||
}
|
||||
}
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
|
@ -1619,16 +1616,13 @@ void VMeasurements::ClearDimension(IMD type)
|
|||
|
||||
for (int i = 0; i < list.size(); ++i)
|
||||
{
|
||||
QDomElement domElement = list.at(i).toElement();
|
||||
if (!domElement.isNull())
|
||||
{
|
||||
if (domElement.attribute(AttrDimension) == d)
|
||||
if (QDomElement domElement = list.at(i).toElement();
|
||||
!domElement.isNull() && domElement.attribute(AttrDimension) == d)
|
||||
{
|
||||
domElement.removeAttribute(AttrDimension);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VMeasurements::ReadMeasurement(const QDomElement &dom, QSharedPointer<VContainer> &tempData,
|
||||
|
|
|
@ -239,15 +239,12 @@ auto PointBezier_r(qreal x1, qreal y1, qreal x2, qreal y2, qreal x3, qreal y3, q
|
|||
return points;
|
||||
}
|
||||
|
||||
if (m_cusp_limit > 0.0 || m_cusp_limit < 0.0)
|
||||
{
|
||||
if (da1 > m_cusp_limit)
|
||||
if ((m_cusp_limit > 0.0 || m_cusp_limit < 0.0) && da1 > m_cusp_limit)
|
||||
{
|
||||
points.append(QPointF(x3, y3));
|
||||
return points;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
|
@ -278,15 +275,12 @@ auto PointBezier_r(qreal x1, qreal y1, qreal x2, qreal y2, qreal x3, qreal y3, q
|
|||
return points;
|
||||
}
|
||||
|
||||
if (m_cusp_limit > 0.0 || m_cusp_limit < 0.0)
|
||||
{
|
||||
if (da1 > m_cusp_limit)
|
||||
if ((m_cusp_limit > 0.0 || m_cusp_limit < 0.0) && da1 > m_cusp_limit)
|
||||
{
|
||||
points.append(QPointF(x2, y2));
|
||||
return points;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
|
|
|
@ -528,9 +528,8 @@ void VHPGLEngine::PlotPassmarks(QTextStream &out, const VLayoutPiece &detail)
|
|||
PlotPassmark(passmark);
|
||||
|
||||
const QLineF mirrorLine = detail.GetMappedSeamMirrorLine();
|
||||
if (!mirrorLine.isNull() && detail.IsShowFullPiece())
|
||||
{
|
||||
if (!VGObject::IsPointOnLineviaPDP(passmark.baseLine.p1(), mirrorLine.p1(), mirrorLine.p2()))
|
||||
if (!mirrorLine.isNull() && detail.IsShowFullPiece() &&
|
||||
!VGObject::IsPointOnLineviaPDP(passmark.baseLine.p1(), mirrorLine.p1(), mirrorLine.p2()))
|
||||
{
|
||||
const QTransform matrix = VGObject::FlippingMatrix(mirrorLine);
|
||||
const VLayoutPassmark mirroredPassmark = VLayoutPiece::MapPassmark(passmark, matrix, false);
|
||||
|
@ -539,7 +538,6 @@ void VHPGLEngine::PlotPassmarks(QTextStream &out, const VLayoutPiece &detail)
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VHPGLEngine::PlotLabels(QTextStream &out, const VLayoutPiece &detail)
|
||||
|
|
|
@ -729,14 +729,11 @@ auto Rollback(QVector<VRawSAPoint> &points, const QLineF &edge) -> bool
|
|||
points.removeLast();
|
||||
points = VAbstractPiece::RollbackSeamAllowance(points, edge, &success);
|
||||
|
||||
if (not points.isEmpty())
|
||||
{
|
||||
if (points.constLast().toPoint() != points.constFirst().toPoint())
|
||||
if (not points.isEmpty() && points.constLast().toPoint() != points.constFirst().toPoint())
|
||||
{
|
||||
points.append(points.constFirst()); // Should be always closed
|
||||
}
|
||||
}
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
|
@ -866,15 +863,12 @@ void RollbackBySecondEdgeRightAngle(QVector<VRawSAPoint> &ekvPoints, const QVect
|
|||
}
|
||||
}
|
||||
|
||||
if (not ekvPoints.isEmpty())
|
||||
{
|
||||
if (ekvPoints.constLast().toPoint() != ekvPoints.constFirst().toPoint())
|
||||
if (not ekvPoints.isEmpty() && ekvPoints.constLast().toPoint() != ekvPoints.constFirst().toPoint())
|
||||
{
|
||||
ekvPoints.append(ekvPoints.constFirst()); // Should be always closed
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
||||
// Friend functions
|
||||
|
|
|
@ -370,15 +370,12 @@ inline auto VAbstractPiece::RemoveDublicates(const QVector<T> &points, bool remo
|
|||
}
|
||||
}
|
||||
|
||||
if (removeFirstAndLast)
|
||||
{
|
||||
if (not p.isEmpty() && p.size() > 1)
|
||||
if (removeFirstAndLast && not p.isEmpty() && p.size() > 1)
|
||||
{
|
||||
// Path can't be closed
|
||||
// See issue #686
|
||||
CompareFirstAndLastPoints(p, accuracy);
|
||||
}
|
||||
}
|
||||
|
||||
return p;
|
||||
}
|
||||
|
|
|
@ -1754,9 +1754,7 @@ auto VLayoutPiece::GetItem(bool textAsPaths, bool togetherWithNotches, bool show
|
|||
mirrorFlag = true;
|
||||
}
|
||||
}
|
||||
else if (not IsSeamAllowanceBuiltIn())
|
||||
{
|
||||
if (!d->m_seamAllowanceMirrorLine.isNull())
|
||||
else if (not IsSeamAllowanceBuiltIn() && !d->m_seamAllowanceMirrorLine.isNull())
|
||||
{
|
||||
QPainterPath mirrorPath;
|
||||
mirrorPath.moveTo(d->m_matrix.map(d->m_seamAllowanceMirrorLine.p1()));
|
||||
|
@ -1764,7 +1762,6 @@ auto VLayoutPiece::GetItem(bool textAsPaths, bool togetherWithNotches, bool show
|
|||
mirrorLinePath.addPath(mirrorPath);
|
||||
mirrorFlag = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (mirrorFlag)
|
||||
{
|
||||
|
|
|
@ -455,17 +455,15 @@ auto VPosition::Crossing(const VLayoutPiece &detail) const -> VPosition::Crossin
|
|||
|
||||
for (const auto &position : m_data.positionsCache)
|
||||
{
|
||||
if (position.boundingRect.intersects(layoutBoundingRect) ||
|
||||
position.boundingRect.contains(detailBoundingRect) || detailBoundingRect.contains(position.boundingRect))
|
||||
{
|
||||
if (position.layoutAllowancePath.contains(contourPath) ||
|
||||
contourPath.contains(position.layoutAllowancePath) ||
|
||||
position.layoutAllowancePath.intersects(layoutAllowancePath))
|
||||
if ((position.boundingRect.intersects(layoutBoundingRect) ||
|
||||
position.boundingRect.contains(detailBoundingRect) ||
|
||||
detailBoundingRect.contains(position.boundingRect)) &&
|
||||
(position.layoutAllowancePath.contains(contourPath) || contourPath.contains(position.layoutAllowancePath) ||
|
||||
position.layoutAllowancePath.intersects(layoutAllowancePath)))
|
||||
{
|
||||
return CrossingType::Intersection;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return CrossingType::NoIntersection;
|
||||
}
|
||||
|
|
|
@ -192,13 +192,10 @@ void VPrintLayout::PdfTiledFile(const QString &name)
|
|||
{
|
||||
m_isTiled = true;
|
||||
|
||||
if (m_isLayoutStale)
|
||||
{
|
||||
if (ContinueIfLayoutStale(m_parentWidget) == QMessageBox::No)
|
||||
if (m_isLayoutStale && ContinueIfLayoutStale(m_parentWidget) == QMessageBox::No)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
QPrinter printer;
|
||||
SetPrinterSettings(&printer, PrintType::PrintPDF, name);
|
||||
|
||||
|
@ -224,13 +221,10 @@ void VPrintLayout::CleanLayout()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPrintLayout::PrintLayout()
|
||||
{
|
||||
if (m_isLayoutStale)
|
||||
{
|
||||
if (ContinueIfLayoutStale(m_parentWidget) == QMessageBox::No)
|
||||
if (m_isLayoutStale && ContinueIfLayoutStale(m_parentWidget) == QMessageBox::No)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
// display print dialog and if accepted print
|
||||
QPrinterInfo info = QPrinterInfo::printerInfo(m_layoutPrinterName);
|
||||
if (info.isNull() || info.printerName().isEmpty())
|
||||
|
@ -269,13 +263,10 @@ void VPrintLayout::PrintLayout()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPrintLayout::PrintPreview()
|
||||
{
|
||||
if (m_isLayoutStale)
|
||||
{
|
||||
if (ContinueIfLayoutStale(m_parentWidget) == QMessageBox::No)
|
||||
if (m_isLayoutStale && ContinueIfLayoutStale(m_parentWidget) == QMessageBox::No)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
QPrinterInfo info = QPrinterInfo::printerInfo(m_layoutPrinterName);
|
||||
if (info.isNull() || info.printerName().isEmpty())
|
||||
|
@ -390,14 +381,11 @@ void VPrintLayout::PrintPages(QPrinter *printer)
|
|||
{
|
||||
for (int j = 0; j < numPages; ++j)
|
||||
{
|
||||
if (i != 0 || j != 0)
|
||||
{
|
||||
if (not printer->newPage())
|
||||
if ((i != 0 || j != 0) && not printer->newPage())
|
||||
{
|
||||
qCritical() << tr("Failed in flushing page to disk, disk full?");
|
||||
return;
|
||||
}
|
||||
}
|
||||
vsizetype index;
|
||||
if (printer->pageOrder() == QPrinter::FirstPageFirst)
|
||||
{
|
||||
|
|
|
@ -605,14 +605,11 @@ auto QxtCsvModel::toCSV(QIODevice *dest, QString &error, bool withHeader, QChar
|
|||
rows = rowCount();
|
||||
cols = columnCount();
|
||||
QString data;
|
||||
if (not dest->isOpen())
|
||||
{
|
||||
if (not dest->open(QIODevice::WriteOnly | QIODevice::Truncate))
|
||||
if (not dest->isOpen() && not dest->open(QIODevice::WriteOnly | QIODevice::Truncate))
|
||||
{
|
||||
error = dest->errorString();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
QTextStream stream(dest);
|
||||
|
||||
if (codec)
|
||||
|
|
|
@ -591,16 +591,13 @@ void VAbstractApplication::CheckSystemLocale()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VAbstractApplication::SVGFontsPathChanged(const QString &oldPath, const QString &newPath)
|
||||
{
|
||||
if (oldPath != newPath)
|
||||
{
|
||||
if (m_svgFontDatabase != nullptr)
|
||||
if (oldPath != newPath && m_svgFontDatabase != nullptr)
|
||||
{
|
||||
RestartSVGFontDatabaseWatcher();
|
||||
m_svgFontDatabase->InvalidatePath(oldPath);
|
||||
RepopulateFontDatabase(newPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VAbstractApplication::RepopulateFontDatabase(const QString &path)
|
||||
|
|
|
@ -240,9 +240,8 @@ auto VNodeDetail::Convert(const VContainer *data, const QVector<VNodeDetail> &no
|
|||
for (int i = 0; i < nodes.size(); ++i)
|
||||
{
|
||||
const VNodeDetail &node = nodes.at(i);
|
||||
if (node.getTypeTool() == Tool::NodePoint)
|
||||
{
|
||||
if (not qFuzzyIsNull(node.getMx()) || not qFuzzyIsNull(node.getMy()))
|
||||
if (node.getTypeTool() == Tool::NodePoint &&
|
||||
(not qFuzzyIsNull(node.getMx()) || not qFuzzyIsNull(node.getMy())))
|
||||
{
|
||||
const QPointF previosPoint = path.NodePreviousPoint(data, i);
|
||||
const QPointF nextPoint = path.NodeNextPoint(data, i);
|
||||
|
@ -263,7 +262,6 @@ auto VNodeDetail::Convert(const VContainer *data, const QVector<VNodeDetail> &no
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (not closed && path.CountNodes() > 1)
|
||||
{
|
||||
|
|
|
@ -365,9 +365,7 @@ auto VPiece::PassmarksPath(const VContainer *data) const -> QPainterPath
|
|||
QPainterPath path;
|
||||
|
||||
// seam allowence
|
||||
if (IsSeamAllowance())
|
||||
{
|
||||
if (not passmarks.isEmpty())
|
||||
if (IsSeamAllowance() && not passmarks.isEmpty())
|
||||
{
|
||||
for (qint32 i = 0; i < passmarks.count(); ++i)
|
||||
{
|
||||
|
@ -377,7 +375,6 @@ auto VPiece::PassmarksPath(const VContainer *data) const -> QPainterPath
|
|||
|
||||
path.setFillRule(Qt::WindingFill);
|
||||
}
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
|
|
|
@ -221,9 +221,7 @@ template <class T> inline auto VPiece::SeamAllowancePath(const QVector<T> &point
|
|||
QPainterPath ekv;
|
||||
|
||||
// seam allowence
|
||||
if (IsSeamAllowance() && not IsSeamAllowanceBuiltIn())
|
||||
{
|
||||
if (not points.isEmpty())
|
||||
if (IsSeamAllowance() && not IsSeamAllowanceBuiltIn() && not points.isEmpty())
|
||||
{
|
||||
ekv.moveTo(points.at(0));
|
||||
for (qint32 i = 1; i < points.count(); ++i)
|
||||
|
@ -250,7 +248,6 @@ template <class T> inline auto VPiece::SeamAllowancePath(const QVector<T> &point
|
|||
|
||||
ekv.setFillRule(Qt::WindingFill);
|
||||
}
|
||||
}
|
||||
|
||||
return ekv;
|
||||
}
|
||||
|
|
|
@ -156,14 +156,11 @@ auto VPE::VFileEditWidget::eventFilter(QObject *obj, QEvent *ev) -> bool
|
|||
ev->ignore();
|
||||
return true;
|
||||
}
|
||||
else if (obj == FileLineEdit)
|
||||
{
|
||||
if (ev->type() == QEvent::FocusOut)
|
||||
else if (obj == FileLineEdit && ev->type() == QEvent::FocusOut)
|
||||
{
|
||||
setFile(FileLineEdit->text(), true);
|
||||
// We don't return true here because we still want the line edit to catch the event as well
|
||||
}
|
||||
}
|
||||
|
||||
// forward the signal to the parent class
|
||||
return QWidget::eventFilter(obj, ev);
|
||||
|
|
|
@ -53,9 +53,7 @@ VPE::VShortcutEditWidget::~VShortcutEditWidget()
|
|||
|
||||
auto VPE::VShortcutEditWidget::eventFilter(QObject *obj, QEvent *event) -> bool
|
||||
{
|
||||
if (obj == LineEdit)
|
||||
{
|
||||
if (event->type() == QEvent::KeyPress)
|
||||
if (obj == LineEdit && event->type() == QEvent::KeyPress)
|
||||
{
|
||||
auto *keyEvent = static_cast<QKeyEvent *>(event);
|
||||
|
||||
|
@ -69,7 +67,6 @@ auto VPE::VShortcutEditWidget::eventFilter(QObject *obj, QEvent *event) -> bool
|
|||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return QWidget::eventFilter(obj, event);
|
||||
}
|
||||
|
|
|
@ -126,14 +126,11 @@ DialogEditWrongFormula::DialogEditWrongFormula(const VContainer *data, quint32 t
|
|||
|
||||
// Disable Qt::WaitCursor
|
||||
#ifndef QT_NO_CURSOR
|
||||
if (QGuiApplication::overrideCursor() != nullptr)
|
||||
{
|
||||
if (QGuiApplication::overrideCursor()->shape() == Qt::WaitCursor)
|
||||
if (QGuiApplication::overrideCursor() != nullptr && QGuiApplication::overrideCursor()->shape() == Qt::WaitCursor)
|
||||
{
|
||||
restoreCursor = true;
|
||||
QGuiApplication::restoreOverrideCursor();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
ui->tableWidget->setColumnCount(2);
|
||||
ui->tableWidget->setEditTriggers(QTableWidget::NoEditTriggers);
|
||||
|
|
|
@ -369,16 +369,12 @@ void DialogArc::SetRadius(const QString &value)
|
|||
*/
|
||||
void DialogArc::ChosenObject(quint32 id, const SceneObject &type)
|
||||
{
|
||||
if (not prepare) // After first choose we ignore all objects
|
||||
{
|
||||
if (type == SceneObject::Point)
|
||||
{
|
||||
if (SetObject(id, ui->comboBoxBasePoint, QString()))
|
||||
if (not prepare && type == SceneObject::Point &&
|
||||
SetObject(id, ui->comboBoxBasePoint, QString())) // After first choose we ignore all objects
|
||||
{
|
||||
if (vis != nullptr)
|
||||
{
|
||||
auto *window =
|
||||
qobject_cast<VAbstractMainWindow *>(VAbstractValApplication::VApp()->getMainWindow());
|
||||
auto *window = qobject_cast<VAbstractMainWindow *>(VAbstractValApplication::VApp()->getMainWindow());
|
||||
SCASSERT(window != nullptr)
|
||||
connect(vis.data(), &Visualization::ToolTip, window, &VAbstractMainWindow::ShowToolTip);
|
||||
|
||||
|
@ -394,8 +390,6 @@ void DialogArc::ChosenObject(quint32 id, const SceneObject &type)
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogArc::ShowVisualization()
|
||||
|
|
|
@ -353,16 +353,12 @@ void DialogArcWithLength::ShowDialog(bool click)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogArcWithLength::ChosenObject(quint32 id, const SceneObject &type)
|
||||
{
|
||||
if (not prepare) // After first choose we ignore all objects
|
||||
{
|
||||
if (type == SceneObject::Point)
|
||||
{
|
||||
if (SetObject(id, ui->comboBoxCenter, QString()))
|
||||
if (not prepare && type == SceneObject::Point &&
|
||||
SetObject(id, ui->comboBoxCenter, QString())) // After first choose we ignore all objects
|
||||
{
|
||||
if (vis != nullptr)
|
||||
{
|
||||
auto *window =
|
||||
qobject_cast<VAbstractMainWindow *>(VAbstractValApplication::VApp()->getMainWindow());
|
||||
auto *window = qobject_cast<VAbstractMainWindow *>(VAbstractValApplication::VApp()->getMainWindow());
|
||||
SCASSERT(window != nullptr)
|
||||
connect(vis.data(), &Visualization::ToolTip, window, &VAbstractMainWindow::ShowToolTip);
|
||||
|
||||
|
@ -378,8 +374,6 @@ void DialogArcWithLength::ChosenObject(quint32 id, const SceneObject &type)
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogArcWithLength::DeployRadiusTextEdit()
|
||||
|
|
|
@ -213,15 +213,13 @@ void DialogBisector::ChosenObject(quint32 id, const SceneObject &type)
|
|||
}
|
||||
break;
|
||||
case 1:
|
||||
if (getCurrentObjectId(ui->comboBoxFirstPoint) != id)
|
||||
{
|
||||
if (SetObject(id, ui->comboBoxSecondPoint, tr("Select third point of angle")))
|
||||
if (getCurrentObjectId(ui->comboBoxFirstPoint) != id &&
|
||||
SetObject(id, ui->comboBoxSecondPoint, tr("Select third point of angle")))
|
||||
{
|
||||
m_number++;
|
||||
line->SetPoint2Id(id);
|
||||
line->RefreshGeometry();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
ChosenThirdPoint(id);
|
||||
|
@ -439,9 +437,7 @@ void DialogBisector::ChosenThirdPoint(quint32 id)
|
|||
set.insert(getCurrentObjectId(ui->comboBoxSecondPoint));
|
||||
set.insert(id);
|
||||
|
||||
if (set.size() == 3)
|
||||
{
|
||||
if (SetObject(id, ui->comboBoxThirdPoint, QString()))
|
||||
if (set.size() == 3 && SetObject(id, ui->comboBoxThirdPoint, QString()))
|
||||
{
|
||||
auto *window = qobject_cast<VAbstractMainWindow *>(VAbstractValApplication::VApp()->getMainWindow());
|
||||
SCASSERT(window != nullptr)
|
||||
|
@ -460,7 +456,6 @@ void DialogBisector::ChosenThirdPoint(quint32 id)
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogBisector::FinishCreating()
|
||||
|
|
|
@ -122,9 +122,7 @@ void DialogCubicBezier::SetSpline(const VCubicBezier &spline)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogCubicBezier::ChosenObject(quint32 id, const SceneObject &type)
|
||||
{
|
||||
if (prepare == false) // After first choose we ignore all objects
|
||||
{
|
||||
if (type == SceneObject::Point)
|
||||
if (prepare == false && type == SceneObject::Point) // After first choose we ignore all objects
|
||||
{
|
||||
auto *path = qobject_cast<VisToolCubicBezier *>(vis);
|
||||
SCASSERT(path != nullptr)
|
||||
|
@ -157,9 +155,7 @@ void DialogCubicBezier::ChosenObject(quint32 id, const SceneObject &type)
|
|||
}
|
||||
break;
|
||||
case 3:
|
||||
if (getCurrentObjectId(ui->comboBoxP1) != id)
|
||||
{
|
||||
if (SetObject(id, ui->comboBoxP4, QString()))
|
||||
if (getCurrentObjectId(ui->comboBoxP1) != id && SetObject(id, ui->comboBoxP4, QString()))
|
||||
{
|
||||
++number;
|
||||
|
||||
|
@ -168,14 +164,12 @@ void DialogCubicBezier::ChosenObject(quint32 id, const SceneObject &type)
|
|||
prepare = true;
|
||||
DialogAccepted();
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogCubicBezier::PointNameChanged()
|
||||
|
|
|
@ -190,10 +190,9 @@ void DialogCubicBezierPath::ShowDialog(bool click)
|
|||
}
|
||||
|
||||
const auto size = path.CountPoints();
|
||||
if (size >= 7)
|
||||
if (size >= 7 && size - VCubicBezierPath::SubSplPointsCount(path.CountSubSpl()) == 0)
|
||||
{
|
||||
if (size - VCubicBezierPath::SubSplPointsCount(path.CountSubSpl()) == 0)
|
||||
{ // Accept only if all subpaths are completed
|
||||
// Accept only if all subpaths are completed
|
||||
emit ToolTip(QString());
|
||||
|
||||
if (not data->IsUnique(path.name()))
|
||||
|
@ -204,7 +203,6 @@ void DialogCubicBezierPath::ShowDialog(bool click)
|
|||
DialogAccepted();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogCubicBezierPath::ShowVisualization()
|
||||
|
|
|
@ -261,10 +261,9 @@ void DialogCurveIntersectAxis::ChosenObject(quint32 id, const SceneObject &type)
|
|||
switch (number)
|
||||
{
|
||||
case (0):
|
||||
if (type == SceneObject::Spline || type == SceneObject::Arc || type == SceneObject::ElArc ||
|
||||
type == SceneObject::SplinePath)
|
||||
{
|
||||
if (SetObject(id, ui->comboBoxCurve, tr("Select axis point")))
|
||||
if ((type == SceneObject::Spline || type == SceneObject::Arc || type == SceneObject::ElArc ||
|
||||
type == SceneObject::SplinePath) &&
|
||||
SetObject(id, ui->comboBoxCurve, tr("Select axis point")))
|
||||
{
|
||||
number++;
|
||||
line->VisualMode(id);
|
||||
|
@ -273,12 +272,9 @@ void DialogCurveIntersectAxis::ChosenObject(quint32 id, const SceneObject &type)
|
|||
SCASSERT(window != nullptr)
|
||||
connect(line, &VisToolCurveIntersectAxis::ToolTip, window, &VAbstractMainWindow::ShowToolTip);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case (1):
|
||||
if (type == SceneObject::Point)
|
||||
{
|
||||
if (SetObject(id, ui->comboBoxAxisPoint, QString()))
|
||||
if (type == SceneObject::Point && SetObject(id, ui->comboBoxAxisPoint, QString()))
|
||||
{
|
||||
line->setAxisPointId(id);
|
||||
line->RefreshGeometry();
|
||||
|
@ -292,7 +288,6 @@ void DialogCurveIntersectAxis::ChosenObject(quint32 id, const SceneObject &type)
|
|||
show();
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -172,9 +172,7 @@ void DialogCutArc::ChosenObject(quint32 id, const SceneObject &type)
|
|||
return;
|
||||
}
|
||||
|
||||
if (type == SceneObject::Arc)
|
||||
{
|
||||
if (SetObject(id, ui->comboBoxArc, QString()))
|
||||
if (type == SceneObject::Arc && SetObject(id, ui->comboBoxArc, QString()))
|
||||
{
|
||||
if (vis != nullptr)
|
||||
{
|
||||
|
@ -206,7 +204,6 @@ void DialogCutArc::ChosenObject(quint32 id, const SceneObject &type)
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogCutArc::SaveData()
|
||||
|
|
|
@ -175,9 +175,7 @@ void DialogCutSpline::ChosenObject(quint32 id, const SceneObject &type)
|
|||
return;
|
||||
}
|
||||
|
||||
if (type == SceneObject::Spline)
|
||||
{
|
||||
if (SetObject(id, ui->comboBoxSpline, QString()))
|
||||
if (type == SceneObject::Spline && SetObject(id, ui->comboBoxSpline, QString()))
|
||||
{
|
||||
if (vis != nullptr)
|
||||
{
|
||||
|
@ -195,7 +193,6 @@ void DialogCutSpline::ChosenObject(quint32 id, const SceneObject &type)
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogCutSpline::SaveData()
|
||||
|
|
|
@ -175,9 +175,7 @@ void DialogCutSplinePath::ChosenObject(quint32 id, const SceneObject &type)
|
|||
return;
|
||||
}
|
||||
|
||||
if (type == SceneObject::SplinePath)
|
||||
{
|
||||
if (SetObject(id, ui->comboBoxSplinePath, QString()))
|
||||
if (type == SceneObject::SplinePath && SetObject(id, ui->comboBoxSplinePath, QString()))
|
||||
{
|
||||
if (vis != nullptr)
|
||||
{
|
||||
|
@ -195,7 +193,6 @@ void DialogCutSplinePath::ChosenObject(quint32 id, const SceneObject &type)
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogCutSplinePath::SaveData()
|
||||
|
|
|
@ -206,11 +206,8 @@ void DialogEndLine::FXLength()
|
|||
*/
|
||||
void DialogEndLine::ChosenObject(quint32 id, const SceneObject &type)
|
||||
{
|
||||
if (not prepare) // After first choose we ignore all objects
|
||||
{
|
||||
if (type == SceneObject::Point)
|
||||
{
|
||||
if (SetObject(id, ui->comboBoxBasePoint, QString()))
|
||||
if (not prepare && type == SceneObject::Point &&
|
||||
SetObject(id, ui->comboBoxBasePoint, QString())) // After first choose we ignore all objects
|
||||
{
|
||||
if (vis != nullptr)
|
||||
{
|
||||
|
@ -227,8 +224,6 @@ void DialogEndLine::ChosenObject(quint32 id, const SceneObject &type)
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
|
|
|
@ -260,9 +260,7 @@ void DialogFlippingByAxis::SetSourceObjects(const QVector<SourceItem> &value)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogFlippingByAxis::ChosenObject(quint32 id, const SceneObject &type)
|
||||
{
|
||||
if (not stage1 && not prepare) // After first choose we ignore all objects
|
||||
{
|
||||
if (type == SceneObject::Point)
|
||||
if (not stage1 && not prepare && type == SceneObject::Point) // After first choose we ignore all objects
|
||||
{
|
||||
auto obj = std::find_if(sourceObjects.begin(), sourceObjects.end(),
|
||||
[id](const SourceItem &sItem) { return sItem.id == id; });
|
||||
|
@ -284,7 +282,6 @@ void DialogFlippingByAxis::ChosenObject(quint32 id, const SceneObject &type)
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogFlippingByAxis::SelectedObject(bool selected, quint32 object, quint32 tool)
|
||||
|
|
|
@ -253,9 +253,7 @@ void DialogFlippingByLine::SetSourceObjects(const QVector<SourceItem> &value)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogFlippingByLine::ChosenObject(quint32 id, const SceneObject &type)
|
||||
{
|
||||
if (not stage1 && not prepare) // After first choose we ignore all objects
|
||||
{
|
||||
if (type == SceneObject::Point)
|
||||
if (not stage1 && not prepare && type == SceneObject::Point) // After first choose we ignore all objects
|
||||
{
|
||||
auto obj = std::find_if(sourceObjects.begin(), sourceObjects.end(),
|
||||
[id](const SourceItem &sItem) { return sItem.id == id; });
|
||||
|
@ -284,11 +282,8 @@ void DialogFlippingByLine::ChosenObject(quint32 id, const SceneObject &type)
|
|||
return;
|
||||
}
|
||||
|
||||
if (getCurrentObjectId(ui->comboBoxFirstLinePoint) != id)
|
||||
{
|
||||
if (SetObject(id, ui->comboBoxSecondLinePoint, QString()))
|
||||
{
|
||||
if (flagError)
|
||||
if (getCurrentObjectId(ui->comboBoxFirstLinePoint) != id &&
|
||||
SetObject(id, ui->comboBoxSecondLinePoint, QString()) && flagError)
|
||||
{
|
||||
number = 0;
|
||||
prepare = true;
|
||||
|
@ -298,15 +293,12 @@ void DialogFlippingByLine::ChosenObject(quint32 id, const SceneObject &type)
|
|||
operation->SetSecondLinePointId(id);
|
||||
operation->RefreshGeometry();
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogFlippingByLine::SelectedObject(bool selected, quint32 object, quint32 tool)
|
||||
|
|
|
@ -208,15 +208,13 @@ void DialogHeight::ChosenObject(quint32 id, const SceneObject &type)
|
|||
}
|
||||
break;
|
||||
case (1):
|
||||
if (getCurrentObjectId(ui->comboBoxBasePoint) != id)
|
||||
{
|
||||
if (SetObject(id, ui->comboBoxP1Line, tr("Select second point of line")))
|
||||
if (getCurrentObjectId(ui->comboBoxBasePoint) != id &&
|
||||
SetObject(id, ui->comboBoxP1Line, tr("Select second point of line")))
|
||||
{
|
||||
m_number++;
|
||||
line->SetLineP1Id(id);
|
||||
line->RefreshGeometry();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case (2):
|
||||
{
|
||||
|
@ -225,9 +223,7 @@ void DialogHeight::ChosenObject(quint32 id, const SceneObject &type)
|
|||
set.insert(getCurrentObjectId(ui->comboBoxP1Line));
|
||||
set.insert(id);
|
||||
|
||||
if (set.size() == 3)
|
||||
{
|
||||
if (SetObject(id, ui->comboBoxP2Line, QString()))
|
||||
if (set.size() == 3 && SetObject(id, ui->comboBoxP2Line, QString()))
|
||||
{
|
||||
line->SetLineP2Id(id);
|
||||
line->RefreshGeometry();
|
||||
|
@ -235,7 +231,6 @@ void DialogHeight::ChosenObject(quint32 id, const SceneObject &type)
|
|||
DialogAccepted();
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -178,9 +178,7 @@ void DialogLine::SaveData()
|
|||
*/
|
||||
void DialogLine::ChosenObject(quint32 id, const SceneObject &type)
|
||||
{
|
||||
if (prepare == false) // After first choose we ignore all objects
|
||||
{
|
||||
if (type == SceneObject::Point)
|
||||
if (prepare == false && type == SceneObject::Point) // After first choose we ignore all objects
|
||||
{
|
||||
switch (number)
|
||||
{
|
||||
|
@ -195,25 +193,19 @@ void DialogLine::ChosenObject(quint32 id, const SceneObject &type)
|
|||
}
|
||||
break;
|
||||
case 1:
|
||||
if (getCurrentObjectId(ui->comboBoxFirstPoint) != id)
|
||||
{
|
||||
if (SetObject(id, ui->comboBoxSecondPoint, QString()))
|
||||
{
|
||||
if (flagError)
|
||||
if (getCurrentObjectId(ui->comboBoxFirstPoint) != id &&
|
||||
SetObject(id, ui->comboBoxSecondPoint, QString()) && flagError)
|
||||
{
|
||||
number = 0;
|
||||
prepare = true;
|
||||
DialogAccepted();
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
|
|
|
@ -108,9 +108,7 @@ DialogLineIntersect::~DialogLineIntersect()
|
|||
*/
|
||||
void DialogLineIntersect::ChosenObject(quint32 id, const SceneObject &type)
|
||||
{
|
||||
if (prepare == false) // After first choose we ignore all objects
|
||||
{
|
||||
if (type == SceneObject::Point)
|
||||
if (prepare == false && type == SceneObject::Point) // After first choose we ignore all objects
|
||||
{
|
||||
auto *line = qobject_cast<VisToolLineIntersect *>(vis);
|
||||
SCASSERT(line != nullptr)
|
||||
|
@ -125,15 +123,13 @@ void DialogLineIntersect::ChosenObject(quint32 id, const SceneObject &type)
|
|||
}
|
||||
break;
|
||||
case 1:
|
||||
if (getCurrentObjectId(ui->comboBoxP1Line1) != id)
|
||||
{
|
||||
if (SetObject(id, ui->comboBoxP2Line1, tr("Select first point of second line")))
|
||||
if (getCurrentObjectId(ui->comboBoxP1Line1) != id &&
|
||||
SetObject(id, ui->comboBoxP2Line1, tr("Select first point of second line")))
|
||||
{
|
||||
number++;
|
||||
line->SetLine1P2Id(id);
|
||||
line->RefreshGeometry();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (SetObject(id, ui->comboBoxP1Line2, tr("Select second point of second line")))
|
||||
|
@ -151,9 +147,7 @@ void DialogLineIntersect::ChosenObject(quint32 id, const SceneObject &type)
|
|||
set.insert(getCurrentObjectId(ui->comboBoxP1Line2));
|
||||
set.insert(id);
|
||||
|
||||
if (set.size() >= 3)
|
||||
{
|
||||
if (SetObject(id, ui->comboBoxP2Line2, QString()))
|
||||
if (set.size() >= 3 && SetObject(id, ui->comboBoxP2Line2, QString()))
|
||||
{
|
||||
line->SetLine2P2Id(id);
|
||||
line->RefreshGeometry();
|
||||
|
@ -179,14 +173,12 @@ void DialogLineIntersect::ChosenObject(quint32 id, const SceneObject &type)
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogLineIntersect::SaveData()
|
||||
|
|
|
@ -277,9 +277,7 @@ void DialogLineIntersectAxis::ShowDialog(bool click)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogLineIntersectAxis::ChosenObject(quint32 id, const SceneObject &type)
|
||||
{
|
||||
if (prepare == false) // After first choose we ignore all objects
|
||||
{
|
||||
if (type == SceneObject::Point)
|
||||
if (prepare == false && type == SceneObject::Point) // After first choose we ignore all objects
|
||||
{
|
||||
auto *line = qobject_cast<VisToolLineIntersectAxis *>(vis);
|
||||
SCASSERT(line != nullptr)
|
||||
|
@ -298,15 +296,13 @@ void DialogLineIntersectAxis::ChosenObject(quint32 id, const SceneObject &type)
|
|||
}
|
||||
break;
|
||||
case (1):
|
||||
if (getCurrentObjectId(ui->comboBoxFirstLinePoint) != id)
|
||||
{
|
||||
if (SetObject(id, ui->comboBoxSecondLinePoint, tr("Select axis point")))
|
||||
if (getCurrentObjectId(ui->comboBoxFirstLinePoint) != id &&
|
||||
SetObject(id, ui->comboBoxSecondLinePoint, tr("Select axis point")))
|
||||
{
|
||||
number++;
|
||||
line->SetPoint2Id(id);
|
||||
line->RefreshGeometry();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case (2):
|
||||
{
|
||||
|
@ -315,9 +311,7 @@ void DialogLineIntersectAxis::ChosenObject(quint32 id, const SceneObject &type)
|
|||
set.insert(getCurrentObjectId(ui->comboBoxSecondLinePoint));
|
||||
set.insert(id);
|
||||
|
||||
if (set.size() == 3)
|
||||
{
|
||||
if (SetObject(id, ui->comboBoxAxisPoint, QString()))
|
||||
if (set.size() == 3 && SetObject(id, ui->comboBoxAxisPoint, QString()))
|
||||
{
|
||||
line->SetAxisPointId(id);
|
||||
line->RefreshGeometry();
|
||||
|
@ -331,14 +325,12 @@ void DialogLineIntersectAxis::ChosenObject(quint32 id, const SceneObject &type)
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogLineIntersectAxis::EvalAngle()
|
||||
|
|
|
@ -402,11 +402,9 @@ void DialogMove::ShowDialog(bool click)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogMove::ChosenObject(quint32 id, const SceneObject &type)
|
||||
{
|
||||
if (not stage1 && stage2 && prepare) // After first choose we ignore all objects
|
||||
{
|
||||
if (type == SceneObject::Point && QGuiApplication::keyboardModifiers() == Qt::ControlModifier)
|
||||
{
|
||||
if (SetObject(id, ui->comboBoxRotationOriginPoint, QString()))
|
||||
if (not stage1 && stage2 && prepare && type == SceneObject::Point &&
|
||||
QGuiApplication::keyboardModifiers() == Qt::ControlModifier &&
|
||||
SetObject(id, ui->comboBoxRotationOriginPoint, QString())) // After first choose we ignore all objects
|
||||
{
|
||||
auto *operation = qobject_cast<VisToolMove *>(vis);
|
||||
SCASSERT(operation != nullptr)
|
||||
|
@ -416,8 +414,6 @@ void DialogMove::ChosenObject(quint32 id, const SceneObject &type)
|
|||
optionalRotationOrigin = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogMove::SelectedObject(bool selected, quint32 object, quint32 tool)
|
||||
|
|
|
@ -218,9 +218,8 @@ void DialogNormal::ChosenObject(quint32 id, const SceneObject &type)
|
|||
}
|
||||
break;
|
||||
case 1:
|
||||
if (getCurrentObjectId(ui->comboBoxFirstPoint) != id)
|
||||
{
|
||||
if (SetObject(id, ui->comboBoxSecondPoint, QString()))
|
||||
if (getCurrentObjectId(ui->comboBoxFirstPoint) != id &&
|
||||
SetObject(id, ui->comboBoxSecondPoint, QString()))
|
||||
{
|
||||
line->SetPoint2Id(id);
|
||||
line->RefreshGeometry();
|
||||
|
@ -236,7 +235,6 @@ void DialogNormal::ChosenObject(quint32 id, const SceneObject &type)
|
|||
FinishCreating();
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -145,9 +145,8 @@ void DialogPointFromArcAndTangent::SetCrossCirclesPoint(CrossCirclesPoint p)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPointFromArcAndTangent::ChosenObject(quint32 id, const SceneObject &type)
|
||||
{
|
||||
if (prepare == false) // After first choose we ignore all objects
|
||||
{
|
||||
if (type == SceneObject::Point || type == SceneObject::Arc)
|
||||
if (prepare == false &&
|
||||
(type == SceneObject::Point || type == SceneObject::Arc)) // After first choose we ignore all objects
|
||||
{
|
||||
auto *point = qobject_cast<VisToolPointFromArcAndTangent *>(vis);
|
||||
SCASSERT(point != nullptr)
|
||||
|
@ -155,19 +154,14 @@ void DialogPointFromArcAndTangent::ChosenObject(quint32 id, const SceneObject &t
|
|||
switch (number)
|
||||
{
|
||||
case 0:
|
||||
if (type == SceneObject::Point)
|
||||
{
|
||||
if (SetObject(id, ui->comboBoxTangentPoint, tr("Select an arc")))
|
||||
if (type == SceneObject::Point && SetObject(id, ui->comboBoxTangentPoint, tr("Select an arc")))
|
||||
{
|
||||
number++;
|
||||
point->VisualMode(id);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (type == SceneObject::Arc)
|
||||
{
|
||||
if (SetObject(id, ui->comboBoxArc, QString()))
|
||||
if (type == SceneObject::Arc && SetObject(id, ui->comboBoxArc, QString()))
|
||||
{
|
||||
number = 0;
|
||||
point->SetArcId(id);
|
||||
|
@ -175,14 +169,12 @@ void DialogPointFromArcAndTangent::ChosenObject(quint32 id, const SceneObject &t
|
|||
prepare = true;
|
||||
DialogAccepted();
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPointFromArcAndTangent::ShowVisualization()
|
||||
|
|
|
@ -254,9 +254,8 @@ void DialogPointFromCircleAndTangent::ChosenObject(quint32 id, const SceneObject
|
|||
}
|
||||
break;
|
||||
case 1:
|
||||
if (getCurrentObjectId(ui->comboBoxTangentPoint) != id)
|
||||
{
|
||||
if (SetObject(id, ui->comboBoxCircleCenter, QString()))
|
||||
if (getCurrentObjectId(ui->comboBoxTangentPoint) != id &&
|
||||
SetObject(id, ui->comboBoxCircleCenter, QString()))
|
||||
{
|
||||
auto *window =
|
||||
qobject_cast<VAbstractMainWindow *>(VAbstractValApplication::VApp()->getMainWindow());
|
||||
|
@ -273,7 +272,6 @@ void DialogPointFromCircleAndTangent::ChosenObject(quint32 id, const SceneObject
|
|||
FinishCreating();
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -244,15 +244,13 @@ void DialogPointOfContact::ChosenObject(quint32 id, const SceneObject &type)
|
|||
}
|
||||
break;
|
||||
case 1:
|
||||
if (getCurrentObjectId(ui->comboBoxFirstPoint) != id)
|
||||
{
|
||||
if (SetObject(id, ui->comboBoxSecondPoint, tr("Select point of center of arc")))
|
||||
if (getCurrentObjectId(ui->comboBoxFirstPoint) != id &&
|
||||
SetObject(id, ui->comboBoxSecondPoint, tr("Select point of center of arc")))
|
||||
{
|
||||
m_number++;
|
||||
line->SetLineP2Id(id);
|
||||
line->RefreshGeometry();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
|
@ -261,12 +259,9 @@ void DialogPointOfContact::ChosenObject(quint32 id, const SceneObject &type)
|
|||
set.insert(getCurrentObjectId(ui->comboBoxSecondPoint));
|
||||
set.insert(id);
|
||||
|
||||
if (set.size() == 3)
|
||||
if (set.size() == 3 && SetObject(id, ui->comboBoxCenter, QString()))
|
||||
{
|
||||
if (SetObject(id, ui->comboBoxCenter, QString()))
|
||||
{
|
||||
auto *window =
|
||||
qobject_cast<VAbstractMainWindow *>(VAbstractValApplication::VApp()->getMainWindow());
|
||||
auto *window = qobject_cast<VAbstractMainWindow *>(VAbstractValApplication::VApp()->getMainWindow());
|
||||
SCASSERT(window != nullptr)
|
||||
connect(line, &Visualization::ToolTip, window, &VAbstractMainWindow::ShowToolTip);
|
||||
|
||||
|
@ -280,7 +275,6 @@ void DialogPointOfContact::ChosenObject(quint32 id, const SceneObject &type)
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -117,9 +117,7 @@ void DialogPointOfIntersection::SetSecondPointId(quint32 value)
|
|||
*/
|
||||
void DialogPointOfIntersection::ChosenObject(quint32 id, const SceneObject &type)
|
||||
{
|
||||
if (prepare == false) // After first choose we ignore all objects
|
||||
{
|
||||
if (type == SceneObject::Point)
|
||||
if (prepare == false && type == SceneObject::Point) // After first choose we ignore all objects
|
||||
{
|
||||
auto *line = qobject_cast<VisToolPointOfIntersection *>(vis);
|
||||
SCASSERT(line != nullptr)
|
||||
|
@ -135,23 +133,20 @@ void DialogPointOfIntersection::ChosenObject(quint32 id, const SceneObject &type
|
|||
}
|
||||
break;
|
||||
case 1:
|
||||
if (getCurrentObjectId(ui->comboBoxFirstPoint) != id)
|
||||
{
|
||||
if (SetObject(id, ui->comboBoxSecondPoint, QString()))
|
||||
if (getCurrentObjectId(ui->comboBoxFirstPoint) != id &&
|
||||
SetObject(id, ui->comboBoxSecondPoint, QString()))
|
||||
{
|
||||
line->SetPoint2Id(id);
|
||||
line->RefreshGeometry();
|
||||
prepare = true;
|
||||
DialogAccepted();
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPointOfIntersection::SaveData()
|
||||
|
|
|
@ -150,9 +150,7 @@ void DialogPointOfIntersectionArcs::SetCrossArcPoint(CrossCirclesPoint p)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPointOfIntersectionArcs::ChosenObject(quint32 id, const SceneObject &type)
|
||||
{
|
||||
if (prepare == false) // After first choose we ignore all objects
|
||||
{
|
||||
if (type == SceneObject::Arc)
|
||||
if (prepare == false && type == SceneObject::Arc) // After first choose we ignore all objects
|
||||
{
|
||||
auto *point = qobject_cast<VisToolPointOfIntersectionArcs *>(vis);
|
||||
SCASSERT(point != nullptr)
|
||||
|
@ -167,9 +165,7 @@ void DialogPointOfIntersectionArcs::ChosenObject(quint32 id, const SceneObject &
|
|||
}
|
||||
break;
|
||||
case 1:
|
||||
if (getCurrentObjectId(ui->comboBoxArc1) != id)
|
||||
{
|
||||
if (SetObject(id, ui->comboBoxArc2, QString()))
|
||||
if (getCurrentObjectId(ui->comboBoxArc1) != id && SetObject(id, ui->comboBoxArc2, QString()))
|
||||
{
|
||||
number = 0;
|
||||
point->SetArc2Id(id);
|
||||
|
@ -177,14 +173,12 @@ void DialogPointOfIntersectionArcs::ChosenObject(quint32 id, const SceneObject &
|
|||
prepare = true;
|
||||
DialogAccepted();
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPointOfIntersectionArcs::ArcChanged()
|
||||
|
|
|
@ -330,9 +330,8 @@ void DialogPointOfIntersectionCircles::ChosenObject(quint32 id, const SceneObjec
|
|||
}
|
||||
break;
|
||||
case 2:
|
||||
if (getCurrentObjectId(ui->comboBoxCircle1Center) != id)
|
||||
{
|
||||
if (SetObject(id, ui->comboBoxCircle2Center, QString()))
|
||||
if (getCurrentObjectId(ui->comboBoxCircle1Center) != id &&
|
||||
SetObject(id, ui->comboBoxCircle2Center, QString()))
|
||||
{
|
||||
point->SetCircle2Id(id);
|
||||
point->RefreshGeometry();
|
||||
|
@ -345,7 +344,6 @@ void DialogPointOfIntersectionCircles::ChosenObject(quint32 id, const SceneObjec
|
|||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -178,10 +178,8 @@ void DialogPointOfIntersectionCurves::SetHCrossPoint(HCrossCurvesPoint hP)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPointOfIntersectionCurves::ChosenObject(quint32 id, const SceneObject &type)
|
||||
{
|
||||
if (prepare == false) // After first choose we ignore all objects
|
||||
{
|
||||
if (type == SceneObject::Spline || type == SceneObject::Arc || type == SceneObject::ElArc ||
|
||||
type == SceneObject::SplinePath)
|
||||
if (prepare == false && (type == SceneObject::Spline || type == SceneObject::Arc || type == SceneObject::ElArc ||
|
||||
type == SceneObject::SplinePath)) // After first choose we ignore all objects
|
||||
{
|
||||
auto *point = qobject_cast<VisToolPointOfIntersectionCurves *>(vis);
|
||||
SCASSERT(point != nullptr)
|
||||
|
@ -196,9 +194,7 @@ void DialogPointOfIntersectionCurves::ChosenObject(quint32 id, const SceneObject
|
|||
}
|
||||
break;
|
||||
case 1:
|
||||
if (getCurrentObjectId(ui->comboBoxCurve1) != id)
|
||||
{
|
||||
if (SetObject(id, ui->comboBoxCurve2, QString()))
|
||||
if (getCurrentObjectId(ui->comboBoxCurve1) != id && SetObject(id, ui->comboBoxCurve2, QString()))
|
||||
{
|
||||
number = 0;
|
||||
point->SetCurve2Id(id);
|
||||
|
@ -206,14 +202,12 @@ void DialogPointOfIntersectionCurves::ChosenObject(quint32 id, const SceneObject
|
|||
prepare = true;
|
||||
DialogAccepted();
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPointOfIntersectionCurves::ShowVisualization()
|
||||
|
|
|
@ -321,9 +321,7 @@ void DialogRotation::SetSourceObjects(const QVector<SourceItem> &value)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogRotation::ChosenObject(quint32 id, const SceneObject &type)
|
||||
{
|
||||
if (not stage1 && not prepare) // After first choose we ignore all objects
|
||||
{
|
||||
if (type == SceneObject::Point)
|
||||
if (not stage1 && not prepare && type == SceneObject::Point) // After first choose we ignore all objects
|
||||
{
|
||||
auto *operation = qobject_cast<VisToolRotation *>(vis);
|
||||
SCASSERT(operation != nullptr)
|
||||
|
@ -360,7 +358,6 @@ void DialogRotation::ChosenObject(quint32 id, const SceneObject &type)
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogRotation::SelectedObject(bool selected, quint32 object, quint32 tool)
|
||||
|
|
|
@ -212,15 +212,13 @@ void DialogShoulderPoint::ChosenObject(quint32 id, const SceneObject &type)
|
|||
}
|
||||
break;
|
||||
case 1:
|
||||
if (getCurrentObjectId(ui->comboBoxP3) != id)
|
||||
{
|
||||
if (SetObject(id, ui->comboBoxP1Line, tr("Select second point of line")))
|
||||
if (getCurrentObjectId(ui->comboBoxP3) != id &&
|
||||
SetObject(id, ui->comboBoxP1Line, tr("Select second point of line")))
|
||||
{
|
||||
m_number++;
|
||||
line->SetLineP1Id(id);
|
||||
line->RefreshGeometry();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
ChosenThirdPoint(id);
|
||||
|
@ -281,9 +279,7 @@ void DialogShoulderPoint::ChosenThirdPoint(quint32 id)
|
|||
set.insert(getCurrentObjectId(ui->comboBoxP1Line));
|
||||
set.insert(id);
|
||||
|
||||
if (set.size() == 3)
|
||||
{
|
||||
if (SetObject(id, ui->comboBoxP2Line, QString()))
|
||||
if (set.size() == 3 && SetObject(id, ui->comboBoxP2Line, QString()))
|
||||
{
|
||||
auto *window = qobject_cast<VAbstractMainWindow *>(VAbstractValApplication::VApp()->getMainWindow());
|
||||
SCASSERT(window != nullptr)
|
||||
|
@ -302,7 +298,6 @@ void DialogShoulderPoint::ChosenThirdPoint(quint32 id)
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogShoulderPoint::FinishCreating()
|
||||
|
|
|
@ -159,9 +159,7 @@ DialogSpline::~DialogSpline()
|
|||
*/
|
||||
void DialogSpline::ChosenObject(quint32 id, const SceneObject &type)
|
||||
{
|
||||
if (!prepare) // After first choose we ignore all objects
|
||||
{
|
||||
if (type == SceneObject::Point)
|
||||
if (!prepare && type == SceneObject::Point) // After first choose we ignore all objects
|
||||
{
|
||||
auto *path = qobject_cast<VisToolSpline *>(vis);
|
||||
SCASSERT(path != nullptr)
|
||||
|
@ -177,9 +175,7 @@ void DialogSpline::ChosenObject(quint32 id, const SceneObject &type)
|
|||
break;
|
||||
case 1:
|
||||
{
|
||||
if (getCurrentObjectId(ui->comboBoxP1) != id)
|
||||
{
|
||||
if (SetObject(id, ui->comboBoxP4, QString()))
|
||||
if (getCurrentObjectId(ui->comboBoxP1) != id && SetObject(id, ui->comboBoxP4, QString()))
|
||||
{
|
||||
++number;
|
||||
|
||||
|
@ -187,7 +183,6 @@ void DialogSpline::ChosenObject(quint32 id, const SceneObject &type)
|
|||
path->RefreshGeometry();
|
||||
prepare = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -195,7 +190,6 @@ void DialogSpline::ChosenObject(quint32 id, const SceneObject &type)
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSpline::SaveData()
|
||||
|
|
|
@ -207,14 +207,11 @@ void DialogTool::FillComboBoxSplines(QComboBox *box) const
|
|||
QMap<QString, quint32> list;
|
||||
for (i = objs->constBegin(); i != objs->constEnd(); ++i)
|
||||
{
|
||||
if (i.key() != toolId)
|
||||
{
|
||||
if (IsSpline(i.value()))
|
||||
if (i.key() != toolId && IsSpline(i.value()))
|
||||
{
|
||||
PrepareList<VAbstractCurve>(list, i.key());
|
||||
}
|
||||
}
|
||||
}
|
||||
FillList(box, list);
|
||||
box->setCurrentIndex(-1); // force to select
|
||||
box->blockSignals(false);
|
||||
|
@ -231,14 +228,11 @@ void DialogTool::FillComboBoxSplinesPath(QComboBox *box) const
|
|||
QMap<QString, quint32> list;
|
||||
for (i = objs->constBegin(); i != objs->constEnd(); ++i)
|
||||
{
|
||||
if (i.key() != toolId)
|
||||
{
|
||||
if (IsSplinePath(i.value()))
|
||||
if (i.key() != toolId && IsSplinePath(i.value()))
|
||||
{
|
||||
PrepareList<VAbstractCurve>(list, i.key());
|
||||
}
|
||||
}
|
||||
}
|
||||
FillList(box, list);
|
||||
box->setCurrentIndex(-1); // force to select
|
||||
box->blockSignals(false);
|
||||
|
|
|
@ -99,9 +99,7 @@ DialogTriangle::~DialogTriangle()
|
|||
*/
|
||||
void DialogTriangle::ChosenObject(quint32 id, const SceneObject &type)
|
||||
{
|
||||
if (prepare == false) // After first choose we ignore all objects
|
||||
{
|
||||
if (type == SceneObject::Point)
|
||||
if (prepare == false && type == SceneObject::Point) // After first choose we ignore all objects
|
||||
{
|
||||
auto *line = qobject_cast<VisToolTriangle *>(vis);
|
||||
SCASSERT(line != nullptr)
|
||||
|
@ -116,15 +114,13 @@ void DialogTriangle::ChosenObject(quint32 id, const SceneObject &type)
|
|||
}
|
||||
break;
|
||||
case (1):
|
||||
if (getCurrentObjectId(ui->comboBoxAxisP1) != id)
|
||||
{
|
||||
if (SetObject(id, ui->comboBoxAxisP2, tr("Select first point")))
|
||||
if (getCurrentObjectId(ui->comboBoxAxisP1) != id &&
|
||||
SetObject(id, ui->comboBoxAxisP2, tr("Select first point")))
|
||||
{
|
||||
number++;
|
||||
line->SetObject2Id(id);
|
||||
line->RefreshGeometry();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case (2):
|
||||
{
|
||||
|
@ -133,16 +129,13 @@ void DialogTriangle::ChosenObject(quint32 id, const SceneObject &type)
|
|||
set.insert(getCurrentObjectId(ui->comboBoxAxisP2));
|
||||
set.insert(id);
|
||||
|
||||
if (set.size() == 3)
|
||||
{
|
||||
if (SetObject(id, ui->comboBoxFirstPoint, tr("Select second point")))
|
||||
if (set.size() == 3 && SetObject(id, ui->comboBoxFirstPoint, tr("Select second point")))
|
||||
{
|
||||
number++;
|
||||
line->SetHypotenuseP1Id(id);
|
||||
line->RefreshGeometry();
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case (3):
|
||||
{
|
||||
|
@ -152,9 +145,7 @@ void DialogTriangle::ChosenObject(quint32 id, const SceneObject &type)
|
|||
set.insert(getCurrentObjectId(ui->comboBoxFirstPoint));
|
||||
set.insert(id);
|
||||
|
||||
if (set.size() == 4)
|
||||
{
|
||||
if (SetObject(id, ui->comboBoxSecondPoint, QString()))
|
||||
if (set.size() == 4 && SetObject(id, ui->comboBoxSecondPoint, QString()))
|
||||
{
|
||||
line->SetHypotenuseP2Id(id);
|
||||
line->RefreshGeometry();
|
||||
|
@ -162,14 +153,12 @@ void DialogTriangle::ChosenObject(quint32 id, const SceneObject &type)
|
|||
DialogAccepted();
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogTriangle::SaveData()
|
||||
|
|
|
@ -217,9 +217,7 @@ void DialogTrueDarts::SetChildrenId(const quint32 &ch1, const quint32 &ch2)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogTrueDarts::ChosenObject(quint32 id, const SceneObject &type)
|
||||
{
|
||||
if (prepare == false) // After first choose we ignore all objects
|
||||
{
|
||||
if (type == SceneObject::Point)
|
||||
if (prepare == false && type == SceneObject::Point) // After first choose we ignore all objects
|
||||
{
|
||||
auto *points = qobject_cast<VisToolTrueDarts *>(vis);
|
||||
SCASSERT(points != nullptr)
|
||||
|
@ -234,15 +232,13 @@ void DialogTrueDarts::ChosenObject(quint32 id, const SceneObject &type)
|
|||
}
|
||||
break;
|
||||
case 1:
|
||||
if (getCurrentObjectId(ui->comboBoxFirstBasePoint) != id)
|
||||
{
|
||||
if (SetObject(id, ui->comboBoxSecondBasePoint, tr("Select the first dart point")))
|
||||
if (getCurrentObjectId(ui->comboBoxFirstBasePoint) != id &&
|
||||
SetObject(id, ui->comboBoxSecondBasePoint, tr("Select the first dart point")))
|
||||
{
|
||||
number++;
|
||||
points->SetBaseLineP2Id(id);
|
||||
points->RefreshGeometry();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
|
@ -251,15 +247,12 @@ void DialogTrueDarts::ChosenObject(quint32 id, const SceneObject &type)
|
|||
set.insert(getCurrentObjectId(ui->comboBoxSecondBasePoint));
|
||||
set.insert(id);
|
||||
|
||||
if (set.size() == 3)
|
||||
{
|
||||
if (SetObject(id, ui->comboBoxFirstDartPoint, tr("Select the second dart point")))
|
||||
if (set.size() == 3 && SetObject(id, ui->comboBoxFirstDartPoint, tr("Select the second dart point")))
|
||||
{
|
||||
number++;
|
||||
points->SetD1PointId(id);
|
||||
points->RefreshGeometry();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
|
@ -270,15 +263,12 @@ void DialogTrueDarts::ChosenObject(quint32 id, const SceneObject &type)
|
|||
set.insert(getCurrentObjectId(ui->comboBoxFirstDartPoint));
|
||||
set.insert(id);
|
||||
|
||||
if (set.size() == 4)
|
||||
{
|
||||
if (SetObject(id, ui->comboBoxSecondDartPoint, tr("Select the third dart point")))
|
||||
if (set.size() == 4 && SetObject(id, ui->comboBoxSecondDartPoint, tr("Select the third dart point")))
|
||||
{
|
||||
number++;
|
||||
points->SetD2PointId(id);
|
||||
points->RefreshGeometry();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
|
@ -290,16 +280,13 @@ void DialogTrueDarts::ChosenObject(quint32 id, const SceneObject &type)
|
|||
set.insert(getCurrentObjectId(ui->comboBoxSecondDartPoint));
|
||||
set.insert(id);
|
||||
|
||||
if (set.size() == 5)
|
||||
{
|
||||
if (SetObject(id, ui->comboBoxThirdDartPoint, QString()))
|
||||
if (set.size() == 5 && SetObject(id, ui->comboBoxThirdDartPoint, QString()))
|
||||
{
|
||||
points->SetD3PointId(id);
|
||||
points->RefreshGeometry();
|
||||
prepare = true;
|
||||
DialogAccepted();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -307,7 +294,6 @@ void DialogTrueDarts::ChosenObject(quint32 id, const SceneObject &type)
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogTrueDarts::PointNameChanged()
|
||||
|
|
|
@ -133,9 +133,7 @@ auto DialogUnionDetails::CheckDetail(const quint32 &idDetail) const -> bool
|
|||
*/
|
||||
void DialogUnionDetails::ChoosedDetail(const quint32 &id, const SceneObject &type, quint32 &idDetail, vsizetype &index)
|
||||
{
|
||||
if (idDetail == NULL_ID)
|
||||
{
|
||||
if (type == SceneObject::Detail)
|
||||
if (idDetail == NULL_ID && type == SceneObject::Detail)
|
||||
{
|
||||
if (CheckDetail(id))
|
||||
{
|
||||
|
@ -147,7 +145,6 @@ void DialogUnionDetails::ChoosedDetail(const quint32 &id, const SceneObject &typ
|
|||
emit ToolTip(tr("Workpiece should have at least two points and three objects"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (not CheckObject(id, idDetail))
|
||||
{
|
||||
|
|
|
@ -55,9 +55,7 @@ DialogDuplicateDetail::~DialogDuplicateDetail()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogDuplicateDetail::ShowDialog(bool click)
|
||||
{
|
||||
if (prepare)
|
||||
{
|
||||
if (click)
|
||||
if (prepare && click)
|
||||
{
|
||||
// The check need to ignore first release of mouse button.
|
||||
// User should have chance to place piece.
|
||||
|
@ -76,14 +74,11 @@ void DialogDuplicateDetail::ShowDialog(bool click)
|
|||
DialogAccepted();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogDuplicateDetail::ChosenObject(quint32 id, const SceneObject &type)
|
||||
{
|
||||
if (prepare == false) // After first choose we ignore all objects
|
||||
{
|
||||
if (type == SceneObject::Detail && id > NULL_ID)
|
||||
if (prepare == false && type == SceneObject::Detail && id > NULL_ID) // After first choose we ignore all objects
|
||||
{
|
||||
m_idDetail = id;
|
||||
|
||||
|
@ -101,4 +96,3 @@ void DialogDuplicateDetail::ChosenObject(quint32 id, const SceneObject &type)
|
|||
prepare = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -211,9 +211,7 @@ void DialogPiecePath::ChosenObject(quint32 id, const SceneObject &type)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPiecePath::ShowDialog(bool click)
|
||||
{
|
||||
if (not click)
|
||||
{
|
||||
if (CreatePath().CountNodes() > 0)
|
||||
if (not click && CreatePath().CountNodes() > 0)
|
||||
{
|
||||
emit ToolTip(QString());
|
||||
prepare = true;
|
||||
|
@ -229,7 +227,6 @@ void DialogPiecePath::ShowDialog(bool click)
|
|||
show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPiecePath::CheckState()
|
||||
|
|
|
@ -122,11 +122,7 @@ void DialogPin::SetPiecesList(const QVector<quint32> &list)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPin::ChosenObject(quint32 id, const SceneObject &type)
|
||||
{
|
||||
if (not prepare)
|
||||
{
|
||||
if (type == SceneObject::Point)
|
||||
{
|
||||
if (SetObject(id, ui->comboBoxPoint, QString()))
|
||||
if (not prepare && type == SceneObject::Point && SetObject(id, ui->comboBoxPoint, QString()))
|
||||
{
|
||||
if (vis != nullptr)
|
||||
{
|
||||
|
@ -138,8 +134,6 @@ void DialogPin::ChosenObject(quint32 id, const SceneObject &type)
|
|||
this->show();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPin::ShowVisualization()
|
||||
|
|
|
@ -244,11 +244,7 @@ void DialogPlaceLabel::SetPiecesList(const QVector<quint32> &list)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPlaceLabel::ChosenObject(quint32 id, const SceneObject &type)
|
||||
{
|
||||
if (not prepare)
|
||||
{
|
||||
if (type == SceneObject::Point)
|
||||
{
|
||||
if (SetObject(id, ui->comboBoxPoint, QString()))
|
||||
if (not prepare && type == SceneObject::Point && SetObject(id, ui->comboBoxPoint, QString()))
|
||||
{
|
||||
if (vis != nullptr)
|
||||
{
|
||||
|
@ -265,8 +261,6 @@ void DialogPlaceLabel::ChosenObject(quint32 id, const SceneObject &type)
|
|||
this->show();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPlaceLabel::ShowVisualization()
|
||||
|
|
|
@ -312,13 +312,11 @@ void VBackgroundImageItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
|||
|
||||
if (not Image().Hold())
|
||||
{
|
||||
if (flags() & QGraphicsItem::ItemIsMovable)
|
||||
{
|
||||
if (event->button() == Qt::LeftButton && event->type() != QEvent::GraphicsSceneMouseDoubleClick)
|
||||
if (flags() & QGraphicsItem::ItemIsMovable && event->button() == Qt::LeftButton &&
|
||||
event->type() != QEvent::GraphicsSceneMouseDoubleClick)
|
||||
{
|
||||
SetItemOverrideCursor(this, cursorArrowCloseHand, 1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (event->button() == Qt::LeftButton && event->type() != QEvent::GraphicsSceneMouseDoubleClick)
|
||||
{
|
||||
|
@ -589,13 +587,10 @@ void VBackgroundImageItem::MakeFresh() const
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VBackgroundImageItem::DeleteToolWithConfirm(bool ask)
|
||||
{
|
||||
if (ask)
|
||||
{
|
||||
if (ConfirmDeletion() == QMessageBox::No)
|
||||
if (ask && ConfirmDeletion() == QMessageBox::No)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
emit ActivateControls(QUuid());
|
||||
emit DeleteImage(m_image.Id());
|
||||
|
|
|
@ -388,36 +388,26 @@ void VToolSpline::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolSpline::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
if (flags() & QGraphicsItem::ItemIsMovable)
|
||||
{
|
||||
if (event->button() == Qt::LeftButton && event->type() != QEvent::GraphicsSceneMouseDoubleClick)
|
||||
{
|
||||
if (IsMovable())
|
||||
if (flags() & QGraphicsItem::ItemIsMovable && event->button() == Qt::LeftButton &&
|
||||
event->type() != QEvent::GraphicsSceneMouseDoubleClick && IsMovable())
|
||||
{
|
||||
SetItemOverrideCursor(this, cursorArrowCloseHand, 1, 1);
|
||||
oldPosition = event->scenePos();
|
||||
event->accept();
|
||||
}
|
||||
}
|
||||
}
|
||||
VAbstractSpline::mousePressEvent(event);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolSpline::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
if (flags() & QGraphicsItem::ItemIsMovable)
|
||||
{
|
||||
if (event->button() == Qt::LeftButton && event->type() != QEvent::GraphicsSceneMouseDoubleClick)
|
||||
{
|
||||
if (IsMovable())
|
||||
if (flags() & QGraphicsItem::ItemIsMovable && event->button() == Qt::LeftButton &&
|
||||
event->type() != QEvent::GraphicsSceneMouseDoubleClick && IsMovable())
|
||||
{
|
||||
SetItemOverrideCursor(this, cursorArrowOpenHand, 1, 1);
|
||||
|
||||
CurveReleased();
|
||||
}
|
||||
}
|
||||
}
|
||||
VAbstractSpline::mouseReleaseEvent(event);
|
||||
}
|
||||
|
||||
|
|
|
@ -594,9 +594,8 @@ void VToolSplinePath::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &ob
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolSplinePath::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
if (flags() & QGraphicsItem::ItemIsMovable)
|
||||
{
|
||||
if (event->button() == Qt::LeftButton && event->type() != QEvent::GraphicsSceneMouseDoubleClick)
|
||||
if (flags() & QGraphicsItem::ItemIsMovable && event->button() == Qt::LeftButton &&
|
||||
event->type() != QEvent::GraphicsSceneMouseDoubleClick)
|
||||
{
|
||||
oldPosition = event->scenePos();
|
||||
const auto splPath = VAbstractTool::data.GeometricObject<VSplinePath>(m_id);
|
||||
|
@ -607,23 +606,20 @@ void VToolSplinePath::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
|||
event->accept();
|
||||
}
|
||||
}
|
||||
}
|
||||
VAbstractSpline::mousePressEvent(event);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolSplinePath::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
if (flags() & QGraphicsItem::ItemIsMovable)
|
||||
{
|
||||
if (event->button() == Qt::LeftButton && event->type() != QEvent::GraphicsSceneMouseDoubleClick)
|
||||
if (flags() & QGraphicsItem::ItemIsMovable && event->button() == Qt::LeftButton &&
|
||||
event->type() != QEvent::GraphicsSceneMouseDoubleClick)
|
||||
{
|
||||
oldPosition = event->scenePos();
|
||||
SetItemOverrideCursor(this, cursorArrowOpenHand, 1, 1);
|
||||
|
||||
CurveReleased();
|
||||
}
|
||||
}
|
||||
VAbstractSpline::mouseReleaseEvent(event);
|
||||
}
|
||||
|
||||
|
|
|
@ -295,27 +295,23 @@ void VToolBasePoint::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolBasePoint::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
if (flags() & QGraphicsItem::ItemIsMovable)
|
||||
{
|
||||
if (event->button() == Qt::LeftButton && event->type() != QEvent::GraphicsSceneMouseDoubleClick)
|
||||
if (flags() & QGraphicsItem::ItemIsMovable && event->button() == Qt::LeftButton &&
|
||||
event->type() != QEvent::GraphicsSceneMouseDoubleClick)
|
||||
{
|
||||
SetItemOverrideCursor(this, cursorArrowCloseHand, 1, 1);
|
||||
event->accept();
|
||||
}
|
||||
}
|
||||
VToolSinglePoint::mousePressEvent(event);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolBasePoint::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
if (flags() & QGraphicsItem::ItemIsMovable)
|
||||
{
|
||||
if (event->button() == Qt::LeftButton && event->type() != QEvent::GraphicsSceneMouseDoubleClick)
|
||||
if (flags() & QGraphicsItem::ItemIsMovable && event->button() == Qt::LeftButton &&
|
||||
event->type() != QEvent::GraphicsSceneMouseDoubleClick)
|
||||
{
|
||||
SetItemOverrideCursor(this, cursorArrowOpenHand, 1, 1);
|
||||
}
|
||||
}
|
||||
VToolSinglePoint::mouseReleaseEvent(event);
|
||||
}
|
||||
|
||||
|
|
|
@ -242,13 +242,10 @@ void VToolSinglePoint::FullUpdateFromFile()
|
|||
*/
|
||||
void VToolSinglePoint::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
if (selectionType == SelectionType::ByMouseRelease)
|
||||
{
|
||||
if (IsSelectedByReleaseEvent(this, event))
|
||||
if (selectionType == SelectionType::ByMouseRelease && IsSelectedByReleaseEvent(this, event))
|
||||
{
|
||||
PointChoosed();
|
||||
}
|
||||
}
|
||||
VScenePoint::mouseReleaseEvent(event);
|
||||
}
|
||||
|
||||
|
|
|
@ -965,28 +965,19 @@ void VToolSeamAllowance::ResetChildren(QGraphicsItem *pItem)
|
|||
const bool selected = isSelected();
|
||||
const VPiece detail = VAbstractTool::data.GetPiece(m_id);
|
||||
auto *pVGI = qgraphicsitem_cast<VTextGraphicsItem *>(pItem);
|
||||
if (pVGI != m_dataLabel)
|
||||
{
|
||||
if (detail.GetPieceLabelData().IsVisible())
|
||||
if (pVGI != m_dataLabel && detail.GetPieceLabelData().IsVisible())
|
||||
{
|
||||
m_dataLabel->Reset();
|
||||
}
|
||||
}
|
||||
if (pVGI != m_patternInfo)
|
||||
{
|
||||
if (detail.GetPatternLabelData().IsVisible())
|
||||
if (pVGI != m_patternInfo && detail.GetPatternLabelData().IsVisible())
|
||||
{
|
||||
m_patternInfo->Reset();
|
||||
}
|
||||
}
|
||||
auto *pGLI = qgraphicsitem_cast<VGrainlineItem *>(pItem);
|
||||
if (pGLI != m_grainLine)
|
||||
{
|
||||
if (detail.GetGrainlineGeometry().IsVisible())
|
||||
if (pGLI != m_grainLine && detail.GetGrainlineGeometry().IsVisible())
|
||||
{
|
||||
m_grainLine->Reset();
|
||||
}
|
||||
}
|
||||
|
||||
setSelected(selected);
|
||||
update();
|
||||
|
@ -1456,13 +1447,11 @@ void VToolSeamAllowance::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
|||
scene()->clearSelection();
|
||||
}
|
||||
|
||||
if (flags() & QGraphicsItem::ItemIsMovable)
|
||||
{
|
||||
if (event->button() == Qt::LeftButton && event->type() != QEvent::GraphicsSceneMouseDoubleClick)
|
||||
if (flags() & QGraphicsItem::ItemIsMovable && event->button() == Qt::LeftButton &&
|
||||
event->type() != QEvent::GraphicsSceneMouseDoubleClick)
|
||||
{
|
||||
SetItemOverrideCursor(this, cursorArrowCloseHand, 1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (selectionType == SelectionType::ByMouseRelease)
|
||||
{
|
||||
|
@ -1488,14 +1477,11 @@ void VToolSeamAllowance::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
|||
SetItemOverrideCursor(this, cursorArrowOpenHand, 1, 1);
|
||||
}
|
||||
|
||||
if (selectionType == SelectionType::ByMouseRelease)
|
||||
{
|
||||
if (IsSelectedByReleaseEvent(this, event))
|
||||
if (selectionType == SelectionType::ByMouseRelease && IsSelectedByReleaseEvent(this, event))
|
||||
{
|
||||
doc->SelectedDetail(m_id);
|
||||
emit ChoosedTool(m_id, SceneObject::Detail);
|
||||
}
|
||||
}
|
||||
QGraphicsPathItem::mouseReleaseEvent(event);
|
||||
}
|
||||
|
||||
|
@ -2433,13 +2419,10 @@ void VToolSeamAllowance::InitSpecialPoints(const QVector<quint32> &points) const
|
|||
void VToolSeamAllowance::DeleteToolWithConfirm(bool ask)
|
||||
{
|
||||
std::unique_ptr<DeletePiece> delDet(new DeletePiece(doc, m_id, VAbstractTool::data, m_sceneDetails));
|
||||
if (ask)
|
||||
{
|
||||
if (ConfirmDeletion() == QMessageBox::No)
|
||||
if (ask && ConfirmDeletion() == QMessageBox::No)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
VAbstractApplication::VApp()->getUndoStack()->push(delDet.release());
|
||||
|
||||
|
|
|
@ -316,9 +316,7 @@ void FancyTabBar::mouseMoveEvent(QMouseEvent *e)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto FancyTabBar::event(QEvent *event) -> bool
|
||||
{
|
||||
if (event->type() == QEvent::ToolTip)
|
||||
{
|
||||
if (ValidIndex(m_hoverIndex))
|
||||
if (event->type() == QEvent::ToolTip && ValidIndex(m_hoverIndex))
|
||||
{
|
||||
QString const tt = TabToolTip(m_hoverIndex);
|
||||
if (!tt.isEmpty())
|
||||
|
@ -327,7 +325,6 @@ auto FancyTabBar::event(QEvent *event) -> bool
|
|||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return QWidget::event(event);
|
||||
}
|
||||
|
||||
|
|
|
@ -925,9 +925,7 @@ void ColorPickerPopup::showEvent(QShowEvent *)
|
|||
for (int j = 0; j < grid->rowCount(); ++j)
|
||||
{
|
||||
QWidget *w = widgetAt[j][i];
|
||||
if (w && w->inherits("ColorPickerItem"))
|
||||
{
|
||||
if (static_cast<ColorPickerItem *>(w)->isSelected())
|
||||
if (w && w->inherits("ColorPickerItem") && static_cast<ColorPickerItem *>(w)->isSelected())
|
||||
{
|
||||
w->setFocus();
|
||||
foundSelected = true;
|
||||
|
@ -935,7 +933,6 @@ void ColorPickerPopup::showEvent(QShowEvent *)
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!foundSelected)
|
||||
{
|
||||
|
|
|
@ -209,14 +209,12 @@ void VControlPointSpline::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VControlPointSpline::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
if (event->button() == Qt::LeftButton && event->type() != QEvent::GraphicsSceneMouseDoubleClick)
|
||||
{
|
||||
if (freeAngle || freeLength)
|
||||
if (event->button() == Qt::LeftButton && event->type() != QEvent::GraphicsSceneMouseDoubleClick &&
|
||||
(freeAngle || freeLength))
|
||||
{
|
||||
SetItemOverrideCursor(this, cursorArrowOpenHand, 1, 1);
|
||||
emit Released();
|
||||
}
|
||||
}
|
||||
VScenePoint::mouseReleaseEvent(event);
|
||||
}
|
||||
|
||||
|
|
|
@ -290,14 +290,12 @@ void VGraphicsSimpleTextItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
|||
scene()->clearSelection();
|
||||
}
|
||||
|
||||
if (flags() & QGraphicsItem::ItemIsMovable)
|
||||
{
|
||||
if (event->button() == Qt::LeftButton && event->type() != QEvent::GraphicsSceneMouseDoubleClick)
|
||||
if (flags() & QGraphicsItem::ItemIsMovable && event->button() == Qt::LeftButton &&
|
||||
event->type() != QEvent::GraphicsSceneMouseDoubleClick)
|
||||
{
|
||||
SetItemOverrideCursor(this, cursorArrowCloseHand, 1, 1);
|
||||
event->accept();
|
||||
}
|
||||
}
|
||||
if (selectionType == SelectionType::ByMouseRelease)
|
||||
{
|
||||
event->accept(); // This help for not selectable items still receive mouseReleaseEvent events
|
||||
|
@ -315,13 +313,11 @@ void VGraphicsSimpleTextItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VGraphicsSimpleTextItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
if (flags() & QGraphicsItem::ItemIsMovable)
|
||||
{
|
||||
if (event->button() == Qt::LeftButton && event->type() != QEvent::GraphicsSceneMouseDoubleClick)
|
||||
if (flags() & QGraphicsItem::ItemIsMovable && event->button() == Qt::LeftButton &&
|
||||
event->type() != QEvent::GraphicsSceneMouseDoubleClick)
|
||||
{
|
||||
SetItemOverrideCursor(this, cursorArrowOpenHand, 1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (selectionType == SelectionType::ByMouseRelease && IsSelectedByReleaseEvent(this, event))
|
||||
{
|
||||
|
|
|
@ -162,16 +162,13 @@ void TST_AbstractRegExp::CallTestCheckNoOriginalNamesInTranslation()
|
|||
static const auto names = ConvertToSet<QString>(originalNames);
|
||||
|
||||
const QString translated = m_trMs->VarToUser(originalName);
|
||||
if (names.contains(translated))
|
||||
{
|
||||
if (originalName != translated)
|
||||
if (names.contains(translated) && originalName != translated)
|
||||
{
|
||||
const QString message = u"Translation repeat original name from other place. "
|
||||
"Original name:'%1', translated name:'%2'"_s.arg(originalName, translated);
|
||||
QFAIL(qUtf8Printable(message));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void TST_AbstractRegExp::CallTestForValidCharacters()
|
||||
|
|
|
@ -324,15 +324,12 @@ void TST_TSLocaleTranslation::TestHTMLTags()
|
|||
|
||||
for (const auto ®ex : regexes)
|
||||
{
|
||||
if (source.contains(regex.first))
|
||||
{
|
||||
if (not translation.contains(regex.second) || translation.count(regex.second) != source.count(regex.first))
|
||||
if (source.contains(regex.first) &&
|
||||
(not translation.contains(regex.second) || translation.count(regex.second) != source.count(regex.first)))
|
||||
{
|
||||
const QString message = u"Tag mismatch. Pattern: '<%1>'. "_s.arg(regex.first.pattern()) +
|
||||
u"Original name:'%1'"_s.arg(source) +
|
||||
u", translated name:'%1'"_s.arg(translation);
|
||||
u"Original name:'%1'"_s.arg(source) + u", translated name:'%1'"_s.arg(translation);
|
||||
QFAIL(qUtf8Printable(message));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user