diff --git a/src/container/vcontainer.cpp b/src/container/vcontainer.cpp index e2a33e8f7..ddac8b87a 100644 --- a/src/container/vcontainer.cpp +++ b/src/container/vcontainer.cpp @@ -72,7 +72,7 @@ void VContainer::setData(const VContainer &data) qDeleteAll(gObjects); gObjects.clear(); const QHash *obj = data.DataGObjects(); - Q_ASSERT(obj != 0); + Q_CHECK_PTR(obj); QHashIterator i(*obj); while (i.hasNext()) { @@ -219,7 +219,7 @@ template void VContainer::UpdateObject(QHash &obj, const qint64 &id, val point) { Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0"); - Q_ASSERT(point != 0); + Q_CHECK_PTR(point); point->setId(id); if (gObjects.contains(id)) { @@ -359,7 +359,7 @@ void VContainer::AddLine(const qint64 &firstPointId, const qint64 &secondPointId template qint64 VContainer::AddObject(QHash &obj, val value) { - Q_ASSERT(value != 0); + Q_CHECK_PTR(value); qint64 id = getNextId(); value->setId(id); obj[id] = value; diff --git a/src/container/vcontainer.h b/src/container/vcontainer.h index 8d0d25df9..87508a6b8 100644 --- a/src/container/vcontainer.h +++ b/src/container/vcontainer.h @@ -65,7 +65,7 @@ public: void CopyGObject(const VContainer &data, const qint64 &id) { T *obj = new T(*data.GeometricObject(id)); - Q_ASSERT(obj != 0); + Q_CHECK_PTR(obj); UpdateGObject(id, obj); } /** @@ -86,7 +86,7 @@ public: throw VExceptionBadId(tr("Can't find object"), id); } T obj = dynamic_cast(gObj); - Q_ASSERT(obj != 0); + Q_CHECK_PTR(obj); return obj; } diff --git a/src/dialogs/dialogarc.cpp b/src/dialogs/dialogarc.cpp index c7899bd0f..5056dc055 100644 --- a/src/dialogs/dialogarc.cpp +++ b/src/dialogs/dialogarc.cpp @@ -196,7 +196,7 @@ void DialogArc::F2Changed() void DialogArc::CheckState() { - Q_ASSERT(bOk != 0); + Q_CHECK_PTR(bOk); bOk->setEnabled(flagRadius && flagF1 && flagF2); } @@ -224,7 +224,7 @@ void DialogArc::ShowLineAngles() ui->listWidget->clear(); connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogArc::ValChenged); const QHash *lineAnglesTable = data->DataLineAngles(); - Q_ASSERT(lineAnglesTable != 0); + Q_CHECK_PTR(lineAnglesTable); QHashIterator i(*lineAnglesTable); while (i.hasNext()) { diff --git a/src/dialogs/dialogdetail.cpp b/src/dialogs/dialogdetail.cpp index 6a9324cb6..4e7951a83 100644 --- a/src/dialogs/dialogdetail.cpp +++ b/src/dialogs/dialogdetail.cpp @@ -180,7 +180,7 @@ void DialogDetail::BiasXChanged(qreal d) { qint32 row = ui.listWidget->currentRow(); QListWidgetItem *item = ui.listWidget->item( row ); - Q_ASSERT(item != 0); + Q_CHECK_PTR(item); VNodeDetail node = qvariant_cast(item->data(Qt::UserRole)); node.setMx(toPixel(d)); item->setData(Qt::UserRole, QVariant::fromValue(node)); @@ -190,7 +190,7 @@ void DialogDetail::BiasYChanged(qreal d) { qint32 row = ui.listWidget->currentRow(); QListWidgetItem *item = ui.listWidget->item( row ); - Q_ASSERT(item != 0); + Q_CHECK_PTR(item); VNodeDetail node = qvariant_cast(item->data(Qt::UserRole)); node.setMy(toPixel(d)); item->setData(Qt::UserRole, QVariant::fromValue(node)); diff --git a/src/dialogs/dialoglineintersect.cpp b/src/dialogs/dialoglineintersect.cpp index 74899f451..4950225f2 100644 --- a/src/dialogs/dialoglineintersect.cpp +++ b/src/dialogs/dialoglineintersect.cpp @@ -170,7 +170,7 @@ void DialogLineIntersect::P2Line2Changed(int index) void DialogLineIntersect::CheckState() { - Q_ASSERT(bOk != 0); + Q_CHECK_PTR(bOk); bOk->setEnabled(flagName && flagPoint); } diff --git a/src/dialogs/dialogtool.cpp b/src/dialogs/dialogtool.cpp index b641815fa..fdb056d20 100644 --- a/src/dialogs/dialogtool.cpp +++ b/src/dialogs/dialogtool.cpp @@ -40,7 +40,7 @@ DialogTool::DialogTool(const VContainer *data, QWidget *parent) radioButtonIncrements(0), radioButtonLengthLine(0), radioButtonLengthArc(0), radioButtonLengthCurve(0), lineStyles(QStringList()) { - Q_ASSERT(data != 0); + Q_CHECK_PTR(data); timerFormula = new QTimer(this); connect(timerFormula, &QTimer::timeout, this, &DialogTool::EvalFormula); //Keep synchronize with VAbstractTool styles list!!! @@ -70,7 +70,7 @@ void DialogTool::showEvent(QShowEvent *event) void DialogTool::FillComboBoxPoints(QComboBox *box, const qint64 &id) const { - Q_ASSERT(box != 0); + Q_CHECK_PTR(box); const QHash *objs = data->DataGObjects(); QHashIterator i(*objs); QMap list; @@ -92,7 +92,7 @@ void DialogTool::FillComboBoxPoints(QComboBox *box, const qint64 &id) const void DialogTool::FillComboBoxArcs(QComboBox *box, const qint64 &id, ComboMode::ComboBoxCutArc cut) const { - Q_ASSERT(box != 0); + Q_CHECK_PTR(box); const QHash *objs = data->DataGObjects(); QHashIterator i(*objs); QMap list; @@ -129,7 +129,7 @@ void DialogTool::FillComboBoxArcs(QComboBox *box, const qint64 &id, ComboMode::C void DialogTool::FillComboBoxSplines(QComboBox *box, const qint64 &id, ComboMode::ComboBoxCutSpline cut) const { - Q_ASSERT(box != 0); + Q_CHECK_PTR(box); const QHash *objs = data->DataGObjects(); QHashIterator i(*objs); QMap list; @@ -166,7 +166,7 @@ void DialogTool::FillComboBoxSplines(QComboBox *box, const qint64 &id, ComboMode void DialogTool::FillComboBoxSplinesPath(QComboBox *box, const qint64 &id, ComboMode::ComboBoxCutSpline cut) const { - Q_ASSERT(box != 0); + Q_CHECK_PTR(box); const QHash *objs = data->DataGObjects(); QHashIterator i(*objs); QMap list; @@ -203,7 +203,7 @@ void DialogTool::FillComboBoxSplinesPath(QComboBox *box, const qint64 &id, Combo void DialogTool::FillComboBoxTypeLine(QComboBox *box) const { - Q_ASSERT(box != 0); + Q_CHECK_PTR(box); box->addItems(lineStyles); box->setCurrentIndex(1); } @@ -270,8 +270,8 @@ void DialogTool::ChangeCurrentData(QComboBox *box, const qint64 &value) const void DialogTool::PutValHere(QLineEdit *lineEdit, QListWidget *listWidget) { - Q_ASSERT(lineEdit != 0); - Q_ASSERT(listWidget != 0); + Q_CHECK_PTR(lineEdit); + Q_CHECK_PTR(listWidget); QListWidgetItem *item = listWidget->currentItem(); int pos = lineEdit->cursorPosition(); lineEdit->setText(lineEdit->text().insert(lineEdit->cursorPosition(), item->text())); @@ -281,9 +281,9 @@ void DialogTool::PutValHere(QLineEdit *lineEdit, QListWidget *listWidget) void DialogTool::ValFormulaChanged(bool &flag, QLineEdit *edit, QTimer *timer) { - Q_ASSERT(edit != 0); - Q_ASSERT(timer != 0); - Q_ASSERT(labelEditFormula != 0); + Q_CHECK_PTR(edit); + Q_CHECK_PTR(timer); + Q_CHECK_PTR(labelEditFormula); if (edit->text().isEmpty()) { flag = false; @@ -298,10 +298,10 @@ void DialogTool::ValFormulaChanged(bool &flag, QLineEdit *edit, QTimer *timer) void DialogTool::Eval(QLineEdit *edit, bool &flag, QTimer *timer, QLabel *label) { - Q_ASSERT(edit != 0); - Q_ASSERT(timer != 0); - Q_ASSERT(label != 0); - Q_ASSERT(labelEditFormula != 0); + Q_CHECK_PTR(edit); + Q_CHECK_PTR(timer); + Q_CHECK_PTR(label); + Q_CHECK_PTR(labelEditFormula); QPalette palette = labelEditFormula->palette(); if (edit->text().isEmpty()) { @@ -333,7 +333,7 @@ void DialogTool::Eval(QLineEdit *edit, bool &flag, QTimer *timer, QLabel *label) void DialogTool::setCurrentPointId(QComboBox *box, qint64 &pointId, const qint64 &value, const qint64 &id) const { - Q_ASSERT(box != 0); + Q_CHECK_PTR(box); FillComboBoxPoints(box, id); pointId = value; ChangeCurrentData(box, value); @@ -342,7 +342,7 @@ void DialogTool::setCurrentPointId(QComboBox *box, qint64 &pointId, const qint64 void DialogTool::setCurrentSplineId(QComboBox *box, qint64 &splineId, const qint64 &value, const qint64 &id, ComboMode::ComboBoxCutSpline cut) const { - Q_ASSERT(box != 0); + Q_CHECK_PTR(box); FillComboBoxSplines(box, id, cut); splineId = value; ChangeCurrentData(box, value); @@ -351,7 +351,7 @@ void DialogTool::setCurrentSplineId(QComboBox *box, qint64 &splineId, const qint void DialogTool::setCurrentArcId(QComboBox *box, qint64 &arcId, const qint64 &value, const qint64 &id, ComboMode::ComboBoxCutArc cut) const { - Q_ASSERT(box != 0); + Q_CHECK_PTR(box); FillComboBoxArcs(box, id, cut); arcId = value; ChangeCurrentData(box, value); @@ -360,7 +360,7 @@ void DialogTool::setCurrentArcId(QComboBox *box, qint64 &arcId, const qint64 &va void DialogTool::setCurrentSplinePathId(QComboBox *box, qint64 &splinePathId, const qint64 &value, const qint64 &id, ComboMode::ComboBoxCutSpline cut) const { - Q_ASSERT(box != 0); + Q_CHECK_PTR(box); FillComboBoxSplinesPath(box, id, cut); splinePathId = value; ChangeCurrentData(box, value); @@ -368,7 +368,7 @@ void DialogTool::setCurrentSplinePathId(QComboBox *box, qint64 &splinePathId, co qint64 DialogTool::getCurrentObjectId(QComboBox *box) const { - Q_ASSERT(box != 0); + Q_CHECK_PTR(box); qint32 index = box->currentIndex(); Q_ASSERT(index != -1); if (index != -1) @@ -383,7 +383,7 @@ qint64 DialogTool::getCurrentObjectId(QComboBox *box) const void DialogTool::FillList(QComboBox *box, const QMap &list) const { - Q_ASSERT(box != 0); + Q_CHECK_PTR(box); box->clear(); QMapIterator iter(list); @@ -396,7 +396,7 @@ void DialogTool::FillList(QComboBox *box, const QMap &list) con void DialogTool::CheckState() { - Q_ASSERT(bOk != 0); + Q_CHECK_PTR(bOk); bOk->setEnabled(flagFormula && flagName); } @@ -408,7 +408,7 @@ void DialogTool::ChoosedObject(qint64 id, const Scene::Scenes &type) void DialogTool::NamePointChanged() { - Q_ASSERT(labelEditNamePoint != 0); + Q_CHECK_PTR(labelEditNamePoint); QLineEdit* edit = qobject_cast(sender()); if (edit) { @@ -452,56 +452,56 @@ void DialogTool::FormulaChanged() void DialogTool::ArrowUp() { - Q_ASSERT(spinBoxAngle != 0); + Q_CHECK_PTR(spinBoxAngle); spinBoxAngle->setValue(90); } void DialogTool::ArrowDown() { - Q_ASSERT(spinBoxAngle != 0); + Q_CHECK_PTR(spinBoxAngle); spinBoxAngle->setValue(270); } void DialogTool::ArrowLeft() { - Q_ASSERT(spinBoxAngle != 0); + Q_CHECK_PTR(spinBoxAngle); spinBoxAngle->setValue(180); } void DialogTool::ArrowRight() { - Q_ASSERT(spinBoxAngle != 0); + Q_CHECK_PTR(spinBoxAngle); spinBoxAngle->setValue(0); } void DialogTool::ArrowLeftUp() { - Q_ASSERT(spinBoxAngle != 0); + Q_CHECK_PTR(spinBoxAngle); spinBoxAngle->setValue(135); } void DialogTool::ArrowLeftDown() { - Q_ASSERT(spinBoxAngle != 0); + Q_CHECK_PTR(spinBoxAngle); spinBoxAngle->setValue(225); } void DialogTool::ArrowRightUp() { - Q_ASSERT(spinBoxAngle != 0); + Q_CHECK_PTR(spinBoxAngle); spinBoxAngle->setValue(45); } void DialogTool::ArrowRightDown() { - Q_ASSERT(spinBoxAngle != 0); + Q_CHECK_PTR(spinBoxAngle); spinBoxAngle->setValue(315); } void DialogTool::EvalFormula() { - Q_ASSERT(lineEditFormula != 0); - Q_ASSERT(labelResultCalculation != 0); + Q_CHECK_PTR(lineEditFormula); + Q_CHECK_PTR(labelResultCalculation); Eval(lineEditFormula, flagFormula, timerFormula, labelResultCalculation); } @@ -542,8 +542,8 @@ void DialogTool::PutHere() void DialogTool::PutVal(QListWidgetItem *item) { - Q_ASSERT(lineEditFormula != 0); - Q_ASSERT(item != 0); + Q_CHECK_PTR(lineEditFormula); + Q_CHECK_PTR(item); int pos = lineEditFormula->cursorPosition(); lineEditFormula->setText(lineEditFormula->text().insert(lineEditFormula->cursorPosition(), item->text())); @@ -553,14 +553,14 @@ void DialogTool::PutVal(QListWidgetItem *item) void DialogTool::ValChenged(int row) { - Q_ASSERT(listWidget != 0); - Q_ASSERT(labelDescription != 0); - Q_ASSERT(radioButtonSizeGrowth != 0); - Q_ASSERT(radioButtonStandardTable != 0); - Q_ASSERT(radioButtonIncrements != 0); - Q_ASSERT(radioButtonLengthLine != 0); - Q_ASSERT(radioButtonLengthArc != 0); - Q_ASSERT(radioButtonLengthCurve != 0); + 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); if (listWidget->count() == 0) { return; @@ -621,12 +621,12 @@ void DialogTool::ValChenged(int row) void DialogTool::UpdateList() { - Q_ASSERT(radioButtonSizeGrowth != 0); - Q_ASSERT(radioButtonStandardTable != 0); - Q_ASSERT(radioButtonIncrements != 0); - Q_ASSERT(radioButtonLengthLine != 0); - Q_ASSERT(radioButtonLengthArc != 0); - Q_ASSERT(radioButtonLengthCurve != 0); + Q_CHECK_PTR(radioButtonSizeGrowth); + Q_CHECK_PTR(radioButtonStandardTable); + Q_CHECK_PTR(radioButtonIncrements); + Q_CHECK_PTR(radioButtonLengthLine); + Q_CHECK_PTR(radioButtonLengthArc); + Q_CHECK_PTR(radioButtonLengthCurve); if (radioButtonSizeGrowth->isChecked()) { @@ -657,7 +657,7 @@ void DialogTool::UpdateList() template void DialogTool::ShowVariable(const QHash *var) { - Q_ASSERT(listWidget != 0); + Q_CHECK_PTR(listWidget); disconnect(listWidget, &QListWidget::currentRowChanged, this, &DialogTool::ValChenged); listWidget->clear(); diff --git a/src/exception/vexception.cpp b/src/exception/vexception.cpp index 05557662f..89ef5189c 100644 --- a/src/exception/vexception.cpp +++ b/src/exception/vexception.cpp @@ -56,9 +56,9 @@ void VException::CriticalMessageBox(const QString &situation) const } msgBox.setIcon(QMessageBox::Critical); QSpacerItem* horizontalSpacer = new QSpacerItem(500, 0, QSizePolicy::Minimum, QSizePolicy::Expanding); - Q_ASSERT(horizontalSpacer != 0); + Q_CHECK_PTR(horizontalSpacer); QGridLayout* layout = static_cast(msgBox.layout()); - Q_ASSERT(layout != 0); + Q_CHECK_PTR(layout); layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount()); msgBox.exec(); } diff --git a/src/geometry/vequidistant.cpp b/src/geometry/vequidistant.cpp index 539dc009d..e0bb7f635 100644 --- a/src/geometry/vequidistant.cpp +++ b/src/geometry/vequidistant.cpp @@ -30,7 +30,7 @@ QPainterPath VEquidistant::ContourPath(const qint64 &idDetail, const VContainer *data) const { - Q_ASSERT(data != 0); + Q_CHECK_PTR(data); VDetail detail = data->GetDetail(idDetail); QVector points; QVector pointsEkv; diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 8a562d87e..7253c4b3e 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -307,7 +307,7 @@ void MainWindow::SetToolButton(bool checked, Tool::Tools t, const QString &curso { if (QToolButton *tButton = qobject_cast< QToolButton * >(this->sender())) { - Q_ASSERT(tButton != 0); + Q_CHECK_PTR(tButton); tButton->setChecked(true); } } diff --git a/src/tablewindow.cpp b/src/tablewindow.cpp index 8c3ff9fa1..ded1c8012 100644 --- a/src/tablewindow.cpp +++ b/src/tablewindow.cpp @@ -293,7 +293,7 @@ void TableWindow::itemColliding(QList list, int number) if (lis.size()-2 <= 0) { VItem * bitem = qgraphicsitem_cast ( listCollidingItems.at(i) ); - Q_ASSERT(bitem != 0); + Q_CHECK_PTR(bitem); bitem->setPen(QPen(Qt::black, widthMainLine)); listCollidingItems.removeAt(i); } @@ -302,7 +302,7 @@ void TableWindow::itemColliding(QList list, int number) else if (listCollidingItems.size()==1) { VItem * bitem = qgraphicsitem_cast ( listCollidingItems.at(0) ); - Q_ASSERT(bitem != 0); + Q_CHECK_PTR(bitem); bitem->setPen(QPen(Qt::black, widthMainLine)); listCollidingItems.clear(); collidingItems = true; diff --git a/src/tools/drawTools/vdrawtool.h b/src/tools/drawTools/vdrawtool.h index 8594812a2..e17a1ebd3 100644 --- a/src/tools/drawTools/vdrawtool.h +++ b/src/tools/drawTools/vdrawtool.h @@ -121,8 +121,8 @@ protected: void ContextMenu(QSharedPointer &dialog, Tool *tool, QGraphicsSceneContextMenuEvent *event, bool showRemove = true) { - Q_ASSERT(tool != 0); - Q_ASSERT(event != 0); + Q_CHECK_PTR(tool); + Q_CHECK_PTR(event); if (ignoreContextMenuEvent == false) { QMenu menu; @@ -176,7 +176,7 @@ protected: */ void ShowItem(Item *item, qint64 id, Qt::GlobalColor color, bool enable) { - Q_ASSERT(item != 0); + Q_CHECK_PTR(item); if (id == item->id) { if (enable == false) diff --git a/src/tools/drawTools/vtoolarc.cpp b/src/tools/drawTools/vtoolarc.cpp index 40fef4eb8..d6462bb3b 100644 --- a/src/tools/drawTools/vtoolarc.cpp +++ b/src/tools/drawTools/vtoolarc.cpp @@ -106,7 +106,7 @@ void VToolArc::Create(const qint64 _id, const qint64 ¢er, const QString &rad VPointF c = *data->GeometricObject(center); VArc *arc = new VArc(c, calcRadius, radius, calcF1, f1, calcF2, f2 ); - Q_ASSERT(arc != 0); + Q_CHECK_PTR(arc); qint64 id = _id; if (typeCreation == Tool::FromGui) { diff --git a/src/tools/drawTools/vtoolcutarc.cpp b/src/tools/drawTools/vtoolcutarc.cpp index 530ec0b61..0337e231f 100644 --- a/src/tools/drawTools/vtoolcutarc.cpp +++ b/src/tools/drawTools/vtoolcutarc.cpp @@ -43,13 +43,13 @@ VToolCutArc::VToolCutArc(VDomDocument *doc, VContainer *data, const qint64 &id, Q_ASSERT_X(arc2id > 0, Q_FUNC_INFO, "arc2id <= 0"); firstArc = new VSimpleArc(arc1id, ¤tColor, &factor); - Q_ASSERT(firstArc != 0); + Q_CHECK_PTR(firstArc); RefreshArc(firstArc, arc1id, SimpleArc::ForthPoint); firstArc->setParentItem(this); connect(firstArc, &VSimpleArc::Choosed, this, &VToolCutArc::ArcChoosed); secondArc = new VSimpleArc(arc2id, ¤tColor, &factor); - Q_ASSERT(secondArc != 0); + Q_CHECK_PTR(secondArc); RefreshArc(secondArc, arc2id, SimpleArc::FirstPoint); secondArc->setParentItem(this); connect(secondArc, &VSimpleArc::Choosed, this, &VToolCutArc::ArcChoosed); @@ -102,32 +102,32 @@ void VToolCutArc::Create(const qint64 _id, const QString &pointName, const QStri if (typeCreation == Tool::FromGui) { VPointF *p = new VPointF(point.x(), point.y(), pointName, mx, my); - Q_ASSERT(p != 0); + Q_CHECK_PTR(p); id = data->AddGObject(p); VArc * ar1 = new VArc(arc1); - Q_ASSERT(ar1 != 0); + Q_CHECK_PTR(ar1); arc1id = data->AddGObject(ar1); VArc * ar2 = new VArc(arc2); - Q_ASSERT(ar2 != 0); + Q_CHECK_PTR(ar2); arc2id = data->AddGObject(ar2); } else { VPointF *p = new VPointF(point.x(), point.y(), pointName, mx, my); - Q_ASSERT(p != 0); + Q_CHECK_PTR(p); data->UpdateGObject(id, p); arc1id = id + 1; arc2id = id + 2; VArc * ar1 = new VArc(arc1); - Q_ASSERT(ar1 != 0); + Q_CHECK_PTR(ar1); data->UpdateGObject(arc1id, ar1); VArc * ar2 = new VArc(arc2); - Q_ASSERT(ar2 != 0); + Q_CHECK_PTR(ar2); data->UpdateGObject(arc2id, ar2); if (parse != Document::FullParse) diff --git a/src/tools/drawTools/vtoolcutspline.cpp b/src/tools/drawTools/vtoolcutspline.cpp index 8f4fac639..c702e9c35 100644 --- a/src/tools/drawTools/vtoolcutspline.cpp +++ b/src/tools/drawTools/vtoolcutspline.cpp @@ -43,13 +43,13 @@ VToolCutSpline::VToolCutSpline(VDomDocument *doc, VContainer *data, const qint64 Q_ASSERT_X(spl2id > 0, Q_FUNC_INFO, "spl2id <= 0"); firstSpline = new VSimpleSpline(spl1id, ¤tColor, &factor); - Q_ASSERT(firstSpline != 0); + Q_CHECK_PTR(firstSpline); RefreshSpline(firstSpline, spl1id, SimpleSpline::ForthPoint); firstSpline->setParentItem(this); connect(firstSpline, &VSimpleSpline::Choosed, this, &VToolCutSpline::SplineChoosed); secondSpline = new VSimpleSpline(spl2id, ¤tColor, &factor); - Q_ASSERT(secondSpline != 0); + Q_CHECK_PTR(secondSpline); RefreshSpline(secondSpline, spl2id, SimpleSpline::FirstPoint); secondSpline->setParentItem(this); connect(secondSpline, &VSimpleSpline::Choosed, this, &VToolCutSpline::SplineChoosed); @@ -102,35 +102,35 @@ void VToolCutSpline::Create(const qint64 _id, const QString &pointName, if (typeCreation == Tool::FromGui) { VPointF *p = new VPointF(point.x(), point.y(), pointName, mx, my); - Q_ASSERT(p != 0); + Q_CHECK_PTR(p != 0); id = data->AddGObject(p); VSpline *spline1 = new VSpline(spl->GetP1(), spl1p2, spl1p3, *p, spl->GetKcurve()); - Q_ASSERT(spline1); + Q_CHECK_PTR(spline1); spl1id = data->AddGObject(spline1); data->AddLengthSpline(spline1->name(), toMM(spline1->GetLength())); VSpline *spline2 = new VSpline(*p, spl2p2, spl2p3, spl->GetP4(), spl->GetKcurve()); - Q_ASSERT(spline2); + Q_CHECK_PTR(spline2); spl2id = data->AddGObject(spline2); data->AddLengthSpline(spline2->name(), toMM(spline2->GetLength())); } else { VPointF *p = new VPointF(point.x(), point.y(), pointName, mx, my); - Q_ASSERT(p != 0); + Q_CHECK_PTR(p); data->UpdateGObject(id, p); spl1id = id + 1; spl2id = id + 2; VSpline *spline1 = new VSpline(spl->GetP1(), spl1p2, spl1p3, *p, spl->GetKcurve()); - Q_ASSERT(spline1); + Q_CHECK_PTR(spline1); data->UpdateGObject(spl1id, spline1); data->AddLengthSpline(spline1->name(), toMM(spline1->GetLength())); VSpline *spline2 = new VSpline(*p, spl2p2, spl2p3, spl->GetP4(), spl->GetKcurve()); - Q_ASSERT(spline2); + Q_CHECK_PTR(spline2); data->UpdateGObject(spl2id, spline2); data->AddLengthSpline(spline2->name(), toMM(spline2->GetLength())); diff --git a/src/tools/drawTools/vtoolcutsplinepath.cpp b/src/tools/drawTools/vtoolcutsplinepath.cpp index eb95355db..fa6e20b2b 100644 --- a/src/tools/drawTools/vtoolcutsplinepath.cpp +++ b/src/tools/drawTools/vtoolcutsplinepath.cpp @@ -45,13 +45,13 @@ VToolCutSplinePath::VToolCutSplinePath(VDomDocument *doc, VContainer *data, cons Q_ASSERT_X(splPath2id > 0, Q_FUNC_INFO, "spl2id <= 0"); firstSpline = new VSimpleSpline(splPath1id, ¤tColor, &factor); - Q_ASSERT(firstSpline != 0); + Q_CHECK_PTR(firstSpline); RefreshSpline(firstSpline, splPath1id, SimpleSpline::ForthPoint); firstSpline->setParentItem(this); connect(firstSpline, &VSimpleSpline::Choosed, this, &VToolCutSplinePath::SplineChoosed); secondSpline = new VSimpleSpline(splPath2id, ¤tColor, &factor); - Q_ASSERT(secondSpline != 0); + Q_CHECK_PTR(secondSpline); RefreshSpline(secondSpline, splPath2id, SimpleSpline::FirstPoint); secondSpline->setParentItem(this); connect(secondSpline, &VSimpleSpline::Choosed, this, &VToolCutSplinePath::SplineChoosed); @@ -105,7 +105,7 @@ void VToolCutSplinePath::Create(const qint64 _id, const QString &pointName, cons if (typeCreation == Tool::FromGui) { VPointF *p = new VPointF(point.x(), point.y(), pointName, mx, my); - Q_ASSERT(p); + Q_CHECK_PTR(p); id = data->AddGObject(p); splPath1id = id + 1; splPath2id = id + 2; @@ -117,9 +117,9 @@ void VToolCutSplinePath::Create(const qint64 _id, const QString &pointName, cons VSplinePath *splPath1 = new VSplinePath(); - Q_ASSERT(splPath1); + Q_CHECK_PTR(splPath1); VSplinePath *splPath2 = new VSplinePath(); - Q_ASSERT(splPath2); + Q_CHECK_PTR(splPath2); for (qint32 i = 0; i < splPath->CountPoint(); i++) { if (i <= p1 && i < p2) @@ -159,7 +159,7 @@ void VToolCutSplinePath::Create(const qint64 _id, const QString &pointName, cons else { VPointF *p = new VPointF(point.x(), point.y(), pointName, mx, my); - Q_ASSERT(p); + Q_CHECK_PTR(p); data->UpdateGObject(id, p); splPath1id = id + 1; @@ -171,9 +171,9 @@ void VToolCutSplinePath::Create(const qint64 _id, const QString &pointName, cons VSpline spl2 = VSpline(*p, spl2p2, spl2p3, splP2.P(), splPath->getKCurve()); VSplinePath *splPath1 = new VSplinePath(); - Q_ASSERT(splPath1 != 0); + Q_CHECK_PTR(splPath1); VSplinePath *splPath2 = new VSplinePath(); - Q_ASSERT(splPath2 != 0); + Q_CHECK_PTR(splPath2); for (qint32 i = 0; i < splPath->CountPoint(); i++) { if (i <= p1 && i < p2) diff --git a/src/tools/drawTools/vtoolline.cpp b/src/tools/drawTools/vtoolline.cpp index d7af297ce..f97520df5 100644 --- a/src/tools/drawTools/vtoolline.cpp +++ b/src/tools/drawTools/vtoolline.cpp @@ -74,9 +74,9 @@ void VToolLine::Create(const qint64 &_id, const qint64 &firstPoint, const qint64 VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation) { - Q_ASSERT(scene != 0); - Q_ASSERT(doc != 0); - Q_ASSERT(data != 0); + Q_CHECK_PTR(scene); + Q_CHECK_PTR(doc); + Q_CHECK_PTR(data); qint64 id = _id; if (typeCreation == Tool::FromGui) { @@ -96,7 +96,7 @@ void VToolLine::Create(const qint64 &_id, const qint64 &firstPoint, const qint64 if (parse == Document::FullParse) { VToolLine *line = new VToolLine(doc, data, id, firstPoint, secondPoint, typeCreation); - Q_ASSERT(line != 0); + Q_CHECK_PTR(line); scene->addItem(line); connect(line, &VToolLine::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); connect(scene, &VMainGraphicsScene::NewFactor, line, &VToolLine::SetFactor); diff --git a/src/tools/drawTools/vtoolpoint.cpp b/src/tools/drawTools/vtoolpoint.cpp index 0f33e5bd9..4baf9a1d6 100644 --- a/src/tools/drawTools/vtoolpoint.cpp +++ b/src/tools/drawTools/vtoolpoint.cpp @@ -34,11 +34,11 @@ VToolPoint::VToolPoint(VDomDocument *doc, VContainer *data, qint64 id, QGraphics QGraphicsEllipseItem(parent), radius(toPixel(2)), namePoint(0), lineName(0) { namePoint = new VGraphicsSimpleTextItem(this); - Q_ASSERT(namePoint != 0); + Q_CHECK_PTR(namePoint); connect(namePoint, &VGraphicsSimpleTextItem::ShowContextMenu, this, &VToolPoint::ShowContextMenu); namePoint->setBrush(Qt::black); lineName = new QGraphicsLineItem(this); - Q_ASSERT(lineName != 0); + Q_CHECK_PTR(lineName); lineName->setPen(QPen(Qt::black)); connect(namePoint, &VGraphicsSimpleTextItem::NameChangePosition, this, &VToolPoint::NameChangePosition); this->setBrush(QBrush(Qt::NoBrush)); @@ -51,7 +51,7 @@ VToolPoint::VToolPoint(VDomDocument *doc, VContainer *data, qint64 id, QGraphics void VToolPoint::NameChangePosition(const QPointF &pos) { VPointF *point = new VPointF(*VAbstractTool::data.GeometricObject(id)); - Q_ASSERT(point != 0); + Q_CHECK_PTR(point); QPointF p = pos - this->pos(); point->setMx(p.x()); point->setMy(p.y()); diff --git a/src/tools/drawTools/vtoolspline.cpp b/src/tools/drawTools/vtoolspline.cpp index 102a9a34d..4a1330305 100644 --- a/src/tools/drawTools/vtoolspline.cpp +++ b/src/tools/drawTools/vtoolspline.cpp @@ -110,7 +110,7 @@ void VToolSpline::Create(const qint64 _id, const qint64 &p1, const qint64 &p4, c VPointF point1 = *data->GeometricObject(p1); VPointF point4 = *data->GeometricObject(p4); VSpline *spline = new VSpline(point1, point4, angle1, angle2, kAsm1, kAsm2, kCurve); - Q_ASSERT(spline != 0); + Q_CHECK_PTR(spline); qint64 id = _id; if (typeCreation == Tool::FromGui) { diff --git a/src/tools/drawTools/vtoolsplinepath.cpp b/src/tools/drawTools/vtoolsplinepath.cpp index 4ec238d9c..89cb8d2e7 100644 --- a/src/tools/drawTools/vtoolsplinepath.cpp +++ b/src/tools/drawTools/vtoolsplinepath.cpp @@ -86,7 +86,7 @@ void VToolSplinePath::Create(QSharedPointer &dialog, VMainGrap VDomDocument *doc, VContainer *data) { VSplinePath *path = new VSplinePath(dialog->GetPath()); - Q_ASSERT(path); + Q_CHECK_PTR(path); for (qint32 i = 0; i < path->CountPoint(); ++i) { doc->IncrementReferens((*path)[i].P().id()); diff --git a/src/tools/nodeDetails/vnodearc.cpp b/src/tools/nodeDetails/vnodearc.cpp index 8eeb63a37..ebda652c1 100644 --- a/src/tools/nodeDetails/vnodearc.cpp +++ b/src/tools/nodeDetails/vnodearc.cpp @@ -57,14 +57,14 @@ void VNodeArc::Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idA if (parse == Document::FullParse) { VNodeArc *arc = new VNodeArc(doc, data, id, idArc, typeCreation, idTool, parent); - Q_ASSERT(arc != 0); + Q_CHECK_PTR(arc); doc->AddTool(id, arc); if (idTool != 0) { 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_ASSERT(tool != 0); + Q_CHECK_PTR(tool); arc->setParent(tool); } else diff --git a/src/tools/nodeDetails/vnodepoint.cpp b/src/tools/nodeDetails/vnodepoint.cpp index 63946d64f..d86fbccd8 100644 --- a/src/tools/nodeDetails/vnodepoint.cpp +++ b/src/tools/nodeDetails/vnodepoint.cpp @@ -68,14 +68,14 @@ void VNodePoint::Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 i //TODO Need create garbage collector and remove all nodes, what we don't use. //Better check garbage before each saving file. Check only modeling tags. VNodePoint *point = new VNodePoint(doc, data, id, idPoint, typeCreation, idTool, parent); - Q_ASSERT(point != 0); + Q_CHECK_PTR(point); doc->AddTool(id, point); if (idTool != 0) { 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_ASSERT(tool != 0); + Q_CHECK_PTR(tool); point->setParent(tool); } else diff --git a/src/tools/nodeDetails/vnodespline.cpp b/src/tools/nodeDetails/vnodespline.cpp index 51687667a..7ec99d27b 100644 --- a/src/tools/nodeDetails/vnodespline.cpp +++ b/src/tools/nodeDetails/vnodespline.cpp @@ -66,7 +66,7 @@ VNodeSpline *VNodeSpline::Create(VDomDocument *doc, VContainer *data, qint64 id, 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_ASSERT(tool != 0); + Q_CHECK_PTR(tool); spl->setParent(tool); } else diff --git a/src/tools/nodeDetails/vnodesplinepath.cpp b/src/tools/nodeDetails/vnodesplinepath.cpp index 06a801413..54dc91ea5 100644 --- a/src/tools/nodeDetails/vnodesplinepath.cpp +++ b/src/tools/nodeDetails/vnodesplinepath.cpp @@ -59,7 +59,7 @@ void VNodeSplinePath::Create(VDomDocument *doc, VContainer *data, qint64 id, qin if (parse == Document::FullParse) { VNodeSplinePath *splPath = new VNodeSplinePath(doc, data, id, idSpline, typeCreation, idTool, parent); - Q_ASSERT(splPath != 0); + Q_CHECK_PTR(splPath); doc->AddTool(id, splPath); const VSplinePath *path = data->GeometricObject(id); const QVector *points = path->GetPoint(); @@ -70,7 +70,7 @@ void VNodeSplinePath::Create(VDomDocument *doc, VContainer *data, qint64 id, qin 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_ASSERT(tool != 0); + Q_CHECK_PTR(tool); splPath->setParent(tool); } else diff --git a/src/tools/vabstracttool.cpp b/src/tools/vabstracttool.cpp index e552ccb58..a6565200f 100644 --- a/src/tools/vabstracttool.cpp +++ b/src/tools/vabstracttool.cpp @@ -72,7 +72,7 @@ const QString VAbstractTool::TypeLineDashDotDotLine = QStringLiteral("dashDotDot VAbstractTool::VAbstractTool(VDomDocument *doc, VContainer *data, qint64 id, QObject *parent) :VDataTool(data, parent), doc(doc), id(id), baseColor(Qt::black), currentColor(Qt::black), typeLine(TypeLineLine) { - Q_ASSERT(doc != 0); + Q_CHECK_PTR(doc); connect(this, &VAbstractTool::toolhaveChange, this->doc, &VDomDocument::haveLiteChange); connect(this->doc, &VDomDocument::FullUpdateFromFile, this, &VAbstractTool::FullUpdateFromFile); connect(this, &VAbstractTool::FullUpdateTree, this->doc, &VDomDocument::FullUpdateTree); diff --git a/src/tools/vdatatool.cpp b/src/tools/vdatatool.cpp index fe6b58ec4..5d857321a 100644 --- a/src/tools/vdatatool.cpp +++ b/src/tools/vdatatool.cpp @@ -30,7 +30,7 @@ VDataTool::VDataTool(VContainer *data, QObject *parent): QObject(parent), data(*data), _referens(1) { - Q_ASSERT(data != 0); + Q_CHECK_PTR(data); } VDataTool &VDataTool::operator =(const VDataTool &tool) diff --git a/src/tools/vtooldetail.cpp b/src/tools/vtooldetail.cpp index bab623d8b..9705801c8 100644 --- a/src/tools/vtooldetail.cpp +++ b/src/tools/vtooldetail.cpp @@ -390,9 +390,9 @@ template void VToolDetail::InitTool(VMainGraphicsScene *scene, const VNodeDetail &node) { QHash* tools = doc->getTools(); - Q_ASSERT(tools != 0); + Q_CHECK_PTR(tools); Tool *tool = qobject_cast(tools->value(node.getId())); - Q_ASSERT(tool != 0); + Q_CHECK_PTR(tool); connect(tool, &Tool::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); tool->setParentItem(this); } diff --git a/src/tools/vtooldetail.h b/src/tools/vtooldetail.h index 51d1ac78f..f676e28c5 100644 --- a/src/tools/vtooldetail.h +++ b/src/tools/vtooldetail.h @@ -67,7 +67,7 @@ public: { //We can't use exist object. Need create new. T *node = new T(*data->GeometricObject(id)); - Q_ASSERT(node != 0); + Q_CHECK_PTR(node); node->setMode(Draw::Modeling); return data->AddGObject(node); } diff --git a/src/tools/vtooluniondetails.cpp b/src/tools/vtooluniondetails.cpp index 834763205..2a17f780a 100644 --- a/src/tools/vtooluniondetails.cpp +++ b/src/tools/vtooluniondetails.cpp @@ -72,13 +72,13 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VDomDocument *doc, VContai else { VPointF *point = new VPointF(*data->GeometricObject(det.at(i).getId())); - Q_ASSERT(point != 0); + Q_CHECK_PTR(point); point->setMode(Draw::Modeling); BiasRotatePoint(point, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); idObject = data->AddGObject(point); VPointF *point1 = new VPointF(*point); - Q_ASSERT(point1 != 0); + Q_CHECK_PTR(point1); point1->setMode(Draw::Modeling); id = data->AddGObject(point1); VNodePoint::Create(doc, data, id, idObject, Document::FullParse, Tool::FromGui, idTool, tool); @@ -99,7 +99,7 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VDomDocument *doc, VContai VPointF p2 = VPointF(arc->GetP2().x(), arc->GetP2().y(), "A", 0, 0); BiasRotatePoint(&p2, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); VPointF *center = new VPointF(arc->GetCenter()); - Q_ASSERT(center != 0); + Q_CHECK_PTR(center); BiasRotatePoint(center, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); @@ -111,12 +111,12 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VDomDocument *doc, VContai VArc *arc1 = new VArc(*center, arc->GetRadius(), arc->GetFormulaRadius(), l1.angle(), QString().setNum(l1.angle()), l2.angle(), QString().setNum(l2.angle())); - Q_ASSERT(arc1 != 0); + Q_CHECK_PTR(arc1); arc1->setMode(Draw::Modeling); idObject = data->AddGObject(arc1); VArc *arc2 = new VArc(*arc1); - Q_ASSERT(arc2 != 0); + Q_CHECK_PTR(arc2); arc2->setMode(Draw::Modeling); id = data->AddGObject(arc2); @@ -135,7 +135,7 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VDomDocument *doc, VContai const VSpline *spline = data->GeometricObject(det.at(i).getId()); VPointF *p1 = new VPointF(spline->GetP1()); - Q_ASSERT(p1 != 0); + Q_CHECK_PTR(p1); BiasRotatePoint(p1, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); qint64 idP1 = data->AddGObject(p1); @@ -146,17 +146,17 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VDomDocument *doc, VContai BiasRotatePoint(&p3, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); VPointF *p4 = new VPointF(spline->GetP4()); - Q_ASSERT(p4 != 0); + Q_CHECK_PTR(p4); BiasRotatePoint(p4, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); qint64 idP4 = data->AddGObject(p4); VSpline *spl = new VSpline(*p1, p2.toQPointF(), p3.toQPointF(), *p4, spline->GetKcurve(), 0, Draw::Modeling); - Q_ASSERT(spl != 0); + Q_CHECK_PTR(spl); idObject = data->AddGObject(spl); VSpline *spl1 = new VSpline(*spl); - Q_ASSERT(spl1 != 0); + Q_CHECK_PTR(spl1); spl1->setMode(Draw::Modeling); id = data->AddGObject(spl1); VNodeSpline::Create(doc, data, id, idObject, Document::FullParse, Tool::FromGui, idTool, tool); @@ -172,7 +172,7 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VDomDocument *doc, VContai else { VSplinePath *path = new VSplinePath(); - Q_ASSERT(path != 0); + Q_CHECK_PTR(path); path->setMode(Draw::Modeling); const VSplinePath *splinePath = data->GeometricObject(det.at(i).getId()); qint32 k = splinePath->getMaxCountPoints(); @@ -183,7 +183,7 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VDomDocument *doc, VContai splinePath->at(i).KAsm1(), splinePath->getKCurve()); VPointF *p1 = new VPointF(spline.GetP1()); - Q_ASSERT(p1 != 0); + Q_CHECK_PTR(p1); BiasRotatePoint(p1, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); qint64 idP1 = data->AddGObject(p1); @@ -198,7 +198,7 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VDomDocument *doc, VContai angle); VPointF *p4 = new VPointF(spline.GetP4()); - Q_ASSERT(p4 != 0); + Q_CHECK_PTR(p4); BiasRotatePoint(p4, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); qint64 idP4 = data->AddGObject(p4); @@ -221,7 +221,7 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VDomDocument *doc, VContai idObject = data->AddGObject(path); VSplinePath *path1 = new VSplinePath(*path); - Q_ASSERT(path1 != 0); + Q_CHECK_PTR(path1); path1->setMode(Draw::Modeling); id = data->AddGObject(path1); VNodeSplinePath::Create(doc, data, id, idObject, Document::FullParse, Tool::FromGui, idTool, tool); @@ -246,7 +246,7 @@ void VToolUnionDetails::UpdatePoints(const qint64 &idDetail, VContainer *data, c if (qFuzzyCompare(dx+1, 1) == false || qFuzzyCompare(dy+1, 1) == false || pRotate != 0) { VPointF *point = new VPointF(*data->GeometricObject(det.at(i).getId())); - Q_ASSERT(point != 0); + Q_CHECK_PTR(point); point->setMode(Draw::Modeling); BiasRotatePoint(point, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); ++idCount; @@ -266,7 +266,7 @@ void VToolUnionDetails::UpdatePoints(const qint64 &idDetail, VContainer *data, c VPointF p2 = VPointF(arc->GetP2()); BiasRotatePoint(&p2, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); VPointF *center = new VPointF(arc->GetCenter()); - Q_ASSERT(center != 0); + Q_CHECK_PTR(center); BiasRotatePoint(center, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); @@ -277,7 +277,7 @@ void VToolUnionDetails::UpdatePoints(const qint64 &idDetail, VContainer *data, c data->UpdateGObject(idDetail+idCount, center); VArc *arc1 = new VArc(*center, arc->GetRadius(), arc->GetFormulaRadius(), l1.angle(), QString().setNum(l1.angle()), l2.angle(), QString().setNum(l2.angle())); - Q_ASSERT(arc1); + Q_CHECK_PTR(arc1); arc1->setMode(Draw::Modeling); ++idCount; data->UpdateGObject(idDetail+idCount, arc1); @@ -293,7 +293,7 @@ void VToolUnionDetails::UpdatePoints(const qint64 &idDetail, VContainer *data, c const VSpline *spline = data->GeometricObject(det.at(i).getId()); VPointF *p1 = new VPointF(spline->GetP1()); - Q_ASSERT(p1 != 0); + Q_CHECK_PTR(p1); BiasRotatePoint(p1, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); ++idCount; data->UpdateGObject(idDetail+idCount, p1); @@ -305,7 +305,7 @@ void VToolUnionDetails::UpdatePoints(const qint64 &idDetail, VContainer *data, c BiasRotatePoint(&p3, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); VPointF *p4 = new VPointF(spline->GetP4()); - Q_ASSERT(p4 != 0); + Q_CHECK_PTR(p4); BiasRotatePoint(p4, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); ++idCount; data->UpdateGObject(idDetail+idCount, p4); @@ -313,7 +313,7 @@ void VToolUnionDetails::UpdatePoints(const qint64 &idDetail, VContainer *data, c VSpline *spl = new VSpline(*p1, p2.toQPointF(), p3.toQPointF(), *p4, spline->GetKcurve(), 0, Draw::Modeling); - Q_ASSERT(spl != 0); + Q_CHECK_PTR(spl); ++idCount; data->UpdateGObject(idDetail+idCount, spl); @@ -326,10 +326,10 @@ void VToolUnionDetails::UpdatePoints(const qint64 &idDetail, VContainer *data, c if (qFuzzyCompare(dx+1, 1) == false || qFuzzyCompare(dy+1, 1) == false || pRotate != 0) { VSplinePath *path = new VSplinePath(); - Q_ASSERT(path != 0); + Q_CHECK_PTR(path); path->setMode(Draw::Modeling); const VSplinePath *splinePath = data->GeometricObject(det.at(i).getId()); - Q_ASSERT(splinePath != 0); + Q_CHECK_PTR(splinePath); qint32 k = splinePath->getMaxCountPoints(); for (qint32 i = 1; i <= splinePath->Count(); ++i) { @@ -338,7 +338,7 @@ void VToolUnionDetails::UpdatePoints(const qint64 &idDetail, VContainer *data, c splinePath->at(i).KAsm1(), splinePath->getKCurve()); VPointF *p1 = new VPointF(spline.GetP1()); - Q_ASSERT(p1 != 0); + Q_CHECK_PTR(p1); BiasRotatePoint(p1, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); ++idCount; @@ -354,7 +354,7 @@ void VToolUnionDetails::UpdatePoints(const qint64 &idDetail, VContainer *data, c angle); VPointF *p4 = new VPointF(spline.GetP4()); - Q_ASSERT(p4 != 0); + Q_CHECK_PTR(p4); BiasRotatePoint(p4, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); ++idCount; diff --git a/src/widgets/doubledelegate.cpp b/src/widgets/doubledelegate.cpp index b710ffdc8..1b2bccf23 100644 --- a/src/widgets/doubledelegate.cpp +++ b/src/widgets/doubledelegate.cpp @@ -37,7 +37,7 @@ QWidget *DoubleSpinBoxDelegate::createEditor(QWidget *parent, const QStyleOption Q_UNUSED(option); Q_UNUSED(index); QDoubleSpinBox *editor = new QDoubleSpinBox(parent); - Q_ASSERT(editor != 0); + Q_CHECK_PTR(editor); editor->setMinimum(-10000.0); editor->setMaximum(10000.0); connect(editor, &QDoubleSpinBox::editingFinished, this, &DoubleSpinBoxDelegate::commitAndCloseEditor); @@ -50,7 +50,7 @@ void DoubleSpinBoxDelegate::setEditorData(QWidget *editor, const QModelIndex &in qreal value = index.model()->data(index, Qt::EditRole).toDouble(); QDoubleSpinBox *spinBox = qobject_cast(editor); - Q_ASSERT(spinBox != 0); + Q_CHECK_PTR(spinBox); spinBox->setValue(value); } @@ -58,7 +58,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_ASSERT(spinBox != 0); + Q_CHECK_PTR(spinBox); spinBox->interpretText(); qreal value = spinBox->value(); @@ -76,7 +76,7 @@ void DoubleSpinBoxDelegate::updateEditorGeometry(QWidget *editor, const QStyleOp void DoubleSpinBoxDelegate::commitAndCloseEditor() { QDoubleSpinBox *spinBox = qobject_cast(sender()); - Q_ASSERT(spinBox != 0); + Q_CHECK_PTR(spinBox); qreal value = spinBox->value(); if (qFuzzyCompare ( lastValue, value ) == false) { diff --git a/src/widgets/vmaingraphicsview.cpp b/src/widgets/vmaingraphicsview.cpp index 7bb45251c..ada2d8c81 100644 --- a/src/widgets/vmaingraphicsview.cpp +++ b/src/widgets/vmaingraphicsview.cpp @@ -54,7 +54,7 @@ void VMainGraphicsView::wheelEvent(QWheelEvent *event) } QTimeLine *anim = new QTimeLine(300, this); - Q_ASSERT(anim != 0); + Q_CHECK_PTR(anim); anim->setUpdateInterval(20); if (QApplication::keyboardModifiers() == Qt::ControlModifier) diff --git a/src/widgets/vtablegraphicsview.cpp b/src/widgets/vtablegraphicsview.cpp index 44dee0872..2e99a518c 100644 --- a/src/widgets/vtablegraphicsview.cpp +++ b/src/widgets/vtablegraphicsview.cpp @@ -62,7 +62,7 @@ void VTableGraphicsView::MirrorItem() for ( qint32 i = 0; i < list.count(); ++i ) { QGraphicsItem *item = list.at(i); - Q_ASSERT(item != 0); + Q_CHECK_PTR(item); QRectF itemRectOld = item->sceneBoundingRect(); //Get the current transform QTransform transform(item->transform()); @@ -170,7 +170,7 @@ void VTableGraphicsView::rotateIt() for ( qint32 i = 0; i < list.count(); ++i ) { QGraphicsItem *item = list.at(i); - Q_ASSERT(item != 0); + Q_CHECK_PTR(item); item->setTransformOriginPoint(item->boundingRect().center()); item->setRotation(item->rotation() + 90); } diff --git a/src/xml/vdomdocument.cpp b/src/xml/vdomdocument.cpp index 2ba893dab..8147ce4f0 100644 --- a/src/xml/vdomdocument.cpp +++ b/src/xml/vdomdocument.cpp @@ -335,8 +335,8 @@ bool VDomDocument::GetActivNodeElement(const QString& name, QDomElement &element void VDomDocument::Parse(const Document::Documents &parse, VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail) { - Q_ASSERT(sceneDraw != 0); - Q_ASSERT(sceneDetail != 0); + Q_CHECK_PTR(sceneDraw); + Q_CHECK_PTR(sceneDetail); if (parse == Document::FullParse) { TestUniqueId(); @@ -577,8 +577,8 @@ void VDomDocument::ParseDrawElement(VMainGraphicsScene *sceneDraw, VMainGraphics void VDomDocument::ParseDrawMode(VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail, const QDomNode& node, const Document::Documents &parse, const Draw::Draws &mode) { - Q_ASSERT(sceneDraw != 0); - Q_ASSERT(sceneDetail != 0); + Q_CHECK_PTR(sceneDraw); + Q_CHECK_PTR(sceneDetail); VMainGraphicsScene *scene = 0; if (mode == Draw::Calculation) { @@ -627,7 +627,7 @@ void VDomDocument::ParseDrawMode(VMainGraphicsScene *sceneDraw, VMainGraphicsSce void VDomDocument::ParseDetailElement(VMainGraphicsScene *sceneDetail, const QDomElement &domElement, const Document::Documents &parse) { - Q_ASSERT(sceneDetail != 0); + Q_CHECK_PTR(sceneDetail); Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); try { @@ -697,7 +697,7 @@ void VDomDocument::ParseDetailElement(VMainGraphicsScene *sceneDetail, const QDo void VDomDocument::ParseDetails(VMainGraphicsScene *sceneDetail, const QDomElement &domElement, const Document::Documents &parse) { - Q_ASSERT(sceneDetail != 0); + Q_CHECK_PTR(sceneDetail); Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); QDomNode domNode = domElement.firstChild(); while (domNode.isNull() == false) @@ -720,7 +720,7 @@ void VDomDocument::ParseDetails(VMainGraphicsScene *sceneDetail, const QDomEleme void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElement& domElement, const Document::Documents &parse, const QString& type) { - Q_ASSERT(scene != 0); + Q_CHECK_PTR(scene); 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"); if (type == VToolSinglePoint::ToolType) @@ -744,7 +744,7 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen if (parse == Document::FullParse) { spoint = new VToolSinglePoint(this, data, id, Tool::FromFile); - Q_ASSERT(spoint != 0); + Q_CHECK_PTR(spoint); scene->addItem(spoint); connect(spoint, &VToolSinglePoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); connect(scene, &VMainGraphicsScene::NewFactor, spoint, &VToolSinglePoint::SetFactor); @@ -1093,7 +1093,7 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen void VDomDocument::ParseLineElement(VMainGraphicsScene *scene, const QDomElement &domElement, const Document::Documents &parse) { - Q_ASSERT(scene != 0); + Q_CHECK_PTR(scene); Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); try { @@ -1114,7 +1114,7 @@ void VDomDocument::ParseLineElement(VMainGraphicsScene *scene, const QDomElement void VDomDocument::ParseSplineElement(VMainGraphicsScene *scene, const QDomElement &domElement, const Document::Documents &parse, const QString &type) { - Q_ASSERT(scene != 0); + Q_CHECK_PTR(scene); 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"); if (type == VToolSpline::ToolType) @@ -1148,7 +1148,7 @@ void VDomDocument::ParseSplineElement(VMainGraphicsScene *scene, const QDomEleme qint64 id = GetParametrId(domElement); qreal kCurve = GetParametrDouble(domElement, VAbstractTool::AttrKCurve, "1.0"); VSplinePath *path = new VSplinePath(kCurve); - Q_ASSERT(path != 0); + Q_CHECK_PTR(path); QDomNodeList nodeList = domElement.childNodes(); qint32 num = nodeList.size(); @@ -1193,7 +1193,7 @@ void VDomDocument::ParseSplineElement(VMainGraphicsScene *scene, const QDomEleme qint64 idObject = GetParametrLongLong(domElement, VAbstractNode::AttrIdObject, "0"); qint64 idTool = GetParametrLongLong(domElement, VAbstractNode::AttrIdTool, "0"); VSpline *spl = new VSpline(*data->GeometricObject(idObject)); - Q_ASSERT(spl != 0); + Q_CHECK_PTR(spl); spl->setIdObject(idObject); spl->setMode(Draw::Modeling); data->UpdateGObject(id, spl); @@ -1215,7 +1215,7 @@ void VDomDocument::ParseSplineElement(VMainGraphicsScene *scene, const QDomEleme qint64 idObject = GetParametrLongLong(domElement, VAbstractNode::AttrIdObject, "0"); qint64 idTool = GetParametrLongLong(domElement, VAbstractNode::AttrIdTool, "0"); VSplinePath *path = new VSplinePath(*data->GeometricObject(idObject)); - Q_ASSERT(path != 0); + Q_CHECK_PTR(path); path->setIdObject(idObject); path->setMode(Draw::Modeling); data->UpdateGObject(id, path); @@ -1234,7 +1234,7 @@ void VDomDocument::ParseSplineElement(VMainGraphicsScene *scene, const QDomEleme void VDomDocument::ParseArcElement(VMainGraphicsScene *scene, const QDomElement &domElement, const Document::Documents &parse, const QString &type) { - Q_ASSERT(scene != 0); + Q_CHECK_PTR(scene); 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"); if (type == VToolArc::ToolType) @@ -1266,7 +1266,7 @@ void VDomDocument::ParseArcElement(VMainGraphicsScene *scene, const QDomElement qint64 idObject = GetParametrLongLong(domElement, VAbstractNode::AttrIdObject, "0"); qint64 idTool = GetParametrLongLong(domElement, VAbstractNode::AttrIdTool, "0"); VArc *arc = new VArc(*data->GeometricObject(idObject)); - Q_ASSERT(arc != 0); + Q_CHECK_PTR(arc); arc->setIdObject(idObject); arc->setMode(Draw::Modeling); data->UpdateGObject(id, arc); @@ -1285,7 +1285,7 @@ void VDomDocument::ParseArcElement(VMainGraphicsScene *scene, const QDomElement void VDomDocument::ParseToolsElement(VMainGraphicsScene *scene, const QDomElement &domElement, const Document::Documents &parse, const QString &type) { - Q_ASSERT(scene != 0); + Q_CHECK_PTR(scene); 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"); if (type == VToolUnionDetails::ToolType) @@ -1315,7 +1315,7 @@ void VDomDocument::ParseToolsElement(VMainGraphicsScene *scene, const QDomElemen void VDomDocument::FullUpdateTree() { VMainGraphicsScene *scene = new VMainGraphicsScene(); - Q_ASSERT(scene != 0); + Q_CHECK_PTR(scene); try { Parse(Document::LiteParse, scene, scene); @@ -1403,16 +1403,16 @@ void VDomDocument::setCurrentData() void VDomDocument::AddTool(const qint64 &id, VDataTool *tool) { Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0"); - Q_ASSERT(tool != 0); + Q_CHECK_PTR(tool); tools.insert(id, tool); } void VDomDocument::UpdateToolData(const qint64 &id, VContainer *data) { Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0"); - Q_ASSERT(data != 0); + Q_CHECK_PTR(data); VDataTool *tool = tools.value(id); - Q_ASSERT(tool != 0); + Q_CHECK_PTR(tool); tool->VDataTool::setData(data); } @@ -1420,7 +1420,7 @@ void VDomDocument::IncrementReferens(qint64 id) const { Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0"); VDataTool *tool = tools.value(id); - Q_ASSERT(tool != 0); + Q_CHECK_PTR(tool); tool->incrementReferens(); }