diff --git a/src/app/container/vcontainer.cpp b/src/app/container/vcontainer.cpp index 7cf541dc1..7684cc398 100644 --- a/src/app/container/vcontainer.cpp +++ b/src/app/container/vcontainer.cpp @@ -93,7 +93,7 @@ void VContainer::setData(const VContainer &data) qDeleteAll(gObjects); gObjects.clear(); const QHash *obj = data.DataGObjects(); - Q_CHECK_PTR(obj); + SCASSERT(obj != nullptr); QHashIterator i(*obj); while (i.hasNext()) { @@ -331,7 +331,7 @@ template void VContainer::UpdateObject(QHash &obj, const quint32 &id, val point) { Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0"); - Q_CHECK_PTR(point); + SCASSERT(point != nullptr); point->setId(id); if (gObjects.contains(id)) { @@ -543,7 +543,7 @@ void VContainer::AddLine(const quint32 &firstPointId, const quint32 &secondPoint template quint32 VContainer::AddObject(QHash &obj, val value) { - Q_CHECK_PTR(value); + SCASSERT(value != nullptr); quint32 id = getNextId(); value->setId(id); obj[id] = value; diff --git a/src/app/container/vcontainer.h b/src/app/container/vcontainer.h index 94ce7ded4..b98af16aa 100644 --- a/src/app/container/vcontainer.h +++ b/src/app/container/vcontainer.h @@ -73,7 +73,7 @@ public: try { T obj = dynamic_cast(gObj); - Q_CHECK_PTR(obj); + SCASSERT(obj != nullptr); return obj; } catch (const std::bad_alloc &) diff --git a/src/app/dialogs/app/dialoghistory.cpp b/src/app/dialogs/app/dialoghistory.cpp index a6c452fe3..a60bbe272 100644 --- a/src/app/dialogs/app/dialoghistory.cpp +++ b/src/app/dialogs/app/dialoghistory.cpp @@ -129,7 +129,7 @@ void DialogHistory::FillTable() { ui->tableWidget->clear(); const QVector *history = doc->getHistory(); - Q_CHECK_PTR(history); + SCASSERT(history != nullptr); qint32 currentRow = -1; qint32 count = 0; ui->tableWidget->setRowCount(history->size()); @@ -164,7 +164,7 @@ void DialogHistory::FillTable() { cursorRow = currentRow; QTableWidgetItem *item = ui->tableWidget->item(cursorRow, 0); - Q_CHECK_PTR(item); + SCASSERT(item != nullptr); item->setIcon(QIcon("://icon/32x32/put_after.png")); } ui->tableWidget->resizeColumnsToContents(); @@ -261,7 +261,7 @@ QString DialogHistory::Record(const VToolRecord &tool) case Valentina::SplineTool: { const VSpline *spl = data->GeometricObject(tool.getId()); - Q_CHECK_PTR(spl); + SCASSERT(spl != nullptr); const QString splP1Name = data->GeometricObject(spl->GetP1().id())->name(); const QString splP4Name = data->GeometricObject(spl->GetP4().id())->name(); return QString(tr("Curve %1_%2")).arg(splP1Name, splP4Name); @@ -269,14 +269,14 @@ QString DialogHistory::Record(const VToolRecord &tool) case Valentina::ArcTool: { const VArc *arc = data->GeometricObject(tool.getId()); - Q_CHECK_PTR(arc); + SCASSERT(arc != nullptr); const QString arcCenterName = data->GeometricObject(arc->GetCenter().id())->name(); return QString(tr("Arc with center in point %1")).arg(arcCenterName); } case Valentina::SplinePathTool: { const VSplinePath *splPath = data->GeometricObject(tool.getId()); - Q_CHECK_PTR(splPath); + SCASSERT(splPath != nullptr); const QVector points = splPath->GetSplinePath(); QString record; if (points.size() != 0 ) @@ -347,7 +347,7 @@ QString DialogHistory::Record(const VToolRecord &tool) { const quint32 arcId = doc->GetParametrUInt(domElement, VToolCutArc::AttrArc, "0"); const VArc *arc = data->GeometricObject(arcId); - Q_CHECK_PTR(arc); + SCASSERT(arc != nullptr); const QString arcCenterName = data->GeometricObject(arc->GetCenter().id())->name(); const QString toolIdName = data->GeometricObject(tool.getId())->name(); return QString(tr("%1 - cut arc with center %2")).arg(toolIdName, arcCenterName); @@ -356,7 +356,7 @@ QString DialogHistory::Record(const VToolRecord &tool) { const quint32 splineId = doc->GetParametrUInt(domElement, VToolCutSpline::AttrSpline, "0"); const VSpline *spl = data->GeometricObject(splineId); - Q_CHECK_PTR(spl); + SCASSERT(spl != nullptr); const QString toolIdName = data->GeometricObject(tool.getId())->name(); const QString splP1Name = data->GeometricObject(spl->GetP1().id())->name(); const QString splP4Name = data->GeometricObject(spl->GetP4().id())->name(); @@ -366,7 +366,7 @@ QString DialogHistory::Record(const VToolRecord &tool) { const quint32 splinePathId = doc->GetParametrUInt(domElement, VToolCutSplinePath::AttrSplinePath, "0"); const VSplinePath *splPath = data->GeometricObject(splinePathId); - Q_CHECK_PTR(splPath); + SCASSERT(splPath != nullptr); const QVector points = splPath->GetSplinePath(); QString record; if (points.size() != 0 ) diff --git a/src/app/dialogs/app/dialogindividualmeasurements.cpp b/src/app/dialogs/app/dialogindividualmeasurements.cpp index 234bdb4b2..e90db6da9 100644 --- a/src/app/dialogs/app/dialogindividualmeasurements.cpp +++ b/src/app/dialogs/app/dialogindividualmeasurements.cpp @@ -46,12 +46,12 @@ DialogIndividualMeasurements::DialogIndividualMeasurements(VContainer *data, con { const QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok); - Q_CHECK_PTR(bOk); + SCASSERT(bOk != nullptr); connect(bOk, &QPushButton::clicked, this, &DialogIndividualMeasurements::DialogAccepted); } { const QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel); - Q_CHECK_PTR(bCansel); + SCASSERT(bCansel != nullptr); connect(bCansel, &QPushButton::clicked, this, &DialogIndividualMeasurements::DialogRejected); } @@ -176,7 +176,7 @@ void DialogIndividualMeasurements::CheckState() QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok); - Q_CHECK_PTR(bOk); + SCASSERT(bOk != nullptr); bOk->setEnabled(flagName && flagPath); } diff --git a/src/app/dialogs/app/dialogpatternproperties.cpp b/src/app/dialogs/app/dialogpatternproperties.cpp index bc0efe0e0..e047c8e0d 100644 --- a/src/app/dialogs/app/dialogpatternproperties.cpp +++ b/src/app/dialogs/app/dialogpatternproperties.cpp @@ -37,7 +37,7 @@ DialogPatternProperties::DialogPatternProperties(VPattern *doc, QWidget *parent) { ui->setupUi(this); - Q_CHECK_PTR(doc); + SCASSERT(doc != nullptr); QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(), QApplication::applicationName()); @@ -52,11 +52,11 @@ DialogPatternProperties::DialogPatternProperties(VPattern *doc, QWidget *parent) ui->plainTextEditTechNotes->setPlainText(this->doc->UniqueTagText("notes")); QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok); - Q_CHECK_PTR(bOk); + SCASSERT(bOk != nullptr); connect(bOk, &QPushButton::clicked, this, &DialogPatternProperties::Apply); QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel); - Q_CHECK_PTR(bCansel); + SCASSERT(bCansel != nullptr); connect(bCansel, &QPushButton::clicked, this, &DialogPatternProperties::close); connect(this, &DialogPatternProperties::haveChange, this->doc, &VPattern::haveLiteChange); diff --git a/src/app/dialogs/app/dialogstandardmeasurements.cpp b/src/app/dialogs/app/dialogstandardmeasurements.cpp index 01d2b10dd..3cce31782 100644 --- a/src/app/dialogs/app/dialogstandardmeasurements.cpp +++ b/src/app/dialogs/app/dialogstandardmeasurements.cpp @@ -42,12 +42,12 @@ DialogStandardMeasurements::DialogStandardMeasurements(VContainer *data, const Q { const QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok); - Q_CHECK_PTR(bOk); + SCASSERT(bOk != nullptr); connect(bOk, &QPushButton::clicked, this, &DialogStandardMeasurements::DialogAccepted); } { const QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel); - Q_CHECK_PTR(bCansel); + SCASSERT(bCansel != nullptr); connect(bCansel, &QPushButton::clicked, this, &DialogStandardMeasurements::DialogRejected); } @@ -121,7 +121,7 @@ void DialogStandardMeasurements::CheckState() bool flagTable = false; { const QComboBox *box = ui->comboBoxTables; - Q_CHECK_PTR(box); + SCASSERT(box != nullptr); if (box->count() > 0 && box->currentIndex() != -1) { flagTable = true; @@ -129,7 +129,7 @@ void DialogStandardMeasurements::CheckState() } QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok); - Q_CHECK_PTR(bOk); + SCASSERT(bOk != nullptr); bOk->setEnabled(flagTable && flagName); } diff --git a/src/app/dialogs/tools/dialogarc.cpp b/src/app/dialogs/tools/dialogarc.cpp index aacb45a5c..873e9808e 100644 --- a/src/app/dialogs/tools/dialogarc.cpp +++ b/src/app/dialogs/tools/dialogarc.cpp @@ -193,7 +193,7 @@ void DialogArc::F2Changed() //--------------------------------------------------------------------------------------------------------------------- void DialogArc::CheckState() { - Q_CHECK_PTR(bOk); + SCASSERT(bOk != nullptr); bOk->setEnabled(flagRadius && flagF1 && flagF2); } @@ -225,7 +225,7 @@ void DialogArc::ShowLineAngles() ui->listWidget->clear(); connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogArc::ValChenged); const QHash *lineAnglesTable = data->DataLineAngles(); - Q_CHECK_PTR(lineAnglesTable); + SCASSERT(lineAnglesTable != nullptr); QHashIterator i(*lineAnglesTable); while (i.hasNext()) { diff --git a/src/app/dialogs/tools/dialogdetail.cpp b/src/app/dialogs/tools/dialogdetail.cpp index 8b156c4ed..d871656c0 100644 --- a/src/app/dialogs/tools/dialogdetail.cpp +++ b/src/app/dialogs/tools/dialogdetail.cpp @@ -39,10 +39,10 @@ DialogDetail::DialogDetail(const VContainer *data, QWidget *parent) labelEditNamePoint = ui.labelEditNameDetail; bOk = ui.buttonBox->button(QDialogButtonBox::Ok); - Q_CHECK_PTR(bOk); + SCASSERT(bOk != nullptr); connect(bOk, &QPushButton::clicked, this, &DialogTool::DialogAccepted); QPushButton *bCansel = ui.buttonBox->button(QDialogButtonBox::Cancel); - Q_CHECK_PTR(bCansel); + SCASSERT(bCansel != nullptr); connect(bCansel, &QPushButton::clicked, this, &DialogTool::DialogRejected); flagName = true;//We have default name of detail. @@ -188,7 +188,7 @@ void DialogDetail::BiasXChanged(qreal d) { qint32 row = ui.listWidget->currentRow(); QListWidgetItem *item = ui.listWidget->item( row ); - Q_CHECK_PTR(item); + SCASSERT(item != nullptr); VNodeDetail node = qvariant_cast(item->data(Qt::UserRole)); node.setMx(qApp->toPixel(d)); item->setData(Qt::UserRole, QVariant::fromValue(node)); @@ -199,7 +199,7 @@ void DialogDetail::BiasYChanged(qreal d) { qint32 row = ui.listWidget->currentRow(); QListWidgetItem *item = ui.listWidget->item( row ); - Q_CHECK_PTR(item); + SCASSERT(item != nullptr); VNodeDetail node = qvariant_cast(item->data(Qt::UserRole)); node.setMy(qApp->toPixel(d)); item->setData(Qt::UserRole, QVariant::fromValue(node)); diff --git a/src/app/dialogs/tools/dialogeditwrongformula.cpp b/src/app/dialogs/tools/dialogeditwrongformula.cpp index d488ad260..71d20c0c3 100644 --- a/src/app/dialogs/tools/dialogeditwrongformula.cpp +++ b/src/app/dialogs/tools/dialogeditwrongformula.cpp @@ -85,7 +85,7 @@ void DialogEditWrongFormula::DialogRejected() //--------------------------------------------------------------------------------------------------------------------- void DialogEditWrongFormula::CheckState() { - Q_CHECK_PTR(bOk); + SCASSERT(bOk != nullptr); bOk->setEnabled(flagFormula); } diff --git a/src/app/dialogs/tools/dialoglineintersect.cpp b/src/app/dialogs/tools/dialoglineintersect.cpp index 971b696ff..9c24a6e35 100644 --- a/src/app/dialogs/tools/dialoglineintersect.cpp +++ b/src/app/dialogs/tools/dialoglineintersect.cpp @@ -176,7 +176,7 @@ void DialogLineIntersect::P2Line2Changed(int index) //--------------------------------------------------------------------------------------------------------------------- void DialogLineIntersect::CheckState() { - Q_CHECK_PTR(bOk); + SCASSERT(bOk != nullptr); bOk->setEnabled(flagName && flagPoint); } diff --git a/src/app/dialogs/tools/dialogpointofcontact.cpp b/src/app/dialogs/tools/dialogpointofcontact.cpp index 55237da5b..57d3dedab 100644 --- a/src/app/dialogs/tools/dialogpointofcontact.cpp +++ b/src/app/dialogs/tools/dialogpointofcontact.cpp @@ -50,10 +50,10 @@ DialogPointOfContact::DialogPointOfContact(const VContainer *data, QWidget *pare labelEditNamePoint = ui.labelEditNamePoint; bOk = ui.buttonBox->button(QDialogButtonBox::Ok); - Q_CHECK_PTR(bOk); + SCASSERT(bOk != nullptr); connect(bOk, &QPushButton::clicked, this, &DialogTool::DialogAccepted); QPushButton *bCansel = ui.buttonBox->button(QDialogButtonBox::Cancel); - Q_CHECK_PTR(bCansel); + SCASSERT(bCansel != nullptr); connect(bCansel, &QPushButton::clicked, this, &DialogTool::DialogRejected); flagFormula = false; diff --git a/src/app/dialogs/tools/dialogsplinepath.cpp b/src/app/dialogs/tools/dialogsplinepath.cpp index 6b9958646..de42f970b 100644 --- a/src/app/dialogs/tools/dialogsplinepath.cpp +++ b/src/app/dialogs/tools/dialogsplinepath.cpp @@ -131,7 +131,7 @@ void DialogSplinePath::Angle1Changed(qreal index) { qint32 row = ui->listWidget->currentRow(); QListWidgetItem *item = ui->listWidget->item( row ); - Q_CHECK_PTR(item); + SCASSERT(item != nullptr); VSplinePoint p = qvariant_cast(item->data(Qt::UserRole)); p.SetAngle1(index); DataPoint(p.P().id(), p.KAsm1(), p.Angle1(), p.KAsm2(), p.Angle2()); @@ -143,7 +143,7 @@ void DialogSplinePath::Angle2Changed(qreal index) { qint32 row = ui->listWidget->currentRow(); QListWidgetItem *item = ui->listWidget->item( row ); - Q_CHECK_PTR(item); + SCASSERT(item != nullptr); VSplinePoint p = qvariant_cast(item->data(Qt::UserRole)); p.SetAngle2(index); DataPoint(p.P().id(), p.KAsm1(), p.Angle1(), p.KAsm2(), p.Angle2()); diff --git a/src/app/dialogs/tools/dialogtool.cpp b/src/app/dialogs/tools/dialogtool.cpp index 785539bb0..469ed6473 100644 --- a/src/app/dialogs/tools/dialogtool.cpp +++ b/src/app/dialogs/tools/dialogtool.cpp @@ -48,7 +48,7 @@ DialogTool::DialogTool(const VContainer *data, QWidget *parent) radioButtonIncrements(nullptr), radioButtonLengthLine(nullptr), radioButtonLengthArc(nullptr), radioButtonLengthCurve(nullptr), lineStyles(QStringList()), associatedTool(nullptr) { - Q_CHECK_PTR(data); + SCASSERT(data != nullptr); timerFormula = new QTimer(this); connect(timerFormula, &QTimer::timeout, this, &DialogTool::EvalFormula); //Keep synchronize with VAbstractTool styles list!!! @@ -83,7 +83,7 @@ void DialogTool::showEvent(QShowEvent *event) //--------------------------------------------------------------------------------------------------------------------- void DialogTool::FillComboBoxPoints(QComboBox *box, const quint32 &id) const { - Q_CHECK_PTR(box); + SCASSERT(box != nullptr); const QHash *objs = data->DataGObjects(); QHashIterator i(*objs); QMap list; @@ -106,7 +106,7 @@ void DialogTool::FillComboBoxPoints(QComboBox *box, const quint32 &id) const //--------------------------------------------------------------------------------------------------------------------- void DialogTool::FillComboBoxArcs(QComboBox *box, const quint32 &id, ComboMode::ComboBoxCutArc cut) const { - Q_CHECK_PTR(box); + SCASSERT(box != nullptr); const QHash *objs = data->DataGObjects(); QHashIterator i(*objs); QMap list; @@ -144,7 +144,7 @@ void DialogTool::FillComboBoxArcs(QComboBox *box, const quint32 &id, ComboMode:: //--------------------------------------------------------------------------------------------------------------------- void DialogTool::FillComboBoxSplines(QComboBox *box, const quint32 &id, ComboMode::ComboBoxCutSpline cut) const { - Q_CHECK_PTR(box); + SCASSERT(box != nullptr); const QHash *objs = data->DataGObjects(); QHashIterator i(*objs); QMap list; @@ -182,7 +182,7 @@ void DialogTool::FillComboBoxSplines(QComboBox *box, const quint32 &id, ComboMod //--------------------------------------------------------------------------------------------------------------------- void DialogTool::FillComboBoxSplinesPath(QComboBox *box, const quint32 &id, ComboMode::ComboBoxCutSpline cut) const { - Q_CHECK_PTR(box); + SCASSERT(box != nullptr); const QHash *objs = data->DataGObjects(); QHashIterator i(*objs); QMap list; @@ -220,7 +220,7 @@ void DialogTool::FillComboBoxSplinesPath(QComboBox *box, const quint32 &id, Comb //--------------------------------------------------------------------------------------------------------------------- void DialogTool::FillComboBoxTypeLine(QComboBox *box) const { - Q_CHECK_PTR(box); + SCASSERT(box != nullptr); box->addItems(lineStyles); box->setCurrentIndex(1); } @@ -291,10 +291,10 @@ void DialogTool::ChangeCurrentData(QComboBox *box, const quint32 &value) const void DialogTool::PutValHere(QLineEdit *lineEdit, QListWidget *listWidget) { // TODO issue #79 : erase this function after all tools updated to plainTextEdit - Q_CHECK_PTR(lineEdit); - Q_CHECK_PTR(listWidget); + SCASSERT(lineEdit != nullptr); + SCASSERT(listWidget != nullptr); QListWidgetItem *item = listWidget->currentItem(); - Q_CHECK_PTR(item); + SCASSERT(item != nullptr); int pos = lineEdit->cursorPosition(); lineEdit->setText(lineEdit->text().insert(lineEdit->cursorPosition(), item->text())); @@ -306,10 +306,10 @@ void DialogTool::PutValHere(QLineEdit *lineEdit, QListWidget *listWidget) //--------------------------------------------------------------------------------------------------------------------- void DialogTool::PutValHere(QPlainTextEdit *plainTextEdit, QListWidget *listWidget) { - Q_CHECK_PTR(plainTextEdit); - Q_CHECK_PTR(listWidget); + SCASSERT(plainTextEdit != nullptr); + SCASSERT(listWidget != nullptr); QListWidgetItem *item = listWidget->currentItem(); - Q_CHECK_PTR(item); + SCASSERT(item != nullptr); QTextCursor cursor = plainTextEdit->textCursor(); cursor.insertText(item->text()); @@ -325,9 +325,9 @@ void DialogTool::PutValHere(QPlainTextEdit *plainTextEdit, QListWidget *listWidg //--------------------------------------------------------------------------------------------------------------------- void DialogTool::ValFormulaChanged(bool &flag, QLineEdit *edit, QTimer *timer) {// TODO issue #79 : erase this function after all tools updated to plainTextEdit - Q_CHECK_PTR(edit); - Q_CHECK_PTR(timer); - Q_CHECK_PTR(labelEditFormula); + SCASSERT(edit != nullptr); + SCASSERT(timer != nullptr); + SCASSERT(labelEditFormula != nullptr); if (edit->text().isEmpty()) { flag = false; @@ -342,9 +342,9 @@ void DialogTool::ValFormulaChanged(bool &flag, QLineEdit *edit, QTimer *timer) //--------------------------------------------------------------------------------------------------------------------- void DialogTool::ValFormulaChanged(bool &flag, QPlainTextEdit *edit, QTimer *timer) { - Q_CHECK_PTR(edit); - Q_CHECK_PTR(timer); - Q_CHECK_PTR(labelEditFormula); + SCASSERT(edit != nullptr); + SCASSERT(timer != nullptr); + SCASSERT(labelEditFormula != nullptr); if (edit->toPlainText().isEmpty()) { flag = false; @@ -359,10 +359,10 @@ void DialogTool::ValFormulaChanged(bool &flag, QPlainTextEdit *edit, QTimer *tim void DialogTool::Eval(QLineEdit *edit, bool &flag, QTimer *timer, QLabel *label) { // TODO issue #79 : erase this function after all tools updated to plainTextEdit - Q_CHECK_PTR(edit); - Q_CHECK_PTR(timer); - Q_CHECK_PTR(label); - Q_CHECK_PTR(labelEditFormula); + SCASSERT(edit != nullptr); + SCASSERT(timer != nullptr); + SCASSERT(label != nullptr); + SCASSERT(labelEditFormula != nullptr); QPalette palette = labelEditFormula->palette(); if (edit->text().isEmpty()) { @@ -417,10 +417,10 @@ void DialogTool::Eval(QLineEdit *edit, bool &flag, QTimer *timer, QLabel *label) //--------------------------------------------------------------------------------------------------------------------- void DialogTool::Eval(QPlainTextEdit *edit, bool &flag, QTimer *timer, QLabel *label) { - Q_CHECK_PTR(edit); - Q_CHECK_PTR(timer); - Q_CHECK_PTR(label); - Q_CHECK_PTR(labelEditFormula); + SCASSERT(edit != nullptr); + SCASSERT(timer != nullptr); + SCASSERT(label != nullptr); + SCASSERT(labelEditFormula != nullptr); QPalette palette = labelEditFormula->palette(); if (edit->toPlainText().isEmpty()) { @@ -478,7 +478,7 @@ void DialogTool::Eval(QPlainTextEdit *edit, bool &flag, QTimer *timer, QLabel *l //--------------------------------------------------------------------------------------------------------------------- void DialogTool::setCurrentPointId(QComboBox *box, quint32 &pointId, const quint32 &value, const quint32 &id) const { - Q_CHECK_PTR(box); + SCASSERT(box != nullptr); FillComboBoxPoints(box, id); pointId = value; ChangeCurrentData(box, value); @@ -488,7 +488,7 @@ void DialogTool::setCurrentPointId(QComboBox *box, quint32 &pointId, const quint void DialogTool::setCurrentSplineId(QComboBox *box, quint32 &splineId, const quint32 &value, const quint32 &id, ComboMode::ComboBoxCutSpline cut) const { - Q_CHECK_PTR(box); + SCASSERT(box != nullptr); FillComboBoxSplines(box, id, cut); splineId = value; ChangeCurrentData(box, value); @@ -498,7 +498,7 @@ void DialogTool::setCurrentSplineId(QComboBox *box, quint32 &splineId, const qui void DialogTool::setCurrentArcId(QComboBox *box, quint32 &arcId, const quint32 &value, const quint32 &id, ComboMode::ComboBoxCutArc cut) const { - Q_CHECK_PTR(box); + SCASSERT(box != nullptr); FillComboBoxArcs(box, id, cut); arcId = value; ChangeCurrentData(box, value); @@ -508,7 +508,7 @@ void DialogTool::setCurrentArcId(QComboBox *box, quint32 &arcId, const quint32 & void DialogTool::setCurrentSplinePathId(QComboBox *box, quint32 &splinePathId, const quint32 &value, const quint32 &id, ComboMode::ComboBoxCutSpline cut) const { - Q_CHECK_PTR(box); + SCASSERT(box != nullptr); FillComboBoxSplinesPath(box, id, cut); splinePathId = value; ChangeCurrentData(box, value); @@ -517,7 +517,7 @@ void DialogTool::setCurrentSplinePathId(QComboBox *box, quint32 &splinePathId, c //--------------------------------------------------------------------------------------------------------------------- quint32 DialogTool::getCurrentObjectId(QComboBox *box) const { - Q_CHECK_PTR(box); + SCASSERT(box != nullptr); qint32 index = box->currentIndex(); Q_ASSERT(index != -1); if (index != -1) @@ -533,9 +533,9 @@ quint32 DialogTool::getCurrentObjectId(QComboBox *box) const //--------------------------------------------------------------------------------------------------------------------- bool DialogTool::ChoosedPoint(const quint32 &id, QComboBox *box, const QString &toolTip) { - Q_CHECK_PTR(box); + SCASSERT(box != nullptr); const VPointF *point = data->GeometricObject(id); - Q_CHECK_PTR(point); + SCASSERT(point != nullptr); const qint32 index = box->findText(point->name()); if ( index != -1 ) { // -1 for not found @@ -549,7 +549,7 @@ bool DialogTool::ChoosedPoint(const quint32 &id, QComboBox *box, const QString & //--------------------------------------------------------------------------------------------------------------------- void DialogTool::FillList(QComboBox *box, const QMap &list) const { - Q_CHECK_PTR(box); + SCASSERT(box != nullptr); box->clear(); QMapIterator iter(list); @@ -563,9 +563,9 @@ void DialogTool::FillList(QComboBox *box, const QMap &list) co //--------------------------------------------------------------------------------------------------------------------- void DialogTool::CheckState() { - Q_CHECK_PTR(bOk); + SCASSERT(bOk != nullptr); bOk->setEnabled(flagFormula && flagName); - Q_CHECK_PTR(bApply); + SCASSERT(bApply != nullptr); bApply->setEnabled(flagFormula && flagName); } @@ -580,7 +580,7 @@ void DialogTool::ChoosedObject(quint32 id, const Valentina::Scenes &type) //--------------------------------------------------------------------------------------------------------------------- void DialogTool::NamePointChanged() { - Q_CHECK_PTR(labelEditNamePoint); + SCASSERT(labelEditNamePoint != nullptr); QLineEdit* edit = qobject_cast(sender()); if (edit) { @@ -637,71 +637,71 @@ void DialogTool::FormulaChanged2() //--------------------------------------------------------------------------------------------------------------------- void DialogTool::ArrowUp() { - Q_CHECK_PTR(spinBoxAngle); + SCASSERT(spinBoxAngle != nullptr); spinBoxAngle->setValue(90); } //--------------------------------------------------------------------------------------------------------------------- void DialogTool::ArrowDown() { - Q_CHECK_PTR(spinBoxAngle); + SCASSERT(spinBoxAngle != nullptr); spinBoxAngle->setValue(270); } //--------------------------------------------------------------------------------------------------------------------- void DialogTool::ArrowLeft() { - Q_CHECK_PTR(spinBoxAngle); + SCASSERT(spinBoxAngle != nullptr); spinBoxAngle->setValue(180); } //--------------------------------------------------------------------------------------------------------------------- void DialogTool::ArrowRight() { - Q_CHECK_PTR(spinBoxAngle); + SCASSERT(spinBoxAngle != nullptr); spinBoxAngle->setValue(0); } //--------------------------------------------------------------------------------------------------------------------- void DialogTool::ArrowLeftUp() { - Q_CHECK_PTR(spinBoxAngle); + SCASSERT(spinBoxAngle != nullptr); spinBoxAngle->setValue(135); } //--------------------------------------------------------------------------------------------------------------------- void DialogTool::ArrowLeftDown() { - Q_CHECK_PTR(spinBoxAngle); + SCASSERT(spinBoxAngle != nullptr); spinBoxAngle->setValue(225); } //--------------------------------------------------------------------------------------------------------------------- void DialogTool::ArrowRightUp() { - Q_CHECK_PTR(spinBoxAngle); + SCASSERT(spinBoxAngle != nullptr); spinBoxAngle->setValue(45); } //--------------------------------------------------------------------------------------------------------------------- void DialogTool::ArrowRightDown() { - Q_CHECK_PTR(spinBoxAngle); + SCASSERT(spinBoxAngle != nullptr); spinBoxAngle->setValue(315); } //--------------------------------------------------------------------------------------------------------------------- void DialogTool::EvalFormula() { - Q_CHECK_PTR(plainTextEditFormula); - Q_CHECK_PTR(labelResultCalculation); + SCASSERT(plainTextEditFormula != nullptr); + SCASSERT(labelResultCalculation != nullptr); Eval(plainTextEditFormula, flagFormula, timerFormula, labelResultCalculation); } //--------------------------------------------------------------------------------------------------------------------- void DialogTool::SizeHeight() { - Q_CHECK_PTR(listWidget); + SCASSERT(listWidget != nullptr); disconnect(listWidget, &QListWidget::currentRowChanged, this, &DialogTool::ValChenged); listWidget->clear(); @@ -758,8 +758,8 @@ void DialogTool::PutHere() //--------------------------------------------------------------------------------------------------------------------- void DialogTool::PutVal(QListWidgetItem *item) { - Q_CHECK_PTR(plainTextEditFormula); - Q_CHECK_PTR(item); + SCASSERT(plainTextEditFormula != nullptr); + SCASSERT(item != nullptr); QTextCursor cursor = plainTextEditFormula->textCursor(); cursor.insertText(item->text()); plainTextEditFormula->setTextCursor(cursor); @@ -774,14 +774,14 @@ void DialogTool::PutVal(QListWidgetItem *item) //--------------------------------------------------------------------------------------------------------------------- void DialogTool::ValChenged(int row) { - Q_CHECK_PTR(listWidget); - Q_CHECK_PTR(labelDescription); - Q_CHECK_PTR(radioButtonSizeGrowth); - Q_CHECK_PTR(radioButtonStandardTable); - Q_CHECK_PTR(radioButtonIncrements); - Q_CHECK_PTR(radioButtonLengthLine); - Q_CHECK_PTR(radioButtonLengthArc); - Q_CHECK_PTR(radioButtonLengthCurve); + SCASSERT(listWidget != nullptr); + SCASSERT(labelDescription != nullptr); + SCASSERT(radioButtonSizeGrowth != nullptr); + SCASSERT(radioButtonStandardTable != nullptr); + SCASSERT(radioButtonIncrements != nullptr); + SCASSERT(radioButtonLengthLine != nullptr); + SCASSERT(radioButtonLengthArc != nullptr); + SCASSERT(radioButtonLengthCurve != nullptr); if (listWidget->count() == 0) { return; @@ -844,12 +844,12 @@ void DialogTool::ValChenged(int row) //--------------------------------------------------------------------------------------------------------------------- void DialogTool::UpdateList() { - Q_CHECK_PTR(radioButtonSizeGrowth); - Q_CHECK_PTR(radioButtonStandardTable); - Q_CHECK_PTR(radioButtonIncrements); - Q_CHECK_PTR(radioButtonLengthLine); - Q_CHECK_PTR(radioButtonLengthArc); - Q_CHECK_PTR(radioButtonLengthCurve); + SCASSERT(radioButtonSizeGrowth != nullptr); + SCASSERT(radioButtonStandardTable != nullptr); + SCASSERT(radioButtonIncrements != nullptr); + SCASSERT(radioButtonLengthLine != nullptr); + SCASSERT(radioButtonLengthArc != nullptr); + SCASSERT(radioButtonLengthCurve != nullptr); if (radioButtonSizeGrowth->isChecked()) { @@ -881,7 +881,7 @@ void DialogTool::UpdateList() template void DialogTool::ShowVariable(const QHash *var) { - Q_CHECK_PTR(listWidget); + SCASSERT(listWidget != nullptr); disconnect(listWidget, &QListWidget::currentRowChanged, this, &DialogTool::ValChenged); listWidget->clear(); diff --git a/src/app/dialogs/tools/dialogtool.h b/src/app/dialogs/tools/dialogtool.h index 581fa8d6e..3c1f83f33 100644 --- a/src/app/dialogs/tools/dialogtool.h +++ b/src/app/dialogs/tools/dialogtool.h @@ -432,7 +432,7 @@ protected: template void InitArrow(T *ui) { - Q_CHECK_PTR(ui); + SCASSERT(ui != nullptr); spinBoxAngle = ui->doubleSpinBoxAngle; connect(ui->toolButtonArrowDown, &QPushButton::clicked, this, &DialogTool::ArrowDown); connect(ui->toolButtonArrowUp, &QPushButton::clicked, this, &DialogTool::ArrowUp); @@ -480,7 +480,7 @@ protected: InitOkCancel(ui); // TODO issue #79 bApply = ui->buttonBox->button(QDialogButtonBox::Apply); - Q_CHECK_PTR(bApply); + SCASSERT(bApply != nullptr); connect(bApply, &QPushButton::clicked, this, &DialogTool::DialogApply); } //Left this method for dialog what do not need apply button @@ -488,11 +488,11 @@ protected: void InitOkCancel(T *ui) { bOk = ui->buttonBox->button(QDialogButtonBox::Ok); - Q_CHECK_PTR(bOk); + SCASSERT(bOk != nullptr); connect(bOk, &QPushButton::clicked, this, &DialogTool::DialogAccepted); QPushButton *bCancel = ui->buttonBox->button(QDialogButtonBox::Cancel); - Q_CHECK_PTR(bCancel); + SCASSERT(bCancel != nullptr); connect(bCancel, &QPushButton::clicked, this, &DialogTool::DialogRejected); } /** diff --git a/src/app/exception/vexception.cpp b/src/app/exception/vexception.cpp index 1812d7337..9b0cc4974 100644 --- a/src/app/exception/vexception.cpp +++ b/src/app/exception/vexception.cpp @@ -30,6 +30,7 @@ #include #include #include +#include "../options.h" //--------------------------------------------------------------------------------------------------------------------- VException::VException(const QString &what):QException(), what(what), moreInfo(QString()) @@ -64,7 +65,7 @@ void VException::CriticalMessageBox(const QString &situation, QWidget * parent) msgBox.setIcon(QMessageBox::Critical); QSpacerItem* horizontalSpacer = new QSpacerItem(500, 0, QSizePolicy::Minimum, QSizePolicy::Expanding); QGridLayout* layout = static_cast(msgBox.layout()); - Q_CHECK_PTR(layout); + SCASSERT(layout != nullptr); layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount()); //Disable Qt::WaitCursor for error message. #ifndef QT_NO_CURSOR diff --git a/src/app/geometry/vequidistant.cpp b/src/app/geometry/vequidistant.cpp index c80f34324..e44b05ead 100644 --- a/src/app/geometry/vequidistant.cpp +++ b/src/app/geometry/vequidistant.cpp @@ -33,7 +33,7 @@ //--------------------------------------------------------------------------------------------------------------------- QPainterPath VEquidistant::ContourPath(const quint32 &idDetail, const VContainer *data) const { - Q_CHECK_PTR(data); + SCASSERT(data != nullptr); VDetail detail = data->GetDetail(idDetail); QVector points; QVector pointsEkv; diff --git a/src/app/mainwindow.cpp b/src/app/mainwindow.cpp index 9cafbc319..4215af96e 100644 --- a/src/app/mainwindow.cpp +++ b/src/app/mainwindow.cpp @@ -176,7 +176,7 @@ void MainWindow::ActionNewDraw() connect(spoint, &VToolPoint::ChoosedTool, sceneDraw, &VMainGraphicsScene::ChoosedItem); connect(sceneDraw, &VMainGraphicsScene::NewFactor, spoint, &VToolSinglePoint::SetFactor); QHash* tools = doc->getTools(); - Q_CHECK_PTR(tools); + SCASSERT(tools != nullptr); tools->insert(id, spoint); VDrawTool::AddRecord(id, Valentina::SinglePointTool, doc); SetEnableTool(true); @@ -246,7 +246,7 @@ void MainWindow::SetToolButton(bool checked, Valentina::Tools t, const QString & { if (QToolButton *tButton = qobject_cast< QToolButton * >(this->sender())) { - Q_CHECK_PTR(tButton); + SCASSERT(tButton != nullptr); tButton->setChecked(true); } } @@ -286,7 +286,7 @@ void MainWindow::SetToolButton2(bool checked, Valentina::Tools t, const QString { if (QToolButton *tButton = qobject_cast< QToolButton * >(this->sender())) { - Q_CHECK_PTR(tButton); + SCASSERT(tButton != nullptr); tButton->setChecked(true); } } @@ -299,7 +299,7 @@ void MainWindow::SetToolButton2(bool checked, Valentina::Tools t, const QString template void MainWindow::ClosedDialog(int result) {// TODO ISSUE 79 : delete - Q_CHECK_PTR(dialogTool); + SCASSERT(dialogTool != nullptr); if (result == QDialog::Accepted) { DrawTool::Create(dialogTool, currentScene, doc, pattern); @@ -316,7 +316,7 @@ void MainWindow::ClosedDialog(int result) template void MainWindow::ClosedDialog2(int result) { - Q_CHECK_PTR(dialogTool); + SCASSERT(dialogTool != nullptr); if (result == QDialog::Accepted) { // Only create tool if not already created with apply @@ -346,7 +346,7 @@ void MainWindow::ClosedDialog2(int result) template void MainWindow::ApplyDialog() {// TODO ISSUE 79 : copy - Q_CHECK_PTR(dialogTool); + SCASSERT(dialogTool != nullptr); // Only create tool if not already created with apply if (dialogTool->GetAssociatedTool() == nullptr) diff --git a/src/app/options.h b/src/app/options.h index 7bcd53bc1..590eec82d 100644 --- a/src/app/options.h +++ b/src/app/options.h @@ -33,6 +33,11 @@ #include #include #include +#include + +#ifdef Q_OS_WIN32 +#include WinBase.h +#endif /*Q_OS_WIN32*/ #define SceneSize 50000 @@ -283,4 +288,43 @@ extern const QString cm_Oprt; extern const QString mm_Oprt; extern const QString in_Oprt; +/* + * This macros SCASSERT (for Stop and Continue Assert) will break into the debugger on the line of the assert and allow + * you to continue afterwards should you choose to. + * idea: Q_ASSERT no longer pauses debugger - http://qt-project.org/forums/viewthread/13148 + * Usefull links: + * 1. What's the difference between __PRETTY_FUNCTION__, __FUNCTION__, __func__? - + * https://stackoverflow.com/questions/4384765/whats-the-difference-between-pretty-function-function-func + * + * 2. Windows Predefined Macros - http://msdn.microsoft.com/library/b0084kay.aspx + * + * 3. Windows DebugBreak function - http://msdn.microsoft.com/en-us/library/ms679297%28VS.85%29.aspx + * + * 4. Continue to debug after failed assertion on Linux? [C/C++] - + * https://stackoverflow.com/questions/1721543/continue-to-debug-after-failed-assertion-on-linux-c-c + */ +#ifndef QT_NO_DEBUG +#ifdef Q_OS_WIN32 +#define SCASSERT(cond) \ +{ \ + if (!(cond)) \ + { \ + qDebug("ASSERT: %s in %s (%s:%u)", \ + #cond, __FUNCSIG__, __FILE__, __LINE__); \ + void WINAPI DebugBreak(void); \ \ + } \ +} +#else +#define SCASSERT(cond) \ +{ \ + if (!(cond)) \ + { \ + qDebug("ASSERT: %s in %s (%s:%u)", \ + #cond, __PRETTY_FUNCTION__, __FILE__, __LINE__);\ + std::raise(SIGTRAP); \ + } \ +} +#endif /* Q_OS_WIN32 */ +#endif /* QT_NO_DEBUG */ + #endif // OPTIONS_H diff --git a/src/app/tablewindow.cpp b/src/app/tablewindow.cpp index 64e5af6eb..a71eaa79e 100644 --- a/src/app/tablewindow.cpp +++ b/src/app/tablewindow.cpp @@ -97,7 +97,7 @@ void TableWindow::AddDetail() { tableScene->clearSelection(); VItem* Detail = listDetails[indexDetail]; - Q_CHECK_PTR(Detail); + SCASSERT(Detail != nullptr); connect(Detail, &VItem::itemOut, this, &TableWindow::itemOut); connect(Detail, &VItem::itemColliding, this, &TableWindow::itemColliding); connect(this, &TableWindow::LengthChanged, Detail, &VItem::LengthChanged); @@ -329,7 +329,7 @@ void TableWindow::itemColliding(QList list, int number) if (lis.size()-2 <= 0) { VItem * bitem = qgraphicsitem_cast ( listCollidingItems.at(i) ); - Q_CHECK_PTR(bitem); + SCASSERT(bitem != nullptr); bitem->setPen(QPen(Qt::black, qApp->toPixel(qApp->widthMainLine()))); listCollidingItems.removeAt(i); } @@ -338,7 +338,7 @@ void TableWindow::itemColliding(QList list, int number) else if (listCollidingItems.size()==1) { VItem * bitem = qgraphicsitem_cast ( listCollidingItems.at(0) ); - Q_CHECK_PTR(bitem); + SCASSERT(bitem != nullptr); bitem->setPen(QPen(Qt::black, qApp->toPixel(qApp->widthMainLine()))); listCollidingItems.clear(); collidingItems = true; diff --git a/src/app/tools/drawTools/vdrawtool.h b/src/app/tools/drawTools/vdrawtool.h index a8f26f32f..d5ade197b 100644 --- a/src/app/tools/drawTools/vdrawtool.h +++ b/src/app/tools/drawTools/vdrawtool.h @@ -95,8 +95,8 @@ protected: */ void ContextMenu(Tool *tool, QGraphicsSceneContextMenuEvent *event, bool showRemove = true) { - Q_CHECK_PTR(tool); - Q_CHECK_PTR(event); + SCASSERT(tool != nullptr); + SCASSERT(event != nullptr); if (ignoreContextMenuEvent == false) { QMenu menu; @@ -153,7 +153,7 @@ protected: */ void ShowItem(Item *item, quint32 id, Qt::GlobalColor color, bool enable) { - Q_CHECK_PTR(item); + SCASSERT(item != nullptr); if (id == item->id) { if (enable == false) diff --git a/src/app/tools/drawTools/vtoolalongline.cpp b/src/app/tools/drawTools/vtoolalongline.cpp index b6ca59ec2..a0c8da771 100644 --- a/src/app/tools/drawTools/vtoolalongline.cpp +++ b/src/app/tools/drawTools/vtoolalongline.cpp @@ -133,9 +133,9 @@ void VToolAlongLine::RemoveReferens() //--------------------------------------------------------------------------------------------------------------------- void VToolAlongLine::SaveDialog(QDomElement &domElement) { - Q_CHECK_PTR(dialog); + SCASSERT(dialog != nullptr); DialogAlongLine *dialogTool = qobject_cast(dialog); - Q_CHECK_PTR(dialogTool); + SCASSERT(dialogTool != nullptr); doc->SetAttribute(domElement, AttrName, dialogTool->getPointName()); doc->SetAttribute(domElement, AttrTypeLine, dialogTool->getTypeLine()); doc->SetAttribute(domElement, AttrLength, dialogTool->getFormula()); @@ -146,9 +146,9 @@ void VToolAlongLine::SaveDialog(QDomElement &domElement) //--------------------------------------------------------------------------------------------------------------------- void VToolAlongLine::setDialog() { - Q_CHECK_PTR(dialog); + SCASSERT(dialog != nullptr); DialogAlongLine *dialogTool = qobject_cast(dialog); - Q_CHECK_PTR(dialogTool); + SCASSERT(dialogTool != nullptr); const VPointF *p = VAbstractTool::data.GeometricObject(id); dialogTool->setTypeLine(typeLine); dialogTool->setFormula(formula); @@ -160,9 +160,9 @@ void VToolAlongLine::setDialog() //--------------------------------------------------------------------------------------------------------------------- void VToolAlongLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data) { - Q_CHECK_PTR(dialog); + SCASSERT(dialog != nullptr); DialogAlongLine *dialogTool = qobject_cast(dialog); - Q_CHECK_PTR(dialogTool); + SCASSERT(dialogTool != nullptr); QString formula = dialogTool->getFormula(); const quint32 firstPointId = dialogTool->getFirstPointId(); const quint32 secondPointId = dialogTool->getSecondPointId(); diff --git a/src/app/tools/drawTools/vtoolarc.cpp b/src/app/tools/drawTools/vtoolarc.cpp index 9664f2528..fadf1a9ed 100644 --- a/src/app/tools/drawTools/vtoolarc.cpp +++ b/src/app/tools/drawTools/vtoolarc.cpp @@ -62,9 +62,9 @@ VToolArc::VToolArc(VPattern *doc, VContainer *data, quint32 id, const Valentina: //--------------------------------------------------------------------------------------------------------------------- void VToolArc::setDialog() { - Q_CHECK_PTR(dialog); + SCASSERT(dialog != nullptr); DialogArc *dialogTool = qobject_cast(dialog); - Q_CHECK_PTR(dialogTool); + SCASSERT(dialogTool != nullptr); const VArc *arc = VAbstractTool::data.GeometricObject(id); dialogTool->SetCenter(arc->GetCenter().id()); dialogTool->SetF1(arc->GetFormulaF1()); @@ -75,9 +75,9 @@ void VToolArc::setDialog() //--------------------------------------------------------------------------------------------------------------------- void VToolArc::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data) { - Q_CHECK_PTR(dialog); + SCASSERT(dialog != nullptr); DialogArc *dialogTool = qobject_cast(dialog); - Q_CHECK_PTR(dialogTool); + SCASSERT(dialogTool != nullptr); const quint32 center = dialogTool->GetCenter(); QString radius = dialogTool->GetRadius(); QString f1 = dialogTool->GetF1(); @@ -268,9 +268,9 @@ void VToolArc::keyReleaseEvent(QKeyEvent *event) //--------------------------------------------------------------------------------------------------------------------- void VToolArc::SaveDialog(QDomElement &domElement) { - Q_CHECK_PTR(dialog); + SCASSERT(dialog != nullptr); DialogArc *dialogTool = qobject_cast(dialog); - Q_CHECK_PTR(dialogTool); + SCASSERT(dialogTool != nullptr); doc->SetAttribute(domElement, AttrCenter, QString().setNum(dialogTool->GetCenter())); doc->SetAttribute(domElement, AttrRadius, dialogTool->GetRadius()); doc->SetAttribute(domElement, AttrAngle1, dialogTool->GetF1()); diff --git a/src/app/tools/drawTools/vtoolbisector.cpp b/src/app/tools/drawTools/vtoolbisector.cpp index 07a136106..7aa79e7f0 100644 --- a/src/app/tools/drawTools/vtoolbisector.cpp +++ b/src/app/tools/drawTools/vtoolbisector.cpp @@ -74,9 +74,9 @@ QPointF VToolBisector::FindPoint(const QPointF &firstPoint, const QPointF &secon //--------------------------------------------------------------------------------------------------------------------- void VToolBisector::setDialog() { - Q_CHECK_PTR(dialog); + SCASSERT(dialog != nullptr); DialogBisector *dialogTool = qobject_cast(dialog); - Q_CHECK_PTR(dialogTool); + SCASSERT(dialogTool != nullptr); const VPointF *p = VAbstractTool::data.GeometricObject(id); dialogTool->setTypeLine(typeLine); dialogTool->setFormula(formula); @@ -90,9 +90,9 @@ void VToolBisector::setDialog() void VToolBisector::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data) { - Q_CHECK_PTR(dialog); + SCASSERT(dialog != nullptr); DialogBisector *dialogTool = qobject_cast(dialog); - Q_CHECK_PTR(dialogTool); + SCASSERT(dialogTool != nullptr); QString formula = dialogTool->getFormula(); const quint32 firstPointId = dialogTool->getFirstPointId(); const quint32 secondPointId = dialogTool->getSecondPointId(); @@ -232,9 +232,9 @@ void VToolBisector::RemoveReferens() //--------------------------------------------------------------------------------------------------------------------- void VToolBisector::SaveDialog(QDomElement &domElement) { - Q_CHECK_PTR(dialog); + SCASSERT(dialog != nullptr); DialogBisector *dialogTool = qobject_cast(dialog); - Q_CHECK_PTR(dialogTool); + SCASSERT(dialogTool != nullptr); doc->SetAttribute(domElement, AttrName, dialogTool->getPointName()); doc->SetAttribute(domElement, AttrTypeLine, dialogTool->getTypeLine()); doc->SetAttribute(domElement, AttrLength, dialogTool->getFormula()); diff --git a/src/app/tools/drawTools/vtoolcutarc.cpp b/src/app/tools/drawTools/vtoolcutarc.cpp index 50521d867..f9e94a570 100644 --- a/src/app/tools/drawTools/vtoolcutarc.cpp +++ b/src/app/tools/drawTools/vtoolcutarc.cpp @@ -67,9 +67,9 @@ VToolCutArc::VToolCutArc(VPattern *doc, VContainer *data, const quint32 &id, con //--------------------------------------------------------------------------------------------------------------------- void VToolCutArc::setDialog() { - Q_CHECK_PTR(dialog); + SCASSERT(dialog != nullptr); DialogCutArc *dialogTool = qobject_cast(dialog); - Q_CHECK_PTR(dialogTool); + SCASSERT(dialogTool != nullptr); const VPointF *point = VAbstractTool::data.GeometricObject(id); dialogTool->setFormula(formula); dialogTool->setArcId(arcId, id); @@ -80,9 +80,9 @@ void VToolCutArc::setDialog() void VToolCutArc::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data) { - Q_CHECK_PTR(dialog); + SCASSERT(dialog != nullptr); DialogCutArc *dialogTool = qobject_cast(dialog); - Q_CHECK_PTR(dialogTool); + SCASSERT(dialogTool != nullptr); const QString pointName = dialogTool->getPointName(); QString formula = dialogTool->getFormula(); const quint32 arcId = dialogTool->getArcId(); @@ -250,9 +250,9 @@ void VToolCutArc::RefreshGeometry() //--------------------------------------------------------------------------------------------------------------------- void VToolCutArc::SaveDialog(QDomElement &domElement) { - Q_CHECK_PTR(dialog); + SCASSERT(dialog != nullptr); DialogCutArc *dialogTool = qobject_cast(dialog); - Q_CHECK_PTR(dialogTool); + SCASSERT(dialogTool != nullptr); doc->SetAttribute(domElement, AttrName, dialogTool->getPointName()); doc->SetAttribute(domElement, AttrLength, dialogTool->getFormula()); doc->SetAttribute(domElement, AttrArc, QString().setNum(dialogTool->getArcId())); diff --git a/src/app/tools/drawTools/vtoolcutspline.cpp b/src/app/tools/drawTools/vtoolcutspline.cpp index 4e74b31d6..fac3d1e96 100644 --- a/src/app/tools/drawTools/vtoolcutspline.cpp +++ b/src/app/tools/drawTools/vtoolcutspline.cpp @@ -67,9 +67,9 @@ VToolCutSpline::VToolCutSpline(VPattern *doc, VContainer *data, const quint32 &i //--------------------------------------------------------------------------------------------------------------------- void VToolCutSpline::setDialog() { - Q_CHECK_PTR(dialog); + SCASSERT(dialog != nullptr); DialogCutSpline *dialogTool = qobject_cast(dialog); - Q_CHECK_PTR(dialogTool); + SCASSERT(dialogTool != nullptr); const VPointF *point = VAbstractTool::data.GeometricObject(id); dialogTool->setFormula(formula); dialogTool->setSplineId(splineId, id); @@ -80,9 +80,9 @@ void VToolCutSpline::setDialog() void VToolCutSpline::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data) { - Q_CHECK_PTR(dialog); + SCASSERT(dialog != nullptr); DialogCutSpline *dialogTool = qobject_cast(dialog); - Q_CHECK_PTR(dialogTool); + SCASSERT(dialogTool != nullptr); const QString pointName = dialogTool->getPointName(); QString formula = dialogTool->getFormula(); const quint32 splineId = dialogTool->getSplineId(); @@ -251,9 +251,9 @@ void VToolCutSpline::RemoveReferens() //--------------------------------------------------------------------------------------------------------------------- void VToolCutSpline::SaveDialog(QDomElement &domElement) { - Q_CHECK_PTR(dialog); + SCASSERT(dialog != nullptr); DialogCutSpline *dialogTool = qobject_cast(dialog); - Q_CHECK_PTR(dialogTool); + SCASSERT(dialogTool != nullptr); doc->SetAttribute(domElement, AttrName, dialogTool->getPointName()); doc->SetAttribute(domElement, AttrLength, dialogTool->getFormula()); doc->SetAttribute(domElement, AttrSpline, QString().setNum(dialogTool->getSplineId())); diff --git a/src/app/tools/drawTools/vtoolcutsplinepath.cpp b/src/app/tools/drawTools/vtoolcutsplinepath.cpp index e21db71cd..800ef0334 100644 --- a/src/app/tools/drawTools/vtoolcutsplinepath.cpp +++ b/src/app/tools/drawTools/vtoolcutsplinepath.cpp @@ -68,9 +68,9 @@ VToolCutSplinePath::VToolCutSplinePath(VPattern *doc, VContainer *data, const qu //--------------------------------------------------------------------------------------------------------------------- void VToolCutSplinePath::setDialog() { - Q_CHECK_PTR(dialog); + SCASSERT(dialog != nullptr); DialogCutSplinePath *dialogTool = qobject_cast(dialog); - Q_CHECK_PTR(dialogTool); + SCASSERT(dialogTool != nullptr); const VPointF *point = VAbstractTool::data.GeometricObject(id); dialogTool->setFormula(formula); dialogTool->setSplinePathId(splinePathId, id); @@ -80,9 +80,9 @@ void VToolCutSplinePath::setDialog() //--------------------------------------------------------------------------------------------------------------------- void VToolCutSplinePath::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data) { - Q_CHECK_PTR(dialog); + SCASSERT(dialog != nullptr); DialogCutSplinePath *dialogTool = qobject_cast(dialog); - Q_CHECK_PTR(dialogTool); + SCASSERT(dialogTool != nullptr); const QString pointName = dialogTool->getPointName(); QString formula = dialogTool->getFormula(); const quint32 splinePathId = dialogTool->getSplinePathId(); @@ -96,7 +96,7 @@ void VToolCutSplinePath::Create(const quint32 _id, const QString &pointName, QSt const Document::Documents &parse, const Valentina::Sources &typeCreation) { const VSplinePath *splPath = data->GeometricObject(splinePathId); - Q_CHECK_PTR(splPath); + SCASSERT(splPath != nullptr); const qreal result = CheckFormula(formula, data); @@ -326,9 +326,9 @@ void VToolCutSplinePath::RemoveReferens() //--------------------------------------------------------------------------------------------------------------------- void VToolCutSplinePath::SaveDialog(QDomElement &domElement) { - Q_CHECK_PTR(dialog); + SCASSERT(dialog != nullptr); DialogCutSplinePath *dialogTool = qobject_cast(dialog); - Q_CHECK_PTR(dialogTool); + SCASSERT(dialogTool != nullptr); doc->SetAttribute(domElement, AttrName, dialogTool->getPointName()); doc->SetAttribute(domElement, AttrLength, dialogTool->getFormula()); doc->SetAttribute(domElement, AttrSplinePath, QString().setNum(dialogTool->getSplinePathId())); diff --git a/src/app/tools/drawTools/vtoolendline.cpp b/src/app/tools/drawTools/vtoolendline.cpp index 57ecda28b..8bd8509b1 100644 --- a/src/app/tools/drawTools/vtoolendline.cpp +++ b/src/app/tools/drawTools/vtoolendline.cpp @@ -53,9 +53,9 @@ VToolEndLine::VToolEndLine(VPattern *doc, VContainer *data, const quint32 &id, //--------------------------------------------------------------------------------------------------------------------- void VToolEndLine::setDialog() { - Q_CHECK_PTR(dialog); + SCASSERT(dialog != nullptr); DialogEndLine *dialogTool = qobject_cast(dialog); - Q_CHECK_PTR(dialogTool); + SCASSERT(dialogTool != nullptr); const VPointF *p = VAbstractTool::data.GeometricObject(id); dialogTool->setTypeLine(typeLine); dialogTool->setFormula(formula); @@ -68,9 +68,9 @@ void VToolEndLine::setDialog() VToolEndLine* VToolEndLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data) { - Q_CHECK_PTR(dialog); + SCASSERT(dialog != nullptr); DialogEndLine *dialogTool = qobject_cast(dialog); - Q_CHECK_PTR(dialogTool); + SCASSERT(dialogTool); const QString pointName = dialogTool->getPointName(); const QString typeLine = dialogTool->getTypeLine(); QString formula = dialogTool->getFormula(); @@ -194,9 +194,9 @@ void VToolEndLine::RefreshDataInFile() //--------------------------------------------------------------------------------------------------------------------- void VToolEndLine::SaveDialog(QDomElement &domElement) { - Q_CHECK_PTR(dialog); + SCASSERT(dialog != nullptr); DialogEndLine *dialogTool = qobject_cast(dialog); - Q_CHECK_PTR(dialogTool); + SCASSERT(dialogTool != nullptr); doc->SetAttribute(domElement, AttrName, dialogTool->getPointName()); doc->SetAttribute(domElement, AttrTypeLine, dialogTool->getTypeLine()); doc->SetAttribute(domElement, AttrLength, dialogTool->getFormula()); diff --git a/src/app/tools/drawTools/vtoolheight.cpp b/src/app/tools/drawTools/vtoolheight.cpp index 88b92801e..d934d4ef3 100644 --- a/src/app/tools/drawTools/vtoolheight.cpp +++ b/src/app/tools/drawTools/vtoolheight.cpp @@ -51,9 +51,9 @@ VToolHeight::VToolHeight(VPattern *doc, VContainer *data, const quint32 &id, con //--------------------------------------------------------------------------------------------------------------------- void VToolHeight::setDialog() { - Q_CHECK_PTR(dialog); + SCASSERT(dialog != nullptr); DialogHeight *dialogTool = qobject_cast(dialog); - Q_CHECK_PTR(dialogTool); + SCASSERT(dialogTool != nullptr); const VPointF *p = VAbstractTool::data.GeometricObject(id); dialogTool->setTypeLine(typeLine); dialogTool->setBasePointId(basePointId, id); @@ -66,9 +66,9 @@ void VToolHeight::setDialog() void VToolHeight::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data) { - Q_CHECK_PTR(dialog); + SCASSERT(dialog != nullptr); DialogHeight *dialogTool = qobject_cast(dialog); - Q_CHECK_PTR(dialogTool); + SCASSERT(dialogTool != nullptr); disconnect(doc, &VPattern::FullUpdateFromFile, dialogTool, &DialogHeight::UpdateList); const QString pointName = dialogTool->getPointName(); const QString typeLine = dialogTool->getTypeLine(); @@ -198,9 +198,9 @@ void VToolHeight::RefreshDataInFile() //--------------------------------------------------------------------------------------------------------------------- void VToolHeight::SaveDialog(QDomElement &domElement) { - Q_CHECK_PTR(dialog); + SCASSERT(dialog != nullptr); DialogHeight *dialogTool = qobject_cast(dialog); - Q_CHECK_PTR(dialogTool); + SCASSERT(dialogTool != nullptr); doc->SetAttribute(domElement, AttrName, dialogTool->getPointName()); doc->SetAttribute(domElement, AttrTypeLine, dialogTool->getTypeLine()); doc->SetAttribute(domElement, AttrBasePoint, QString().setNum(dialogTool->getBasePointId())); diff --git a/src/app/tools/drawTools/vtoolline.cpp b/src/app/tools/drawTools/vtoolline.cpp index 49014357d..b05acb829 100644 --- a/src/app/tools/drawTools/vtoolline.cpp +++ b/src/app/tools/drawTools/vtoolline.cpp @@ -62,9 +62,9 @@ VToolLine::VToolLine(VPattern *doc, VContainer *data, quint32 id, quint32 firstP //--------------------------------------------------------------------------------------------------------------------- void VToolLine::setDialog() { - Q_CHECK_PTR(dialog); + SCASSERT(dialog != nullptr); DialogLine *dialogTool = qobject_cast(dialog); - Q_CHECK_PTR(dialogTool); + SCASSERT(dialogTool != nullptr); dialogTool->setFirstPoint(firstPoint); dialogTool->setSecondPoint(secondPoint); dialogTool->setTypeLine(typeLine); @@ -73,9 +73,9 @@ void VToolLine::setDialog() //--------------------------------------------------------------------------------------------------------------------- void VToolLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data) { - Q_CHECK_PTR(dialog); + SCASSERT(dialog != nullptr); DialogLine *dialogTool = qobject_cast(dialog); - Q_CHECK_PTR(dialogTool); + SCASSERT(dialogTool != nullptr); const quint32 firstPoint = dialogTool->getFirstPoint(); const quint32 secondPoint = dialogTool->getSecondPoint(); const QString typeLine = dialogTool->getTypeLine(); @@ -87,9 +87,9 @@ void VToolLine::Create(const quint32 &_id, const quint32 &firstPoint, const quin const QString &typeLine, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Valentina::Sources &typeCreation) { - Q_CHECK_PTR(scene); - Q_CHECK_PTR(doc); - Q_CHECK_PTR(data); + SCASSERT(scene != nullptr); + SCASSERT(doc != nullptr); + SCASSERT(data != nullptr); quint32 id = _id; if (typeCreation == Valentina::FromGui) { @@ -243,9 +243,9 @@ void VToolLine::keyReleaseEvent(QKeyEvent *event) //--------------------------------------------------------------------------------------------------------------------- void VToolLine::SaveDialog(QDomElement &domElement) { - Q_CHECK_PTR(dialog); + SCASSERT(dialog != nullptr); DialogLine *dialogTool = qobject_cast(dialog); - Q_CHECK_PTR(dialogTool); + SCASSERT(dialogTool != nullptr); doc->SetAttribute(domElement, AttrFirstPoint, QString().setNum(dialogTool->getFirstPoint())); doc->SetAttribute(domElement, AttrSecondPoint, QString().setNum(dialogTool->getSecondPoint())); doc->SetAttribute(domElement, AttrTypeLine, dialogTool->getTypeLine()); diff --git a/src/app/tools/drawTools/vtoollineintersect.cpp b/src/app/tools/drawTools/vtoollineintersect.cpp index b73cafaf0..9e0df71a5 100644 --- a/src/app/tools/drawTools/vtoollineintersect.cpp +++ b/src/app/tools/drawTools/vtoollineintersect.cpp @@ -53,9 +53,9 @@ VToolLineIntersect::VToolLineIntersect(VPattern *doc, VContainer *data, const qu //--------------------------------------------------------------------------------------------------------------------- void VToolLineIntersect::setDialog() { - Q_CHECK_PTR(dialog); + SCASSERT(dialog != nullptr); DialogLineIntersect *dialogTool = qobject_cast(dialog); - Q_CHECK_PTR(dialogTool); + SCASSERT(dialogTool != nullptr); const VPointF *p = VAbstractTool::data.GeometricObject(id); dialogTool->setP1Line1(p1Line1); dialogTool->setP2Line1(p2Line1); @@ -67,9 +67,9 @@ void VToolLineIntersect::setDialog() //--------------------------------------------------------------------------------------------------------------------- void VToolLineIntersect::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data) { - Q_CHECK_PTR(dialog); + SCASSERT(dialog != nullptr); DialogLineIntersect *dialogTool = qobject_cast(dialog); - Q_CHECK_PTR(dialogTool); + SCASSERT(dialogTool != nullptr); const quint32 p1Line1Id = dialogTool->getP1Line1(); const quint32 p2Line1Id = dialogTool->getP2Line1(); const quint32 p1Line2Id = dialogTool->getP1Line2(); @@ -217,9 +217,9 @@ void VToolLineIntersect::RemoveReferens() //--------------------------------------------------------------------------------------------------------------------- void VToolLineIntersect::SaveDialog(QDomElement &domElement) { - Q_CHECK_PTR(dialog); + SCASSERT(dialog != nullptr); DialogLineIntersect *dialogTool = qobject_cast(dialog); - Q_CHECK_PTR(dialogTool); + SCASSERT(dialogTool != nullptr); doc->SetAttribute(domElement, AttrName, dialogTool->getPointName()); doc->SetAttribute(domElement, AttrP1Line1, QString().setNum(dialogTool->getP1Line1())); doc->SetAttribute(domElement, AttrP2Line1, QString().setNum(dialogTool->getP2Line1())); diff --git a/src/app/tools/drawTools/vtoolnormal.cpp b/src/app/tools/drawTools/vtoolnormal.cpp index ef5b9ba9b..1a601436d 100644 --- a/src/app/tools/drawTools/vtoolnormal.cpp +++ b/src/app/tools/drawTools/vtoolnormal.cpp @@ -53,9 +53,9 @@ VToolNormal::VToolNormal(VPattern *doc, VContainer *data, const quint32 &id, con //--------------------------------------------------------------------------------------------------------------------- void VToolNormal::setDialog() { - Q_CHECK_PTR(dialog); + SCASSERT(dialog != nullptr); DialogNormal *dialogTool = qobject_cast(dialog); - Q_CHECK_PTR(dialogTool); + SCASSERT(dialogTool != nullptr); const VPointF *p = VAbstractTool::data.GeometricObject(id); dialogTool->setTypeLine(typeLine); dialogTool->setFormula(formula); @@ -68,9 +68,9 @@ void VToolNormal::setDialog() //--------------------------------------------------------------------------------------------------------------------- void VToolNormal::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data) { - Q_CHECK_PTR(dialog); + SCASSERT(dialog != nullptr); DialogNormal *dialogTool = qobject_cast(dialog); - Q_CHECK_PTR(dialogTool); + SCASSERT(dialogTool != nullptr); QString formula = dialogTool->getFormula(); const quint32 firstPointId = dialogTool->getFirstPointId(); const quint32 secondPointId = dialogTool->getSecondPointId(); @@ -218,9 +218,9 @@ void VToolNormal::RemoveReferens() //--------------------------------------------------------------------------------------------------------------------- void VToolNormal::SaveDialog(QDomElement &domElement) { - Q_CHECK_PTR(dialog); + SCASSERT(dialog != nullptr); DialogNormal *dialogTool = qobject_cast(dialog); - Q_CHECK_PTR(dialogTool); + SCASSERT(dialogTool != nullptr); doc->SetAttribute(domElement, AttrName, dialogTool->getPointName()); doc->SetAttribute(domElement, AttrTypeLine, dialogTool->getTypeLine()); doc->SetAttribute(domElement, AttrLength, dialogTool->getFormula()); diff --git a/src/app/tools/drawTools/vtoolpointofcontact.cpp b/src/app/tools/drawTools/vtoolpointofcontact.cpp index 25d942d7c..b374baf18 100644 --- a/src/app/tools/drawTools/vtoolpointofcontact.cpp +++ b/src/app/tools/drawTools/vtoolpointofcontact.cpp @@ -53,9 +53,9 @@ VToolPointOfContact::VToolPointOfContact(VPattern *doc, VContainer *data, const //--------------------------------------------------------------------------------------------------------------------- void VToolPointOfContact::setDialog() { - Q_CHECK_PTR(dialog); + SCASSERT(dialog != nullptr); DialogPointOfContact *dialogTool = qobject_cast(dialog); - Q_CHECK_PTR(dialogTool); + SCASSERT(dialogTool != nullptr); const VPointF *p = VAbstractTool::data.GeometricObject(id); dialogTool->setRadius(arcRadius); dialogTool->setCenter(center, id); @@ -94,9 +94,9 @@ QPointF VToolPointOfContact::FindPoint(const qreal &radius, const QPointF ¢e //--------------------------------------------------------------------------------------------------------------------- void VToolPointOfContact::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data) { - Q_CHECK_PTR(dialog); + SCASSERT(dialog != nullptr); DialogPointOfContact *dialogTool = qobject_cast(dialog); - Q_CHECK_PTR(dialogTool); + SCASSERT(dialogTool != nullptr); QString radius = dialogTool->getRadius(); const quint32 center = dialogTool->getCenter(); const quint32 firstPointId = dialogTool->getFirstPoint(); @@ -235,9 +235,9 @@ void VToolPointOfContact::RemoveReferens() //--------------------------------------------------------------------------------------------------------------------- void VToolPointOfContact::SaveDialog(QDomElement &domElement) { - Q_CHECK_PTR(dialog); + SCASSERT(dialog != nullptr); DialogPointOfContact *dialogTool = qobject_cast(dialog); - Q_CHECK_PTR(dialogTool); + SCASSERT(dialogTool != nullptr); doc->SetAttribute(domElement, AttrName, dialogTool->getPointName()); doc->SetAttribute(domElement, AttrRadius, dialogTool->getRadius()); doc->SetAttribute(domElement, AttrCenter, QString().setNum(dialogTool->getCenter())); diff --git a/src/app/tools/drawTools/vtoolpointofintersection.cpp b/src/app/tools/drawTools/vtoolpointofintersection.cpp index 9ff688a39..64db28e83 100644 --- a/src/app/tools/drawTools/vtoolpointofintersection.cpp +++ b/src/app/tools/drawTools/vtoolpointofintersection.cpp @@ -51,9 +51,9 @@ VToolPointOfIntersection::VToolPointOfIntersection(VPattern *doc, VContainer *da //--------------------------------------------------------------------------------------------------------------------- void VToolPointOfIntersection::setDialog() { - Q_CHECK_PTR(dialog); + SCASSERT(dialog != nullptr); DialogPointOfIntersection *dialogTool = qobject_cast(dialog); - Q_CHECK_PTR(dialogTool); + SCASSERT(dialogTool != nullptr); const VPointF *p = VAbstractTool::data.GeometricObject(id); dialogTool->setFirstPointId(firstPointId, id); dialogTool->setSecondPointId(secondPointId, id); @@ -64,9 +64,9 @@ void VToolPointOfIntersection::setDialog() void VToolPointOfIntersection::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data) { - Q_CHECK_PTR(dialog); + SCASSERT(dialog != nullptr); DialogPointOfIntersection *dialogTool = qobject_cast(dialog); - Q_CHECK_PTR(dialogTool); + SCASSERT(dialogTool != nullptr); const quint32 firstPointId = dialogTool->getFirstPointId(); const quint32 secondPointId = dialogTool->getSecondPointId(); const QString pointName = dialogTool->getPointName(); @@ -177,9 +177,9 @@ void VToolPointOfIntersection::RefreshDataInFile() //--------------------------------------------------------------------------------------------------------------------- void VToolPointOfIntersection::SaveDialog(QDomElement &domElement) { - Q_CHECK_PTR(dialog); + SCASSERT(dialog != nullptr); DialogPointOfIntersection *dialogTool = qobject_cast(dialog); - Q_CHECK_PTR(dialogTool); + SCASSERT(dialogTool != nullptr); doc->SetAttribute(domElement, AttrName, dialogTool->getPointName()); doc->SetAttribute(domElement, AttrFirstPoint, QString().setNum(dialogTool->getFirstPointId())); doc->SetAttribute(domElement, AttrSecondPoint, QString().setNum(dialogTool->getSecondPointId())); diff --git a/src/app/tools/drawTools/vtoolshoulderpoint.cpp b/src/app/tools/drawTools/vtoolshoulderpoint.cpp index 354aec712..1c8d1f932 100644 --- a/src/app/tools/drawTools/vtoolshoulderpoint.cpp +++ b/src/app/tools/drawTools/vtoolshoulderpoint.cpp @@ -52,9 +52,9 @@ VToolShoulderPoint::VToolShoulderPoint(VPattern *doc, VContainer *data, const qu //--------------------------------------------------------------------------------------------------------------------- void VToolShoulderPoint::setDialog() { - Q_CHECK_PTR(dialog); + SCASSERT(dialog != nullptr); DialogShoulderPoint *dialogTool = qobject_cast(dialog); - Q_CHECK_PTR(dialogTool); + SCASSERT(dialogTool != nullptr); const VPointF *p = VAbstractTool::data.GeometricObject(id); dialogTool->setTypeLine(typeLine); dialogTool->setFormula(formula); @@ -96,9 +96,9 @@ QPointF VToolShoulderPoint::FindPoint(const QPointF &p1Line, const QPointF &p2Li //--------------------------------------------------------------------------------------------------------------------- void VToolShoulderPoint::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data) { - Q_CHECK_PTR(dialog); + SCASSERT(dialog != nullptr); DialogShoulderPoint *dialogTool = qobject_cast(dialog); - Q_CHECK_PTR(dialogTool); + SCASSERT(dialogTool); QString formula = dialogTool->getFormula(); const quint32 p1Line = dialogTool->getP1Line(); const quint32 p2Line = dialogTool->getP2Line(); @@ -241,9 +241,9 @@ void VToolShoulderPoint::RemoveReferens() //--------------------------------------------------------------------------------------------------------------------- void VToolShoulderPoint::SaveDialog(QDomElement &domElement) { - Q_CHECK_PTR(dialog); + SCASSERT(dialog != nullptr); DialogShoulderPoint *dialogTool = qobject_cast(dialog); - Q_CHECK_PTR(dialogTool); + SCASSERT(dialogTool != nullptr); doc->SetAttribute(domElement, AttrName, dialogTool->getPointName()); doc->SetAttribute(domElement, AttrTypeLine, dialogTool->getTypeLine()); doc->SetAttribute(domElement, AttrLength, dialogTool->getFormula()); diff --git a/src/app/tools/drawTools/vtoolsinglepoint.cpp b/src/app/tools/drawTools/vtoolsinglepoint.cpp index 2c542cc5d..8b6b35ad1 100644 --- a/src/app/tools/drawTools/vtoolsinglepoint.cpp +++ b/src/app/tools/drawTools/vtoolsinglepoint.cpp @@ -57,9 +57,9 @@ VToolSinglePoint::VToolSinglePoint (VPattern *doc, VContainer *data, quint32 id, //--------------------------------------------------------------------------------------------------------------------- void VToolSinglePoint::setDialog() { - Q_CHECK_PTR(dialog); + SCASSERT(dialog != nullptr); DialogSinglePoint *dialogTool = qobject_cast(dialog); - Q_CHECK_PTR(dialogTool); + SCASSERT(dialogTool != nullptr); const VPointF *p = VAbstractTool::data.GeometricObject(id); dialogTool->setData(p->name(), p->toQPointF()); } @@ -145,9 +145,9 @@ void VToolSinglePoint::decrementReferens() //--------------------------------------------------------------------------------------------------------------------- void VToolSinglePoint::SaveDialog(QDomElement &domElement) { - Q_CHECK_PTR(dialog); + SCASSERT(dialog != nullptr); DialogSinglePoint *dialogTool = qobject_cast(dialog); - Q_CHECK_PTR(dialogTool); + SCASSERT(dialogTool != nullptr); QPointF p = dialogTool->getPoint(); QString name = dialogTool->getName(); doc->SetAttribute(domElement, AttrName, name); diff --git a/src/app/tools/drawTools/vtoolspline.cpp b/src/app/tools/drawTools/vtoolspline.cpp index 0e0a5e844..5b39462cd 100644 --- a/src/app/tools/drawTools/vtoolspline.cpp +++ b/src/app/tools/drawTools/vtoolspline.cpp @@ -75,9 +75,9 @@ VToolSpline::VToolSpline(VPattern *doc, VContainer *data, quint32 id, const Vale //--------------------------------------------------------------------------------------------------------------------- void VToolSpline::setDialog() { - Q_CHECK_PTR(dialog); + SCASSERT(dialog != nullptr); DialogSpline *dialogTool = qobject_cast(dialog); - Q_CHECK_PTR(dialogTool); + SCASSERT(dialogTool != nullptr); const VSpline *spl = VAbstractTool::data.GeometricObject(id); dialogTool->setP1(spl->GetP1().id()); dialogTool->setP4(spl->GetP4().id()); @@ -92,9 +92,9 @@ void VToolSpline::setDialog() void VToolSpline::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data) { - Q_CHECK_PTR(dialog); + SCASSERT(dialog != nullptr); DialogSpline *dialogTool = qobject_cast(dialog); - Q_CHECK_PTR(dialogTool); + SCASSERT(dialogTool != nullptr); const quint32 p1 = dialogTool->getP1(); const quint32 p4 = dialogTool->getP4(); const qreal kAsm1 = dialogTool->getKAsm1(); @@ -233,9 +233,9 @@ void VToolSpline::RemoveReferens() //--------------------------------------------------------------------------------------------------------------------- void VToolSpline::SaveDialog(QDomElement &domElement) { - Q_CHECK_PTR(dialog); + SCASSERT(dialog != nullptr); DialogSpline *dialogTool = qobject_cast(dialog); - Q_CHECK_PTR(dialogTool); + SCASSERT(dialogTool != nullptr); VPointF point1 = *VAbstractTool::data.GeometricObject(dialogTool->getP1()); VPointF point4 = *VAbstractTool::data.GeometricObject(dialogTool->getP4()); diff --git a/src/app/tools/drawTools/vtoolsplinepath.cpp b/src/app/tools/drawTools/vtoolsplinepath.cpp index 6d18d81a0..763edef38 100644 --- a/src/app/tools/drawTools/vtoolsplinepath.cpp +++ b/src/app/tools/drawTools/vtoolsplinepath.cpp @@ -76,9 +76,9 @@ VToolSplinePath::VToolSplinePath(VPattern *doc, VContainer *data, quint32 id, co //--------------------------------------------------------------------------------------------------------------------- void VToolSplinePath::setDialog() { - Q_CHECK_PTR(dialog); + SCASSERT(dialog != nullptr); DialogSplinePath *dialogTool = qobject_cast(dialog); - Q_CHECK_PTR(dialogTool); + SCASSERT(dialogTool != nullptr); const VSplinePath *splPath = VAbstractTool::data.GeometricObject(id); dialogTool->SetPath(*splPath); } @@ -86,9 +86,9 @@ void VToolSplinePath::setDialog() //--------------------------------------------------------------------------------------------------------------------- void VToolSplinePath::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data) { - Q_CHECK_PTR(dialog); + SCASSERT(dialog != nullptr); DialogSplinePath *dialogTool = qobject_cast(dialog); - Q_CHECK_PTR(dialogTool); + SCASSERT(dialogTool != nullptr); VSplinePath *path = new VSplinePath(dialogTool->GetPath()); for (qint32 i = 0; i < path->CountPoint(); ++i) { @@ -287,9 +287,9 @@ void VToolSplinePath::RemoveReferens() //--------------------------------------------------------------------------------------------------------------------- void VToolSplinePath::SaveDialog(QDomElement &domElement) { - Q_CHECK_PTR(dialog); + SCASSERT(dialog != nullptr); DialogSplinePath *dialogTool = qobject_cast(dialog); - Q_CHECK_PTR(dialogTool); + SCASSERT(dialogTool != nullptr); VSplinePath splPath = dialogTool->GetPath(); RefreshSplinePath(splPath); diff --git a/src/app/tools/drawTools/vtooltriangle.cpp b/src/app/tools/drawTools/vtooltriangle.cpp index 28ca05b8c..9c3aa03c0 100644 --- a/src/app/tools/drawTools/vtooltriangle.cpp +++ b/src/app/tools/drawTools/vtooltriangle.cpp @@ -52,9 +52,9 @@ VToolTriangle::VToolTriangle(VPattern *doc, VContainer *data, const quint32 &id, //--------------------------------------------------------------------------------------------------------------------- void VToolTriangle::setDialog() { - Q_CHECK_PTR(dialog); + SCASSERT(dialog != nullptr); DialogTriangle *dialogTool = qobject_cast(dialog); - Q_CHECK_PTR(dialogTool); + SCASSERT(dialogTool != nullptr); const VPointF *p = VAbstractTool::data.GeometricObject(id); dialogTool->setAxisP1Id(axisP1Id, id); dialogTool->setAxisP2Id(axisP2Id, id); @@ -67,9 +67,9 @@ void VToolTriangle::setDialog() void VToolTriangle::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data) { - Q_CHECK_PTR(dialog); + SCASSERT(dialog != nullptr); DialogTriangle *dialogTool = qobject_cast(dialog); - Q_CHECK_PTR(dialogTool); + SCASSERT(dialogTool != nullptr); const quint32 axisP1Id = dialogTool->getAxisP1Id(); const quint32 axisP2Id = dialogTool->getAxisP2Id(); const quint32 firstPointId = dialogTool->getFirstPointId(); @@ -238,9 +238,9 @@ void VToolTriangle::RefreshDataInFile() //--------------------------------------------------------------------------------------------------------------------- void VToolTriangle::SaveDialog(QDomElement &domElement) { - Q_CHECK_PTR(dialog); + SCASSERT(dialog != nullptr); DialogTriangle *dialogTool = qobject_cast(dialog); - Q_CHECK_PTR(dialogTool); + SCASSERT(dialogTool != nullptr); doc->SetAttribute(domElement, AttrName, dialogTool->getPointName()); doc->SetAttribute(domElement, AttrAxisP1, QString().setNum(dialogTool->getAxisP1Id())); doc->SetAttribute(domElement, AttrAxisP2, QString().setNum(dialogTool->getAxisP2Id())); diff --git a/src/app/tools/nodeDetails/vnodearc.cpp b/src/app/tools/nodeDetails/vnodearc.cpp index b87aeb9fb..ef409f305 100644 --- a/src/app/tools/nodeDetails/vnodearc.cpp +++ b/src/app/tools/nodeDetails/vnodearc.cpp @@ -66,7 +66,7 @@ void VNodeArc::Create(VPattern *doc, VContainer *data, quint32 id, quint32 idArc doc->IncrementReferens(idTool); //Some nodes we don't show on scene. Tool that create this nodes must free memory. VDataTool *tool = doc->getTool(idTool); - Q_CHECK_PTR(tool); + SCASSERT(tool != nullptr); arc->setParent(tool); } else diff --git a/src/app/tools/nodeDetails/vnodepoint.cpp b/src/app/tools/nodeDetails/vnodepoint.cpp index d6735f89c..6e03a5d7e 100644 --- a/src/app/tools/nodeDetails/vnodepoint.cpp +++ b/src/app/tools/nodeDetails/vnodepoint.cpp @@ -77,7 +77,7 @@ void VNodePoint::Create(VPattern *doc, VContainer *data, quint32 id, quint32 idP doc->IncrementReferens(idTool); //Some nodes we don't show on scene. Tool that create this nodes must free memory. VDataTool *tool = doc->getTool(idTool); - Q_CHECK_PTR(tool); + SCASSERT(tool != nullptr); point->setParent(tool); } else diff --git a/src/app/tools/nodeDetails/vnodespline.cpp b/src/app/tools/nodeDetails/vnodespline.cpp index bebdb7042..ef4765273 100644 --- a/src/app/tools/nodeDetails/vnodespline.cpp +++ b/src/app/tools/nodeDetails/vnodespline.cpp @@ -69,7 +69,7 @@ VNodeSpline *VNodeSpline::Create(VPattern *doc, VContainer *data, quint32 id, qu doc->IncrementReferens(idTool); //Some nodes we don't show on scene. Tool that create this nodes must free memory. VDataTool *tool = doc->getTool(idTool); - Q_CHECK_PTR(tool); + SCASSERT(tool != nullptr); spl->setParent(tool); } else diff --git a/src/app/tools/nodeDetails/vnodesplinepath.cpp b/src/app/tools/nodeDetails/vnodesplinepath.cpp index 8b2fc44fd..857a9177d 100644 --- a/src/app/tools/nodeDetails/vnodesplinepath.cpp +++ b/src/app/tools/nodeDetails/vnodesplinepath.cpp @@ -72,7 +72,7 @@ void VNodeSplinePath::Create(VPattern *doc, VContainer *data, quint32 id, quint3 doc->IncrementReferens(idTool); //Some nodes we don't show on scene. Tool that create this nodes must free memory. VDataTool *tool = doc->getTool(idTool); - Q_CHECK_PTR(tool); + SCASSERT(tool != nullptr); splPath->setParent(tool); } else diff --git a/src/app/tools/vabstracttool.cpp b/src/app/tools/vabstracttool.cpp index ce800920d..5eb477f4a 100644 --- a/src/app/tools/vabstracttool.cpp +++ b/src/app/tools/vabstracttool.cpp @@ -74,7 +74,7 @@ const QString VAbstractTool::TypeLineDashDotDotLine = QStringLiteral("dashDotDot VAbstractTool::VAbstractTool(VPattern *doc, VContainer *data, quint32 id, QObject *parent) :VDataTool(data, parent), doc(doc), id(id), baseColor(Qt::black), currentColor(Qt::black), typeLine(TypeLineLine) { - Q_CHECK_PTR(doc); + SCASSERT(doc != nullptr); connect(this, &VAbstractTool::toolhaveChange, this->doc, &VPattern::haveLiteChange); connect(this->doc, &VPattern::FullUpdateFromFile, this, &VAbstractTool::FullUpdateFromFile); connect(this, &VAbstractTool::FullUpdateTree, this->doc, &VPattern::FullUpdateTree); diff --git a/src/app/tools/vdatatool.cpp b/src/app/tools/vdatatool.cpp index ec16d4f67..0454badb5 100644 --- a/src/app/tools/vdatatool.cpp +++ b/src/app/tools/vdatatool.cpp @@ -31,7 +31,7 @@ //--------------------------------------------------------------------------------------------------------------------- VDataTool::VDataTool(VContainer *data, QObject *parent): QObject(parent), data(*data), _referens(1) { - Q_CHECK_PTR(data); + SCASSERT(data != nullptr); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/app/tools/vtooldetail.cpp b/src/app/tools/vtooldetail.cpp index c5d2dfa1c..bfd8adbd9 100644 --- a/src/app/tools/vtooldetail.cpp +++ b/src/app/tools/vtooldetail.cpp @@ -99,9 +99,9 @@ VToolDetail::~VToolDetail() //--------------------------------------------------------------------------------------------------------------------- void VToolDetail::setDialog() { - Q_CHECK_PTR(dialog); + SCASSERT(dialog != nullptr); DialogDetail *dialogTool = qobject_cast(dialog); - Q_CHECK_PTR(dialogTool); + SCASSERT(dialogTool != nullptr); VDetail detail = VAbstractTool::data.GetDetail(id); dialogTool->setDetails(detail); } @@ -109,9 +109,9 @@ void VToolDetail::setDialog() //--------------------------------------------------------------------------------------------------------------------- void VToolDetail::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data) { - Q_CHECK_PTR(dialog); + SCASSERT(dialog != nullptr); DialogDetail *dialogTool = qobject_cast(dialog); - Q_CHECK_PTR(dialogTool); + SCASSERT(dialogTool != nullptr); VDetail detail = dialogTool->getDetails(); VDetail det; for (ptrdiff_t i = 0; i< detail.CountNode(); ++i) @@ -202,9 +202,9 @@ void VToolDetail::FullUpdateFromGui(int result) QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - Q_CHECK_PTR(dialog); + SCASSERT(dialog != nullptr); DialogDetail *dialogTool = qobject_cast(dialog); - Q_CHECK_PTR(dialogTool); + SCASSERT(dialogTool != nullptr); VDetail det = dialogTool->getDetails(); doc->SetAttribute(domElement, AttrName, det.getName()); doc->SetAttribute(domElement, AttrSupplement, QString().setNum(det.getSeamAllowance())); @@ -433,9 +433,9 @@ template void VToolDetail::InitTool(VMainGraphicsScene *scene, const VNodeDetail &node) { QHash* tools = doc->getTools(); - Q_CHECK_PTR(tools); + SCASSERT(tools != nullptr); Tool *tool = qobject_cast(tools->value(node.getId())); - Q_CHECK_PTR(tool); + SCASSERT(tool != nullptr); connect(tool, &Tool::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); tool->setParentItem(this); } diff --git a/src/app/tools/vtooluniondetails.cpp b/src/app/tools/vtooluniondetails.cpp index 56fbf01fd..65d0cd63e 100644 --- a/src/app/tools/vtooluniondetails.cpp +++ b/src/app/tools/vtooluniondetails.cpp @@ -312,7 +312,7 @@ void VToolUnionDetails::UpdatePoints(const quint32 &idDetail, VContainer *data, VSplinePath *path = new VSplinePath(); path->setMode(Valentina::Modeling); const VSplinePath *splinePath = data->GeometricObject(det.at(i).getId()); - Q_CHECK_PTR(splinePath); + SCASSERT(splinePath != nullptr); qint32 k = splinePath->getMaxCountPoints(); for (qint32 i = 1; i <= splinePath->Count(); ++i) { @@ -387,9 +387,9 @@ void VToolUnionDetails::BiasRotatePoint(VPointF *point, const qreal &dx, const q //--------------------------------------------------------------------------------------------------------------------- void VToolUnionDetails::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data) { - Q_CHECK_PTR(dialog); + SCASSERT(dialog != nullptr); DialogUnionDetails *dialogTool = qobject_cast(dialog); - Q_CHECK_PTR(dialogTool); + SCASSERT(dialogTool != nullptr); VDetail d1 = data->GetDetail(dialogTool->getD1()); VDetail d2 = data->GetDetail(dialogTool->getD2()); ptrdiff_t indexD1 = dialogTool->getIndexD1(); @@ -492,16 +492,16 @@ void VToolUnionDetails::Create(const quint32 _id, const VDetail &d1, const VDeta newDetail.setName("Detail"); VToolDetail::Create(0, newDetail, scene, doc, data, parse, Valentina::FromTool); QHash* tools = doc->getTools(); - Q_CHECK_PTR(tools); + SCASSERT(tools != nullptr); { VToolDetail *toolDet = qobject_cast(tools->value(d1id)); - Q_CHECK_PTR(toolDet); + SCASSERT(toolDet != nullptr); toolDet->Remove(); } VToolDetail *toolDet = qobject_cast(tools->value(d2id)); - Q_CHECK_PTR(toolDet); + SCASSERT(toolDet != nullptr); toolDet->Remove(); } else diff --git a/src/app/widgets/doubledelegate.cpp b/src/app/widgets/doubledelegate.cpp index 8f611b1ee..e36704f77 100644 --- a/src/app/widgets/doubledelegate.cpp +++ b/src/app/widgets/doubledelegate.cpp @@ -27,8 +27,8 @@ *************************************************************************/ #include "doubledelegate.h" - #include +#include "../options.h" //--------------------------------------------------------------------------------------------------------------------- //cppcheck-suppress unusedFunction @@ -51,7 +51,7 @@ void DoubleSpinBoxDelegate::setEditorData(QWidget *editor, const QModelIndex &in qreal value = index.model()->data(index, Qt::EditRole).toDouble(); QDoubleSpinBox *spinBox = qobject_cast(editor); - Q_CHECK_PTR(spinBox); + SCASSERT(spinBox != nullptr); spinBox->setValue(value); } @@ -60,7 +60,7 @@ void DoubleSpinBoxDelegate::setEditorData(QWidget *editor, const QModelIndex &in void DoubleSpinBoxDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const { QDoubleSpinBox *spinBox = qobject_cast(editor); - Q_CHECK_PTR(spinBox); + SCASSERT(spinBox != nullptr); spinBox->interpretText(); qreal value = spinBox->value(); @@ -80,7 +80,7 @@ void DoubleSpinBoxDelegate::updateEditorGeometry(QWidget *editor, const QStyleOp void DoubleSpinBoxDelegate::commitAndCloseEditor() { QDoubleSpinBox *spinBox = qobject_cast(sender()); - Q_CHECK_PTR(spinBox); + SCASSERT(spinBox != nullptr); qreal value = spinBox->value(); if (qFuzzyCompare ( lastValue, value ) == false) { diff --git a/src/app/widgets/textdelegate.cpp b/src/app/widgets/textdelegate.cpp index 1584ebc18..d3605d3a6 100644 --- a/src/app/widgets/textdelegate.cpp +++ b/src/app/widgets/textdelegate.cpp @@ -27,8 +27,8 @@ *************************************************************************/ #include "textdelegate.h" - #include +#include "../options.h" //--------------------------------------------------------------------------------------------------------------------- TextDelegate::TextDelegate(const QString ®ex, QObject *parent): QItemDelegate(parent), lastText(QString("Name_")), @@ -56,7 +56,7 @@ void TextDelegate::setEditorData(QWidget *editor, const QModelIndex &index) cons QString text = index.model()->data(index, Qt::EditRole).toString(); QLineEdit *lineEdit = qobject_cast(editor); - Q_CHECK_PTR(lineEdit); + SCASSERT(lineEdit != nullptr); if ( lastText != text && text.isEmpty() == false) { //Here need save text, but method is const, so, we use signal instead. @@ -69,7 +69,7 @@ void TextDelegate::setEditorData(QWidget *editor, const QModelIndex &index) cons void TextDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const { QLineEdit *lineEdit = qobject_cast(editor); - Q_CHECK_PTR(lineEdit); + SCASSERT(lineEdit != nullptr); QString text = lineEdit->text(); if (text.isEmpty()) { @@ -91,7 +91,7 @@ void TextDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewI void TextDelegate::commitAndCloseEditor() { QLineEdit *lineEdit = qobject_cast(sender()); - Q_CHECK_PTR(lineEdit); + SCASSERT(lineEdit != nullptr); QString text = lineEdit->text(); if ( lastText != text && text.isEmpty() == false) { diff --git a/src/app/widgets/vtablegraphicsview.cpp b/src/app/widgets/vtablegraphicsview.cpp index 3ef25896f..54fe88337 100644 --- a/src/app/widgets/vtablegraphicsview.cpp +++ b/src/app/widgets/vtablegraphicsview.cpp @@ -31,6 +31,7 @@ #include #include #include +#include "../options.h" //--------------------------------------------------------------------------------------------------------------------- VTableGraphicsView::VTableGraphicsView(QGraphicsScene* pScene, QWidget *parent) @@ -65,7 +66,7 @@ void VTableGraphicsView::MirrorItem() for ( qint32 i = 0; i < list.count(); ++i ) { QGraphicsItem *item = list.at(i); - Q_CHECK_PTR(item); + SCASSERT(item != nullptr); QRectF itemRectOld = item->sceneBoundingRect(); //Get the current transform QTransform transform(item->transform()); @@ -178,7 +179,7 @@ void VTableGraphicsView::rotateIt() for ( qint32 i = 0; i < list.count(); ++i ) { QGraphicsItem *item = list.at(i); - Q_CHECK_PTR(item); + SCASSERT(item != nullptr); item->setTransformOriginPoint(item->boundingRect().center()); item->setRotation(item->rotation() + 90); } diff --git a/src/app/xml/vpattern.cpp b/src/app/xml/vpattern.cpp index f8ac3f864..b8c29c005 100644 --- a/src/app/xml/vpattern.cpp +++ b/src/app/xml/vpattern.cpp @@ -204,8 +204,8 @@ bool VPattern::SetNameDraw(const QString &name) //--------------------------------------------------------------------------------------------------------------------- void VPattern::Parse(const Document::Documents &parse, VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail) { - Q_CHECK_PTR(sceneDraw); - Q_CHECK_PTR(sceneDetail); + SCASSERT(sceneDraw != nullptr); + SCASSERT(sceneDetail != nullptr); QStringList tags{TagDraw, TagIncrements, TagAuthor, TagDescription, TagNotes, TagMeasurements, TagVersion}; PrepareForParse(parse, sceneDraw, sceneDetail); QDomNode domNode = documentElement().firstChild(); @@ -326,7 +326,7 @@ void VPattern::setCurrentData() void VPattern::AddTool(const quint32 &id, VDataTool *tool) { Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0"); - Q_CHECK_PTR(tool); + SCASSERT(tool != nullptr); tools.insert(id, tool); } @@ -334,9 +334,9 @@ void VPattern::AddTool(const quint32 &id, VDataTool *tool) void VPattern::UpdateToolData(const quint32 &id, VContainer *data) { Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0"); - Q_CHECK_PTR(data); + SCASSERT(data != nullptr); VDataTool *tool = tools.value(id); - Q_CHECK_PTR(tool); + SCASSERT(tool != nullptr); tool->VDataTool::setData(data); } @@ -345,7 +345,7 @@ void VPattern::IncrementReferens(quint32 id) const { Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0"); VDataTool *tool = tools.value(id); - Q_CHECK_PTR(tool); + SCASSERT(tool != nullptr); tool->incrementReferens(); } @@ -354,7 +354,7 @@ void VPattern::DecrementReferens(quint32 id) const { Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0"); VDataTool *tool = tools.value(id); - Q_CHECK_PTR(tool); + SCASSERT(tool != nullptr); tool->decrementReferens(); } @@ -675,8 +675,8 @@ void VPattern::ParseDrawElement(VMainGraphicsScene *sceneDraw, VMainGraphicsScen void VPattern::ParseDrawMode(VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail, const QDomNode &node, const Document::Documents &parse, const Valentina::Draws &mode) { - Q_CHECK_PTR(sceneDraw); - Q_CHECK_PTR(sceneDetail); + SCASSERT(sceneDraw != nullptr); + SCASSERT(sceneDetail != nullptr); VMainGraphicsScene *scene = nullptr; if (mode == Valentina::Calculation) { @@ -723,7 +723,7 @@ void VPattern::ParseDrawMode(VMainGraphicsScene *sceneDraw, VMainGraphicsScene * void VPattern::ParseDetailElement(VMainGraphicsScene *sceneDetail, const QDomElement &domElement, const Document::Documents &parse) { - Q_CHECK_PTR(sceneDetail); + SCASSERT(sceneDetail != nullptr); Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); try { @@ -791,7 +791,7 @@ void VPattern::ParseDetailElement(VMainGraphicsScene *sceneDetail, const QDomEle void VPattern::ParseDetails(VMainGraphicsScene *sceneDetail, const QDomElement &domElement, const Document::Documents &parse) { - Q_CHECK_PTR(sceneDetail); + SCASSERT(sceneDetail != nullptr); Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); QDomNode domNode = domElement.firstChild(); while (domNode.isNull() == false) @@ -815,7 +815,7 @@ void VPattern::ParseDetails(VMainGraphicsScene *sceneDetail, const QDomElement & void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElement, const Document::Documents &parse, const QString &type) { - Q_CHECK_PTR(scene); + SCASSERT(scene != nullptr); Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); Q_ASSERT_X(type.isEmpty() == false, Q_FUNC_INFO, "type of point is empty"); @@ -1315,7 +1315,7 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem void VPattern::ParseLineElement(VMainGraphicsScene *scene, const QDomElement &domElement, const Document::Documents &parse) { - Q_CHECK_PTR(scene); + SCASSERT(scene != nullptr); Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); try { @@ -1339,7 +1339,7 @@ void VPattern::ParseLineElement(VMainGraphicsScene *scene, const QDomElement &do void VPattern::ParseSplineElement(VMainGraphicsScene *scene, const QDomElement &domElement, const Document::Documents &parse, const QString &type) { - Q_CHECK_PTR(scene); + SCASSERT(scene != nullptr); Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); Q_ASSERT_X(type.isEmpty() == false, Q_FUNC_INFO, "type of spline is empty"); @@ -1461,7 +1461,7 @@ void VPattern::ParseSplineElement(VMainGraphicsScene *scene, const QDomElement & void VPattern::ParseArcElement(VMainGraphicsScene *scene, QDomElement &domElement, const Document::Documents &parse, const QString &type) { - Q_CHECK_PTR(scene); + SCASSERT(scene != nullptr); Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); Q_ASSERT_X(type.isEmpty() == false, Q_FUNC_INFO, "type of spline is empty"); @@ -1535,7 +1535,7 @@ void VPattern::ParseArcElement(VMainGraphicsScene *scene, QDomElement &domElemen void VPattern::ParseToolsElement(VMainGraphicsScene *scene, const QDomElement &domElement, const Document::Documents &parse, const QString &type) { - Q_CHECK_PTR(scene); + SCASSERT(scene != nullptr); Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); Q_ASSERT_X(type.isEmpty() == false, Q_FUNC_INFO, "type of spline is empty"); @@ -1648,8 +1648,8 @@ void VPattern::CollectId(const QDomElement &node, QVector &vector) cons void VPattern::PrepareForParse(const Document::Documents &parse, VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail) { - Q_CHECK_PTR(sceneDraw); - Q_CHECK_PTR(sceneDetail); + SCASSERT(sceneDraw != nullptr); + SCASSERT(sceneDetail != nullptr); if (parse == Document::FullParse) { TestUniqueId();