Q_CHECK_PTR() instead Q_ASSERT()

--HG--
branch : develop
This commit is contained in:
dismine 2014-01-30 15:47:41 +02:00
parent d4db51c04c
commit 5804f54459
32 changed files with 166 additions and 166 deletions

View File

@ -72,7 +72,7 @@ void VContainer::setData(const VContainer &data)
qDeleteAll(gObjects);
gObjects.clear();
const QHash<qint64, VGObject*> *obj = data.DataGObjects();
Q_ASSERT(obj != 0);
Q_CHECK_PTR(obj);
QHashIterator<qint64, VGObject*> i(*obj);
while (i.hasNext())
{
@ -219,7 +219,7 @@ template <typename val>
void VContainer::UpdateObject(QHash<qint64, val> &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 <typename key, typename val>
qint64 VContainer::AddObject(QHash<key, val> &obj, val value)
{
Q_ASSERT(value != 0);
Q_CHECK_PTR(value);
qint64 id = getNextId();
value->setId(id);
obj[id] = value;

View File

@ -65,7 +65,7 @@ public:
void CopyGObject(const VContainer &data, const qint64 &id)
{
T *obj = new T(*data.GeometricObject<const T *>(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<T>(gObj);
Q_ASSERT(obj != 0);
Q_CHECK_PTR(obj);
return obj;
}

View File

@ -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<QString, qreal> *lineAnglesTable = data->DataLineAngles();
Q_ASSERT(lineAnglesTable != 0);
Q_CHECK_PTR(lineAnglesTable);
QHashIterator<QString, qreal> i(*lineAnglesTable);
while (i.hasNext())
{

View File

@ -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<VNodeDetail>(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<VNodeDetail>(item->data(Qt::UserRole));
node.setMy(toPixel(d));
item->setData(Qt::UserRole, QVariant::fromValue(node));

View File

@ -170,7 +170,7 @@ void DialogLineIntersect::P2Line2Changed(int index)
void DialogLineIntersect::CheckState()
{
Q_ASSERT(bOk != 0);
Q_CHECK_PTR(bOk);
bOk->setEnabled(flagName && flagPoint);
}

View File

@ -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<qint64, VGObject*> *objs = data->DataGObjects();
QHashIterator<qint64, VGObject*> i(*objs);
QMap<QString, qint64> 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<qint64, VGObject *> *objs = data->DataGObjects();
QHashIterator<qint64, VGObject*> i(*objs);
QMap<QString, qint64> 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<qint64, VGObject *> *objs = data->DataGObjects();
QHashIterator<qint64, VGObject*> i(*objs);
QMap<QString, qint64> 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<qint64, VGObject *> *objs = data->DataGObjects();
QHashIterator<qint64, VGObject *> i(*objs);
QMap<QString, qint64> 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<QString, qint64> &list) const
{
Q_ASSERT(box != 0);
Q_CHECK_PTR(box);
box->clear();
QMapIterator<QString, qint64> iter(list);
@ -396,7 +396,7 @@ void DialogTool::FillList(QComboBox *box, const QMap<QString, qint64> &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<QLineEdit*>(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 <class key, class val>
void DialogTool::ShowVariable(const QHash<key, val> *var)
{
Q_ASSERT(listWidget != 0);
Q_CHECK_PTR(listWidget);
disconnect(listWidget, &QListWidget::currentRowChanged, this, &DialogTool::ValChenged);
listWidget->clear();

View File

@ -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<QGridLayout*>(msgBox.layout());
Q_ASSERT(layout != 0);
Q_CHECK_PTR(layout);
layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount());
msgBox.exec();
}

View File

@ -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<QPointF> points;
QVector<QPointF> pointsEkv;

View File

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

View File

@ -293,7 +293,7 @@ void TableWindow::itemColliding(QList<QGraphicsItem *> list, int number)
if (lis.size()-2 <= 0)
{
VItem * bitem = qgraphicsitem_cast<VItem *> ( 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<QGraphicsItem *> list, int number)
else if (listCollidingItems.size()==1)
{
VItem * bitem = qgraphicsitem_cast<VItem *> ( listCollidingItems.at(0) );
Q_ASSERT(bitem != 0);
Q_CHECK_PTR(bitem);
bitem->setPen(QPen(Qt::black, widthMainLine));
listCollidingItems.clear();
collidingItems = true;

View File

@ -121,8 +121,8 @@ protected:
void ContextMenu(QSharedPointer<Dialog> &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)

View File

@ -106,7 +106,7 @@ void VToolArc::Create(const qint64 _id, const qint64 &center, const QString &rad
VPointF c = *data->GeometricObject<const VPointF *>(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)
{

View File

@ -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, &currentColor, &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, &currentColor, &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)

View File

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

View File

@ -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, &currentColor, &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, &currentColor, &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)

View File

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

View File

@ -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<const VPointF *>(id));
Q_ASSERT(point != 0);
Q_CHECK_PTR(point);
QPointF p = pos - this->pos();
point->setMx(p.x());
point->setMy(p.y());

View File

@ -110,7 +110,7 @@ void VToolSpline::Create(const qint64 _id, const qint64 &p1, const qint64 &p4, c
VPointF point1 = *data->GeometricObject<const VPointF *>(p1);
VPointF point4 = *data->GeometricObject<const VPointF *>(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)
{

View File

@ -86,7 +86,7 @@ void VToolSplinePath::Create(QSharedPointer<DialogSplinePath> &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());

View File

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

View File

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

View File

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

View File

@ -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<const VSplinePath *>(id);
const QVector<VSplinePoint> *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

View File

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

View File

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

View File

@ -390,9 +390,9 @@ template <typename Tool>
void VToolDetail::InitTool(VMainGraphicsScene *scene, const VNodeDetail &node)
{
QHash<qint64, VDataTool*>* tools = doc->getTools();
Q_ASSERT(tools != 0);
Q_CHECK_PTR(tools);
Tool *tool = qobject_cast<Tool*>(tools->value(node.getId()));
Q_ASSERT(tool != 0);
Q_CHECK_PTR(tool);
connect(tool, &Tool::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
tool->setParentItem(this);
}

View File

@ -67,7 +67,7 @@ public:
{
//We can't use exist object. Need create new.
T *node = new T(*data->GeometricObject<const T *>(id));
Q_ASSERT(node != 0);
Q_CHECK_PTR(node);
node->setMode(Draw::Modeling);
return data->AddGObject(node);
}

View File

@ -72,13 +72,13 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VDomDocument *doc, VContai
else
{
VPointF *point = new VPointF(*data->GeometricObject<const VPointF *>(det.at(i).getId()));
Q_ASSERT(point != 0);
Q_CHECK_PTR(point);
point->setMode(Draw::Modeling);
BiasRotatePoint(point, dx, dy, data->GeometricObject<const VPointF *>(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<const VPointF *>(pRotate)->toQPointF(), angle);
VPointF *center = new VPointF(arc->GetCenter());
Q_ASSERT(center != 0);
Q_CHECK_PTR(center);
BiasRotatePoint(center, dx, dy, data->GeometricObject<const VPointF *>(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<const VSpline *>(det.at(i).getId());
VPointF *p1 = new VPointF(spline->GetP1());
Q_ASSERT(p1 != 0);
Q_CHECK_PTR(p1);
BiasRotatePoint(p1, dx, dy, data->GeometricObject<const VPointF *>(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<const VPointF *>(pRotate)->toQPointF(), angle);
VPointF *p4 = new VPointF(spline->GetP4());
Q_ASSERT(p4 != 0);
Q_CHECK_PTR(p4);
BiasRotatePoint(p4, dx, dy, data->GeometricObject<const VPointF *>(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<const VSplinePath *>(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<const VPointF *>(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<const VPointF *>(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<const VPointF *>(det.at(i).getId()));
Q_ASSERT(point != 0);
Q_CHECK_PTR(point);
point->setMode(Draw::Modeling);
BiasRotatePoint(point, dx, dy, data->GeometricObject<const VPointF *>(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<const VPointF *>(pRotate)->toQPointF(), angle);
VPointF *center = new VPointF(arc->GetCenter());
Q_ASSERT(center != 0);
Q_CHECK_PTR(center);
BiasRotatePoint(center, dx, dy, data->GeometricObject<const VPointF *>(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<const VSpline *>(det.at(i).getId());
VPointF *p1 = new VPointF(spline->GetP1());
Q_ASSERT(p1 != 0);
Q_CHECK_PTR(p1);
BiasRotatePoint(p1, dx, dy, data->GeometricObject<const VPointF *>(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<const VPointF *>(pRotate)->toQPointF(), angle);
VPointF *p4 = new VPointF(spline->GetP4());
Q_ASSERT(p4 != 0);
Q_CHECK_PTR(p4);
BiasRotatePoint(p4, dx, dy, data->GeometricObject<const VPointF *>(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<const VSplinePath *>(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<const VPointF *>(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<const VPointF *>(pRotate)->toQPointF(),
angle);
++idCount;

View File

@ -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<QDoubleSpinBox*>(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<QDoubleSpinBox*>(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<QDoubleSpinBox*>(sender());
Q_ASSERT(spinBox != 0);
Q_CHECK_PTR(spinBox);
qreal value = spinBox->value();
if (qFuzzyCompare ( lastValue, value ) == false)
{

View File

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

View File

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

View File

@ -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<const VSpline *>(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<const VSplinePath *>(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<const VArc *>(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();
}