New macros SCASSERT instead Q_CHECK_PTR will break into the debugger on the line

of the assert.

--HG--
branch : DialogTools
This commit is contained in:
dismine 2014-05-30 22:56:05 +03:00
parent 98c90ee5fe
commit cc7f257081
50 changed files with 321 additions and 275 deletions

View File

@ -93,7 +93,7 @@ void VContainer::setData(const VContainer &data)
qDeleteAll(gObjects);
gObjects.clear();
const QHash<quint32, VGObject*> *obj = data.DataGObjects();
Q_CHECK_PTR(obj);
SCASSERT(obj != nullptr);
QHashIterator<quint32, VGObject*> i(*obj);
while (i.hasNext())
{
@ -331,7 +331,7 @@ template <typename val>
void VContainer::UpdateObject(QHash<quint32, val> &obj, const quint32 &id, val point)
{
Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0");
Q_CHECK_PTR(point);
SCASSERT(point != nullptr);
point->setId(id);
if (gObjects.contains(id))
{
@ -543,7 +543,7 @@ void VContainer::AddLine(const quint32 &firstPointId, const quint32 &secondPoint
template <typename key, typename val>
quint32 VContainer::AddObject(QHash<key, val> &obj, val value)
{
Q_CHECK_PTR(value);
SCASSERT(value != nullptr);
quint32 id = getNextId();
value->setId(id);
obj[id] = value;

View File

@ -73,7 +73,7 @@ public:
try
{
T obj = dynamic_cast<T>(gObj);
Q_CHECK_PTR(obj);
SCASSERT(obj != nullptr);
return obj;
}
catch (const std::bad_alloc &)

View File

@ -129,7 +129,7 @@ void DialogHistory::FillTable()
{
ui->tableWidget->clear();
const QVector<VToolRecord> *history = doc->getHistory();
Q_CHECK_PTR(history);
SCASSERT(history != nullptr);
qint32 currentRow = -1;
qint32 count = 0;
ui->tableWidget->setRowCount(history->size());
@ -164,7 +164,7 @@ void DialogHistory::FillTable()
{
cursorRow = currentRow;
QTableWidgetItem *item = ui->tableWidget->item(cursorRow, 0);
Q_CHECK_PTR(item);
SCASSERT(item != nullptr);
item->setIcon(QIcon("://icon/32x32/put_after.png"));
}
ui->tableWidget->resizeColumnsToContents();
@ -261,7 +261,7 @@ QString DialogHistory::Record(const VToolRecord &tool)
case Valentina::SplineTool:
{
const VSpline *spl = data->GeometricObject<const VSpline *>(tool.getId());
Q_CHECK_PTR(spl);
SCASSERT(spl != nullptr);
const QString splP1Name = data->GeometricObject<const VPointF *>(spl->GetP1().id())->name();
const QString splP4Name = data->GeometricObject<const VPointF *>(spl->GetP4().id())->name();
return QString(tr("Curve %1_%2")).arg(splP1Name, splP4Name);
@ -269,14 +269,14 @@ QString DialogHistory::Record(const VToolRecord &tool)
case Valentina::ArcTool:
{
const VArc *arc = data->GeometricObject<const VArc *>(tool.getId());
Q_CHECK_PTR(arc);
SCASSERT(arc != nullptr);
const QString arcCenterName = data->GeometricObject<const VArc *>(arc->GetCenter().id())->name();
return QString(tr("Arc with center in point %1")).arg(arcCenterName);
}
case Valentina::SplinePathTool:
{
const VSplinePath *splPath = data->GeometricObject<const VSplinePath *>(tool.getId());
Q_CHECK_PTR(splPath);
SCASSERT(splPath != nullptr);
const QVector<VSplinePoint> points = splPath->GetSplinePath();
QString record;
if (points.size() != 0 )
@ -347,7 +347,7 @@ QString DialogHistory::Record(const VToolRecord &tool)
{
const quint32 arcId = doc->GetParametrUInt(domElement, VToolCutArc::AttrArc, "0");
const VArc *arc = data->GeometricObject<const VArc *>(arcId);
Q_CHECK_PTR(arc);
SCASSERT(arc != nullptr);
const QString arcCenterName = data->GeometricObject<const VArc *>(arc->GetCenter().id())->name();
const QString toolIdName = data->GeometricObject<const VPointF *>(tool.getId())->name();
return QString(tr("%1 - cut arc with center %2")).arg(toolIdName, arcCenterName);
@ -356,7 +356,7 @@ QString DialogHistory::Record(const VToolRecord &tool)
{
const quint32 splineId = doc->GetParametrUInt(domElement, VToolCutSpline::AttrSpline, "0");
const VSpline *spl = data->GeometricObject<const VSpline *>(splineId);
Q_CHECK_PTR(spl);
SCASSERT(spl != nullptr);
const QString toolIdName = data->GeometricObject<const VPointF *>(tool.getId())->name();
const QString splP1Name = data->GeometricObject<const VPointF *>(spl->GetP1().id())->name();
const QString splP4Name = data->GeometricObject<const VPointF *>(spl->GetP4().id())->name();
@ -366,7 +366,7 @@ QString DialogHistory::Record(const VToolRecord &tool)
{
const quint32 splinePathId = doc->GetParametrUInt(domElement, VToolCutSplinePath::AttrSplinePath, "0");
const VSplinePath *splPath = data->GeometricObject<const VSplinePath *>(splinePathId);
Q_CHECK_PTR(splPath);
SCASSERT(splPath != nullptr);
const QVector<VSplinePoint> points = splPath->GetSplinePath();
QString record;
if (points.size() != 0 )

View File

@ -46,12 +46,12 @@ DialogIndividualMeasurements::DialogIndividualMeasurements(VContainer *data, con
{
const QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
Q_CHECK_PTR(bOk);
SCASSERT(bOk != nullptr);
connect(bOk, &QPushButton::clicked, this, &DialogIndividualMeasurements::DialogAccepted);
}
{
const QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
Q_CHECK_PTR(bCansel);
SCASSERT(bCansel != nullptr);
connect(bCansel, &QPushButton::clicked, this, &DialogIndividualMeasurements::DialogRejected);
}
@ -176,7 +176,7 @@ void DialogIndividualMeasurements::CheckState()
QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
Q_CHECK_PTR(bOk);
SCASSERT(bOk != nullptr);
bOk->setEnabled(flagName && flagPath);
}

View File

@ -37,7 +37,7 @@ DialogPatternProperties::DialogPatternProperties(VPattern *doc, QWidget *parent)
{
ui->setupUi(this);
Q_CHECK_PTR(doc);
SCASSERT(doc != nullptr);
QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(),
QApplication::applicationName());
@ -52,11 +52,11 @@ DialogPatternProperties::DialogPatternProperties(VPattern *doc, QWidget *parent)
ui->plainTextEditTechNotes->setPlainText(this->doc->UniqueTagText("notes"));
QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
Q_CHECK_PTR(bOk);
SCASSERT(bOk != nullptr);
connect(bOk, &QPushButton::clicked, this, &DialogPatternProperties::Apply);
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
Q_CHECK_PTR(bCansel);
SCASSERT(bCansel != nullptr);
connect(bCansel, &QPushButton::clicked, this, &DialogPatternProperties::close);
connect(this, &DialogPatternProperties::haveChange, this->doc, &VPattern::haveLiteChange);

View File

@ -42,12 +42,12 @@ DialogStandardMeasurements::DialogStandardMeasurements(VContainer *data, const Q
{
const QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
Q_CHECK_PTR(bOk);
SCASSERT(bOk != nullptr);
connect(bOk, &QPushButton::clicked, this, &DialogStandardMeasurements::DialogAccepted);
}
{
const QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
Q_CHECK_PTR(bCansel);
SCASSERT(bCansel != nullptr);
connect(bCansel, &QPushButton::clicked, this, &DialogStandardMeasurements::DialogRejected);
}
@ -121,7 +121,7 @@ void DialogStandardMeasurements::CheckState()
bool flagTable = false;
{
const QComboBox *box = ui->comboBoxTables;
Q_CHECK_PTR(box);
SCASSERT(box != nullptr);
if (box->count() > 0 && box->currentIndex() != -1)
{
flagTable = true;
@ -129,7 +129,7 @@ void DialogStandardMeasurements::CheckState()
}
QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
Q_CHECK_PTR(bOk);
SCASSERT(bOk != nullptr);
bOk->setEnabled(flagTable && flagName);
}

View File

@ -193,7 +193,7 @@ void DialogArc::F2Changed()
//---------------------------------------------------------------------------------------------------------------------
void DialogArc::CheckState()
{
Q_CHECK_PTR(bOk);
SCASSERT(bOk != nullptr);
bOk->setEnabled(flagRadius && flagF1 && flagF2);
}
@ -225,7 +225,7 @@ void DialogArc::ShowLineAngles()
ui->listWidget->clear();
connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogArc::ValChenged);
const QHash<QString, qreal> *lineAnglesTable = data->DataLineAngles();
Q_CHECK_PTR(lineAnglesTable);
SCASSERT(lineAnglesTable != nullptr);
QHashIterator<QString, qreal> i(*lineAnglesTable);
while (i.hasNext())
{

View File

@ -39,10 +39,10 @@ DialogDetail::DialogDetail(const VContainer *data, QWidget *parent)
labelEditNamePoint = ui.labelEditNameDetail;
bOk = ui.buttonBox->button(QDialogButtonBox::Ok);
Q_CHECK_PTR(bOk);
SCASSERT(bOk != nullptr);
connect(bOk, &QPushButton::clicked, this, &DialogTool::DialogAccepted);
QPushButton *bCansel = ui.buttonBox->button(QDialogButtonBox::Cancel);
Q_CHECK_PTR(bCansel);
SCASSERT(bCansel != nullptr);
connect(bCansel, &QPushButton::clicked, this, &DialogTool::DialogRejected);
flagName = true;//We have default name of detail.
@ -188,7 +188,7 @@ void DialogDetail::BiasXChanged(qreal d)
{
qint32 row = ui.listWidget->currentRow();
QListWidgetItem *item = ui.listWidget->item( row );
Q_CHECK_PTR(item);
SCASSERT(item != nullptr);
VNodeDetail node = qvariant_cast<VNodeDetail>(item->data(Qt::UserRole));
node.setMx(qApp->toPixel(d));
item->setData(Qt::UserRole, QVariant::fromValue(node));
@ -199,7 +199,7 @@ void DialogDetail::BiasYChanged(qreal d)
{
qint32 row = ui.listWidget->currentRow();
QListWidgetItem *item = ui.listWidget->item( row );
Q_CHECK_PTR(item);
SCASSERT(item != nullptr);
VNodeDetail node = qvariant_cast<VNodeDetail>(item->data(Qt::UserRole));
node.setMy(qApp->toPixel(d));
item->setData(Qt::UserRole, QVariant::fromValue(node));

View File

@ -85,7 +85,7 @@ void DialogEditWrongFormula::DialogRejected()
//---------------------------------------------------------------------------------------------------------------------
void DialogEditWrongFormula::CheckState()
{
Q_CHECK_PTR(bOk);
SCASSERT(bOk != nullptr);
bOk->setEnabled(flagFormula);
}

View File

@ -176,7 +176,7 @@ void DialogLineIntersect::P2Line2Changed(int index)
//---------------------------------------------------------------------------------------------------------------------
void DialogLineIntersect::CheckState()
{
Q_CHECK_PTR(bOk);
SCASSERT(bOk != nullptr);
bOk->setEnabled(flagName && flagPoint);
}

View File

@ -50,10 +50,10 @@ DialogPointOfContact::DialogPointOfContact(const VContainer *data, QWidget *pare
labelEditNamePoint = ui.labelEditNamePoint;
bOk = ui.buttonBox->button(QDialogButtonBox::Ok);
Q_CHECK_PTR(bOk);
SCASSERT(bOk != nullptr);
connect(bOk, &QPushButton::clicked, this, &DialogTool::DialogAccepted);
QPushButton *bCansel = ui.buttonBox->button(QDialogButtonBox::Cancel);
Q_CHECK_PTR(bCansel);
SCASSERT(bCansel != nullptr);
connect(bCansel, &QPushButton::clicked, this, &DialogTool::DialogRejected);
flagFormula = false;

View File

@ -131,7 +131,7 @@ void DialogSplinePath::Angle1Changed(qreal index)
{
qint32 row = ui->listWidget->currentRow();
QListWidgetItem *item = ui->listWidget->item( row );
Q_CHECK_PTR(item);
SCASSERT(item != nullptr);
VSplinePoint p = qvariant_cast<VSplinePoint>(item->data(Qt::UserRole));
p.SetAngle1(index);
DataPoint(p.P().id(), p.KAsm1(), p.Angle1(), p.KAsm2(), p.Angle2());
@ -143,7 +143,7 @@ void DialogSplinePath::Angle2Changed(qreal index)
{
qint32 row = ui->listWidget->currentRow();
QListWidgetItem *item = ui->listWidget->item( row );
Q_CHECK_PTR(item);
SCASSERT(item != nullptr);
VSplinePoint p = qvariant_cast<VSplinePoint>(item->data(Qt::UserRole));
p.SetAngle2(index);
DataPoint(p.P().id(), p.KAsm1(), p.Angle1(), p.KAsm2(), p.Angle2());

View File

@ -48,7 +48,7 @@ DialogTool::DialogTool(const VContainer *data, QWidget *parent)
radioButtonIncrements(nullptr), radioButtonLengthLine(nullptr), radioButtonLengthArc(nullptr),
radioButtonLengthCurve(nullptr), lineStyles(QStringList()), associatedTool(nullptr)
{
Q_CHECK_PTR(data);
SCASSERT(data != nullptr);
timerFormula = new QTimer(this);
connect(timerFormula, &QTimer::timeout, this, &DialogTool::EvalFormula);
//Keep synchronize with VAbstractTool styles list!!!
@ -83,7 +83,7 @@ void DialogTool::showEvent(QShowEvent *event)
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::FillComboBoxPoints(QComboBox *box, const quint32 &id) const
{
Q_CHECK_PTR(box);
SCASSERT(box != nullptr);
const QHash<quint32, VGObject*> *objs = data->DataGObjects();
QHashIterator<quint32, VGObject*> i(*objs);
QMap<QString, quint32> list;
@ -106,7 +106,7 @@ void DialogTool::FillComboBoxPoints(QComboBox *box, const quint32 &id) const
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::FillComboBoxArcs(QComboBox *box, const quint32 &id, ComboMode::ComboBoxCutArc cut) const
{
Q_CHECK_PTR(box);
SCASSERT(box != nullptr);
const QHash<quint32, VGObject *> *objs = data->DataGObjects();
QHashIterator<quint32, VGObject*> i(*objs);
QMap<QString, quint32> list;
@ -144,7 +144,7 @@ void DialogTool::FillComboBoxArcs(QComboBox *box, const quint32 &id, ComboMode::
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::FillComboBoxSplines(QComboBox *box, const quint32 &id, ComboMode::ComboBoxCutSpline cut) const
{
Q_CHECK_PTR(box);
SCASSERT(box != nullptr);
const QHash<quint32, VGObject *> *objs = data->DataGObjects();
QHashIterator<quint32, VGObject*> i(*objs);
QMap<QString, quint32> list;
@ -182,7 +182,7 @@ void DialogTool::FillComboBoxSplines(QComboBox *box, const quint32 &id, ComboMod
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::FillComboBoxSplinesPath(QComboBox *box, const quint32 &id, ComboMode::ComboBoxCutSpline cut) const
{
Q_CHECK_PTR(box);
SCASSERT(box != nullptr);
const QHash<quint32, VGObject *> *objs = data->DataGObjects();
QHashIterator<quint32, VGObject *> i(*objs);
QMap<QString, quint32> list;
@ -220,7 +220,7 @@ void DialogTool::FillComboBoxSplinesPath(QComboBox *box, const quint32 &id, Comb
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::FillComboBoxTypeLine(QComboBox *box) const
{
Q_CHECK_PTR(box);
SCASSERT(box != nullptr);
box->addItems(lineStyles);
box->setCurrentIndex(1);
}
@ -291,10 +291,10 @@ void DialogTool::ChangeCurrentData(QComboBox *box, const quint32 &value) const
void DialogTool::PutValHere(QLineEdit *lineEdit, QListWidget *listWidget)
{ // TODO issue #79 : erase this function after all tools updated to plainTextEdit
Q_CHECK_PTR(lineEdit);
Q_CHECK_PTR(listWidget);
SCASSERT(lineEdit != nullptr);
SCASSERT(listWidget != nullptr);
QListWidgetItem *item = listWidget->currentItem();
Q_CHECK_PTR(item);
SCASSERT(item != nullptr);
int pos = lineEdit->cursorPosition();
lineEdit->setText(lineEdit->text().insert(lineEdit->cursorPosition(), item->text()));
@ -306,10 +306,10 @@ void DialogTool::PutValHere(QLineEdit *lineEdit, QListWidget *listWidget)
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::PutValHere(QPlainTextEdit *plainTextEdit, QListWidget *listWidget)
{
Q_CHECK_PTR(plainTextEdit);
Q_CHECK_PTR(listWidget);
SCASSERT(plainTextEdit != nullptr);
SCASSERT(listWidget != nullptr);
QListWidgetItem *item = listWidget->currentItem();
Q_CHECK_PTR(item);
SCASSERT(item != nullptr);
QTextCursor cursor = plainTextEdit->textCursor();
cursor.insertText(item->text());
@ -325,9 +325,9 @@ void DialogTool::PutValHere(QPlainTextEdit *plainTextEdit, QListWidget *listWidg
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::ValFormulaChanged(bool &flag, QLineEdit *edit, QTimer *timer)
{// TODO issue #79 : erase this function after all tools updated to plainTextEdit
Q_CHECK_PTR(edit);
Q_CHECK_PTR(timer);
Q_CHECK_PTR(labelEditFormula);
SCASSERT(edit != nullptr);
SCASSERT(timer != nullptr);
SCASSERT(labelEditFormula != nullptr);
if (edit->text().isEmpty())
{
flag = false;
@ -342,9 +342,9 @@ void DialogTool::ValFormulaChanged(bool &flag, QLineEdit *edit, QTimer *timer)
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::ValFormulaChanged(bool &flag, QPlainTextEdit *edit, QTimer *timer)
{
Q_CHECK_PTR(edit);
Q_CHECK_PTR(timer);
Q_CHECK_PTR(labelEditFormula);
SCASSERT(edit != nullptr);
SCASSERT(timer != nullptr);
SCASSERT(labelEditFormula != nullptr);
if (edit->toPlainText().isEmpty())
{
flag = false;
@ -359,10 +359,10 @@ void DialogTool::ValFormulaChanged(bool &flag, QPlainTextEdit *edit, QTimer *tim
void DialogTool::Eval(QLineEdit *edit, bool &flag, QTimer *timer, QLabel *label)
{ // TODO issue #79 : erase this function after all tools updated to plainTextEdit
Q_CHECK_PTR(edit);
Q_CHECK_PTR(timer);
Q_CHECK_PTR(label);
Q_CHECK_PTR(labelEditFormula);
SCASSERT(edit != nullptr);
SCASSERT(timer != nullptr);
SCASSERT(label != nullptr);
SCASSERT(labelEditFormula != nullptr);
QPalette palette = labelEditFormula->palette();
if (edit->text().isEmpty())
{
@ -417,10 +417,10 @@ void DialogTool::Eval(QLineEdit *edit, bool &flag, QTimer *timer, QLabel *label)
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::Eval(QPlainTextEdit *edit, bool &flag, QTimer *timer, QLabel *label)
{
Q_CHECK_PTR(edit);
Q_CHECK_PTR(timer);
Q_CHECK_PTR(label);
Q_CHECK_PTR(labelEditFormula);
SCASSERT(edit != nullptr);
SCASSERT(timer != nullptr);
SCASSERT(label != nullptr);
SCASSERT(labelEditFormula != nullptr);
QPalette palette = labelEditFormula->palette();
if (edit->toPlainText().isEmpty())
{
@ -478,7 +478,7 @@ void DialogTool::Eval(QPlainTextEdit *edit, bool &flag, QTimer *timer, QLabel *l
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::setCurrentPointId(QComboBox *box, quint32 &pointId, const quint32 &value, const quint32 &id) const
{
Q_CHECK_PTR(box);
SCASSERT(box != nullptr);
FillComboBoxPoints(box, id);
pointId = value;
ChangeCurrentData(box, value);
@ -488,7 +488,7 @@ void DialogTool::setCurrentPointId(QComboBox *box, quint32 &pointId, const quint
void DialogTool::setCurrentSplineId(QComboBox *box, quint32 &splineId, const quint32 &value, const quint32 &id,
ComboMode::ComboBoxCutSpline cut) const
{
Q_CHECK_PTR(box);
SCASSERT(box != nullptr);
FillComboBoxSplines(box, id, cut);
splineId = value;
ChangeCurrentData(box, value);
@ -498,7 +498,7 @@ void DialogTool::setCurrentSplineId(QComboBox *box, quint32 &splineId, const qui
void DialogTool::setCurrentArcId(QComboBox *box, quint32 &arcId, const quint32 &value, const quint32 &id,
ComboMode::ComboBoxCutArc cut) const
{
Q_CHECK_PTR(box);
SCASSERT(box != nullptr);
FillComboBoxArcs(box, id, cut);
arcId = value;
ChangeCurrentData(box, value);
@ -508,7 +508,7 @@ void DialogTool::setCurrentArcId(QComboBox *box, quint32 &arcId, const quint32 &
void DialogTool::setCurrentSplinePathId(QComboBox *box, quint32 &splinePathId, const quint32 &value,
const quint32 &id, ComboMode::ComboBoxCutSpline cut) const
{
Q_CHECK_PTR(box);
SCASSERT(box != nullptr);
FillComboBoxSplinesPath(box, id, cut);
splinePathId = value;
ChangeCurrentData(box, value);
@ -517,7 +517,7 @@ void DialogTool::setCurrentSplinePathId(QComboBox *box, quint32 &splinePathId, c
//---------------------------------------------------------------------------------------------------------------------
quint32 DialogTool::getCurrentObjectId(QComboBox *box) const
{
Q_CHECK_PTR(box);
SCASSERT(box != nullptr);
qint32 index = box->currentIndex();
Q_ASSERT(index != -1);
if (index != -1)
@ -533,9 +533,9 @@ quint32 DialogTool::getCurrentObjectId(QComboBox *box) const
//---------------------------------------------------------------------------------------------------------------------
bool DialogTool::ChoosedPoint(const quint32 &id, QComboBox *box, const QString &toolTip)
{
Q_CHECK_PTR(box);
SCASSERT(box != nullptr);
const VPointF *point = data->GeometricObject<const VPointF *>(id);
Q_CHECK_PTR(point);
SCASSERT(point != nullptr);
const qint32 index = box->findText(point->name());
if ( index != -1 )
{ // -1 for not found
@ -549,7 +549,7 @@ bool DialogTool::ChoosedPoint(const quint32 &id, QComboBox *box, const QString &
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::FillList(QComboBox *box, const QMap<QString, quint32> &list) const
{
Q_CHECK_PTR(box);
SCASSERT(box != nullptr);
box->clear();
QMapIterator<QString, quint32> iter(list);
@ -563,9 +563,9 @@ void DialogTool::FillList(QComboBox *box, const QMap<QString, quint32> &list) co
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::CheckState()
{
Q_CHECK_PTR(bOk);
SCASSERT(bOk != nullptr);
bOk->setEnabled(flagFormula && flagName);
Q_CHECK_PTR(bApply);
SCASSERT(bApply != nullptr);
bApply->setEnabled(flagFormula && flagName);
}
@ -580,7 +580,7 @@ void DialogTool::ChoosedObject(quint32 id, const Valentina::Scenes &type)
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::NamePointChanged()
{
Q_CHECK_PTR(labelEditNamePoint);
SCASSERT(labelEditNamePoint != nullptr);
QLineEdit* edit = qobject_cast<QLineEdit*>(sender());
if (edit)
{
@ -637,71 +637,71 @@ void DialogTool::FormulaChanged2()
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::ArrowUp()
{
Q_CHECK_PTR(spinBoxAngle);
SCASSERT(spinBoxAngle != nullptr);
spinBoxAngle->setValue(90);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::ArrowDown()
{
Q_CHECK_PTR(spinBoxAngle);
SCASSERT(spinBoxAngle != nullptr);
spinBoxAngle->setValue(270);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::ArrowLeft()
{
Q_CHECK_PTR(spinBoxAngle);
SCASSERT(spinBoxAngle != nullptr);
spinBoxAngle->setValue(180);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::ArrowRight()
{
Q_CHECK_PTR(spinBoxAngle);
SCASSERT(spinBoxAngle != nullptr);
spinBoxAngle->setValue(0);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::ArrowLeftUp()
{
Q_CHECK_PTR(spinBoxAngle);
SCASSERT(spinBoxAngle != nullptr);
spinBoxAngle->setValue(135);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::ArrowLeftDown()
{
Q_CHECK_PTR(spinBoxAngle);
SCASSERT(spinBoxAngle != nullptr);
spinBoxAngle->setValue(225);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::ArrowRightUp()
{
Q_CHECK_PTR(spinBoxAngle);
SCASSERT(spinBoxAngle != nullptr);
spinBoxAngle->setValue(45);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::ArrowRightDown()
{
Q_CHECK_PTR(spinBoxAngle);
SCASSERT(spinBoxAngle != nullptr);
spinBoxAngle->setValue(315);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::EvalFormula()
{
Q_CHECK_PTR(plainTextEditFormula);
Q_CHECK_PTR(labelResultCalculation);
SCASSERT(plainTextEditFormula != nullptr);
SCASSERT(labelResultCalculation != nullptr);
Eval(plainTextEditFormula, flagFormula, timerFormula, labelResultCalculation);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::SizeHeight()
{
Q_CHECK_PTR(listWidget);
SCASSERT(listWidget != nullptr);
disconnect(listWidget, &QListWidget::currentRowChanged, this, &DialogTool::ValChenged);
listWidget->clear();
@ -758,8 +758,8 @@ void DialogTool::PutHere()
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::PutVal(QListWidgetItem *item)
{
Q_CHECK_PTR(plainTextEditFormula);
Q_CHECK_PTR(item);
SCASSERT(plainTextEditFormula != nullptr);
SCASSERT(item != nullptr);
QTextCursor cursor = plainTextEditFormula->textCursor();
cursor.insertText(item->text());
plainTextEditFormula->setTextCursor(cursor);
@ -774,14 +774,14 @@ void DialogTool::PutVal(QListWidgetItem *item)
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::ValChenged(int row)
{
Q_CHECK_PTR(listWidget);
Q_CHECK_PTR(labelDescription);
Q_CHECK_PTR(radioButtonSizeGrowth);
Q_CHECK_PTR(radioButtonStandardTable);
Q_CHECK_PTR(radioButtonIncrements);
Q_CHECK_PTR(radioButtonLengthLine);
Q_CHECK_PTR(radioButtonLengthArc);
Q_CHECK_PTR(radioButtonLengthCurve);
SCASSERT(listWidget != nullptr);
SCASSERT(labelDescription != nullptr);
SCASSERT(radioButtonSizeGrowth != nullptr);
SCASSERT(radioButtonStandardTable != nullptr);
SCASSERT(radioButtonIncrements != nullptr);
SCASSERT(radioButtonLengthLine != nullptr);
SCASSERT(radioButtonLengthArc != nullptr);
SCASSERT(radioButtonLengthCurve != nullptr);
if (listWidget->count() == 0)
{
return;
@ -844,12 +844,12 @@ void DialogTool::ValChenged(int row)
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::UpdateList()
{
Q_CHECK_PTR(radioButtonSizeGrowth);
Q_CHECK_PTR(radioButtonStandardTable);
Q_CHECK_PTR(radioButtonIncrements);
Q_CHECK_PTR(radioButtonLengthLine);
Q_CHECK_PTR(radioButtonLengthArc);
Q_CHECK_PTR(radioButtonLengthCurve);
SCASSERT(radioButtonSizeGrowth != nullptr);
SCASSERT(radioButtonStandardTable != nullptr);
SCASSERT(radioButtonIncrements != nullptr);
SCASSERT(radioButtonLengthLine != nullptr);
SCASSERT(radioButtonLengthArc != nullptr);
SCASSERT(radioButtonLengthCurve != nullptr);
if (radioButtonSizeGrowth->isChecked())
{
@ -881,7 +881,7 @@ void DialogTool::UpdateList()
template <class key, class val>
void DialogTool::ShowVariable(const QHash<key, val> *var)
{
Q_CHECK_PTR(listWidget);
SCASSERT(listWidget != nullptr);
disconnect(listWidget, &QListWidget::currentRowChanged, this, &DialogTool::ValChenged);
listWidget->clear();

View File

@ -432,7 +432,7 @@ protected:
template <typename T>
void InitArrow(T *ui)
{
Q_CHECK_PTR(ui);
SCASSERT(ui != nullptr);
spinBoxAngle = ui->doubleSpinBoxAngle;
connect(ui->toolButtonArrowDown, &QPushButton::clicked, this, &DialogTool::ArrowDown);
connect(ui->toolButtonArrowUp, &QPushButton::clicked, this, &DialogTool::ArrowUp);
@ -480,7 +480,7 @@ protected:
InitOkCancel(ui);
// TODO issue #79
bApply = ui->buttonBox->button(QDialogButtonBox::Apply);
Q_CHECK_PTR(bApply);
SCASSERT(bApply != nullptr);
connect(bApply, &QPushButton::clicked, this, &DialogTool::DialogApply);
}
//Left this method for dialog what do not need apply button
@ -488,11 +488,11 @@ protected:
void InitOkCancel(T *ui)
{
bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
Q_CHECK_PTR(bOk);
SCASSERT(bOk != nullptr);
connect(bOk, &QPushButton::clicked, this, &DialogTool::DialogAccepted);
QPushButton *bCancel = ui->buttonBox->button(QDialogButtonBox::Cancel);
Q_CHECK_PTR(bCancel);
SCASSERT(bCancel != nullptr);
connect(bCancel, &QPushButton::clicked, this, &DialogTool::DialogRejected);
}
/**

View File

@ -30,6 +30,7 @@
#include <QMessageBox>
#include <QSpacerItem>
#include <QGridLayout>
#include "../options.h"
//---------------------------------------------------------------------------------------------------------------------
VException::VException(const QString &what):QException(), what(what), moreInfo(QString())
@ -64,7 +65,7 @@ void VException::CriticalMessageBox(const QString &situation, QWidget * parent)
msgBox.setIcon(QMessageBox::Critical);
QSpacerItem* horizontalSpacer = new QSpacerItem(500, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
QGridLayout* layout = static_cast<QGridLayout*>(msgBox.layout());
Q_CHECK_PTR(layout);
SCASSERT(layout != nullptr);
layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount());
//Disable Qt::WaitCursor for error message.
#ifndef QT_NO_CURSOR

View File

@ -33,7 +33,7 @@
//---------------------------------------------------------------------------------------------------------------------
QPainterPath VEquidistant::ContourPath(const quint32 &idDetail, const VContainer *data) const
{
Q_CHECK_PTR(data);
SCASSERT(data != nullptr);
VDetail detail = data->GetDetail(idDetail);
QVector<QPointF> points;
QVector<QPointF> pointsEkv;

View File

@ -176,7 +176,7 @@ void MainWindow::ActionNewDraw()
connect(spoint, &VToolPoint::ChoosedTool, sceneDraw, &VMainGraphicsScene::ChoosedItem);
connect(sceneDraw, &VMainGraphicsScene::NewFactor, spoint, &VToolSinglePoint::SetFactor);
QHash<quint32, VDataTool*>* tools = doc->getTools();
Q_CHECK_PTR(tools);
SCASSERT(tools != nullptr);
tools->insert(id, spoint);
VDrawTool::AddRecord(id, Valentina::SinglePointTool, doc);
SetEnableTool(true);
@ -246,7 +246,7 @@ void MainWindow::SetToolButton(bool checked, Valentina::Tools t, const QString &
{
if (QToolButton *tButton = qobject_cast< QToolButton * >(this->sender()))
{
Q_CHECK_PTR(tButton);
SCASSERT(tButton != nullptr);
tButton->setChecked(true);
}
}
@ -286,7 +286,7 @@ void MainWindow::SetToolButton2(bool checked, Valentina::Tools t, const QString
{
if (QToolButton *tButton = qobject_cast< QToolButton * >(this->sender()))
{
Q_CHECK_PTR(tButton);
SCASSERT(tButton != nullptr);
tButton->setChecked(true);
}
}
@ -299,7 +299,7 @@ void MainWindow::SetToolButton2(bool checked, Valentina::Tools t, const QString
template <typename DrawTool>
void MainWindow::ClosedDialog(int result)
{// TODO ISSUE 79 : delete
Q_CHECK_PTR(dialogTool);
SCASSERT(dialogTool != nullptr);
if (result == QDialog::Accepted)
{
DrawTool::Create(dialogTool, currentScene, doc, pattern);
@ -316,7 +316,7 @@ void MainWindow::ClosedDialog(int result)
template <typename DrawTool>
void MainWindow::ClosedDialog2(int result)
{
Q_CHECK_PTR(dialogTool);
SCASSERT(dialogTool != nullptr);
if (result == QDialog::Accepted)
{
// Only create tool if not already created with apply
@ -346,7 +346,7 @@ void MainWindow::ClosedDialog2(int result)
template <typename DrawTool>
void MainWindow::ApplyDialog()
{// TODO ISSUE 79 : copy
Q_CHECK_PTR(dialogTool);
SCASSERT(dialogTool != nullptr);
// Only create tool if not already created with apply
if (dialogTool->GetAssociatedTool() == nullptr)

View File

@ -33,6 +33,11 @@
#include <QString>
#include <QMetaType>
#include <QtGlobal>
#include <csignal>
#ifdef Q_OS_WIN32
#include WinBase.h
#endif /*Q_OS_WIN32*/
#define SceneSize 50000
@ -283,4 +288,43 @@ extern const QString cm_Oprt;
extern const QString mm_Oprt;
extern const QString in_Oprt;
/*
* This macros SCASSERT (for Stop and Continue Assert) will break into the debugger on the line of the assert and allow
* you to continue afterwards should you choose to.
* idea: Q_ASSERT no longer pauses debugger - http://qt-project.org/forums/viewthread/13148
* Usefull links:
* 1. What's the difference between __PRETTY_FUNCTION__, __FUNCTION__, __func__? -
* https://stackoverflow.com/questions/4384765/whats-the-difference-between-pretty-function-function-func
*
* 2. Windows Predefined Macros - http://msdn.microsoft.com/library/b0084kay.aspx
*
* 3. Windows DebugBreak function - http://msdn.microsoft.com/en-us/library/ms679297%28VS.85%29.aspx
*
* 4. Continue to debug after failed assertion on Linux? [C/C++] -
* https://stackoverflow.com/questions/1721543/continue-to-debug-after-failed-assertion-on-linux-c-c
*/
#ifndef QT_NO_DEBUG
#ifdef Q_OS_WIN32
#define SCASSERT(cond) \
{ \
if (!(cond)) \
{ \
qDebug("ASSERT: %s in %s (%s:%u)", \
#cond, __FUNCSIG__, __FILE__, __LINE__); \
void WINAPI DebugBreak(void); \ \
} \
}
#else
#define SCASSERT(cond) \
{ \
if (!(cond)) \
{ \
qDebug("ASSERT: %s in %s (%s:%u)", \
#cond, __PRETTY_FUNCTION__, __FILE__, __LINE__);\
std::raise(SIGTRAP); \
} \
}
#endif /* Q_OS_WIN32 */
#endif /* QT_NO_DEBUG */
#endif // OPTIONS_H

View File

@ -97,7 +97,7 @@ void TableWindow::AddDetail()
{
tableScene->clearSelection();
VItem* Detail = listDetails[indexDetail];
Q_CHECK_PTR(Detail);
SCASSERT(Detail != nullptr);
connect(Detail, &VItem::itemOut, this, &TableWindow::itemOut);
connect(Detail, &VItem::itemColliding, this, &TableWindow::itemColliding);
connect(this, &TableWindow::LengthChanged, Detail, &VItem::LengthChanged);
@ -329,7 +329,7 @@ void TableWindow::itemColliding(QList<QGraphicsItem *> list, int number)
if (lis.size()-2 <= 0)
{
VItem * bitem = qgraphicsitem_cast<VItem *> ( listCollidingItems.at(i) );
Q_CHECK_PTR(bitem);
SCASSERT(bitem != nullptr);
bitem->setPen(QPen(Qt::black, qApp->toPixel(qApp->widthMainLine())));
listCollidingItems.removeAt(i);
}
@ -338,7 +338,7 @@ void TableWindow::itemColliding(QList<QGraphicsItem *> list, int number)
else if (listCollidingItems.size()==1)
{
VItem * bitem = qgraphicsitem_cast<VItem *> ( listCollidingItems.at(0) );
Q_CHECK_PTR(bitem);
SCASSERT(bitem != nullptr);
bitem->setPen(QPen(Qt::black, qApp->toPixel(qApp->widthMainLine())));
listCollidingItems.clear();
collidingItems = true;

View File

@ -95,8 +95,8 @@ protected:
*/
void ContextMenu(Tool *tool, QGraphicsSceneContextMenuEvent *event, bool showRemove = true)
{
Q_CHECK_PTR(tool);
Q_CHECK_PTR(event);
SCASSERT(tool != nullptr);
SCASSERT(event != nullptr);
if (ignoreContextMenuEvent == false)
{
QMenu menu;
@ -153,7 +153,7 @@ protected:
*/
void ShowItem(Item *item, quint32 id, Qt::GlobalColor color, bool enable)
{
Q_CHECK_PTR(item);
SCASSERT(item != nullptr);
if (id == item->id)
{
if (enable == false)

View File

@ -133,9 +133,9 @@ void VToolAlongLine::RemoveReferens()
//---------------------------------------------------------------------------------------------------------------------
void VToolAlongLine::SaveDialog(QDomElement &domElement)
{
Q_CHECK_PTR(dialog);
SCASSERT(dialog != nullptr);
DialogAlongLine *dialogTool = qobject_cast<DialogAlongLine*>(dialog);
Q_CHECK_PTR(dialogTool);
SCASSERT(dialogTool != nullptr);
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
doc->SetAttribute(domElement, AttrTypeLine, dialogTool->getTypeLine());
doc->SetAttribute(domElement, AttrLength, dialogTool->getFormula());
@ -146,9 +146,9 @@ void VToolAlongLine::SaveDialog(QDomElement &domElement)
//---------------------------------------------------------------------------------------------------------------------
void VToolAlongLine::setDialog()
{
Q_CHECK_PTR(dialog);
SCASSERT(dialog != nullptr);
DialogAlongLine *dialogTool = qobject_cast<DialogAlongLine*>(dialog);
Q_CHECK_PTR(dialogTool);
SCASSERT(dialogTool != nullptr);
const VPointF *p = VAbstractTool::data.GeometricObject<const VPointF *>(id);
dialogTool->setTypeLine(typeLine);
dialogTool->setFormula(formula);
@ -160,9 +160,9 @@ void VToolAlongLine::setDialog()
//---------------------------------------------------------------------------------------------------------------------
void VToolAlongLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data)
{
Q_CHECK_PTR(dialog);
SCASSERT(dialog != nullptr);
DialogAlongLine *dialogTool = qobject_cast<DialogAlongLine*>(dialog);
Q_CHECK_PTR(dialogTool);
SCASSERT(dialogTool != nullptr);
QString formula = dialogTool->getFormula();
const quint32 firstPointId = dialogTool->getFirstPointId();
const quint32 secondPointId = dialogTool->getSecondPointId();

View File

@ -62,9 +62,9 @@ VToolArc::VToolArc(VPattern *doc, VContainer *data, quint32 id, const Valentina:
//---------------------------------------------------------------------------------------------------------------------
void VToolArc::setDialog()
{
Q_CHECK_PTR(dialog);
SCASSERT(dialog != nullptr);
DialogArc *dialogTool = qobject_cast<DialogArc*>(dialog);
Q_CHECK_PTR(dialogTool);
SCASSERT(dialogTool != nullptr);
const VArc *arc = VAbstractTool::data.GeometricObject<const VArc *>(id);
dialogTool->SetCenter(arc->GetCenter().id());
dialogTool->SetF1(arc->GetFormulaF1());
@ -75,9 +75,9 @@ void VToolArc::setDialog()
//---------------------------------------------------------------------------------------------------------------------
void VToolArc::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data)
{
Q_CHECK_PTR(dialog);
SCASSERT(dialog != nullptr);
DialogArc *dialogTool = qobject_cast<DialogArc*>(dialog);
Q_CHECK_PTR(dialogTool);
SCASSERT(dialogTool != nullptr);
const quint32 center = dialogTool->GetCenter();
QString radius = dialogTool->GetRadius();
QString f1 = dialogTool->GetF1();
@ -268,9 +268,9 @@ void VToolArc::keyReleaseEvent(QKeyEvent *event)
//---------------------------------------------------------------------------------------------------------------------
void VToolArc::SaveDialog(QDomElement &domElement)
{
Q_CHECK_PTR(dialog);
SCASSERT(dialog != nullptr);
DialogArc *dialogTool = qobject_cast<DialogArc*>(dialog);
Q_CHECK_PTR(dialogTool);
SCASSERT(dialogTool != nullptr);
doc->SetAttribute(domElement, AttrCenter, QString().setNum(dialogTool->GetCenter()));
doc->SetAttribute(domElement, AttrRadius, dialogTool->GetRadius());
doc->SetAttribute(domElement, AttrAngle1, dialogTool->GetF1());

View File

@ -74,9 +74,9 @@ QPointF VToolBisector::FindPoint(const QPointF &firstPoint, const QPointF &secon
//---------------------------------------------------------------------------------------------------------------------
void VToolBisector::setDialog()
{
Q_CHECK_PTR(dialog);
SCASSERT(dialog != nullptr);
DialogBisector *dialogTool = qobject_cast<DialogBisector*>(dialog);
Q_CHECK_PTR(dialogTool);
SCASSERT(dialogTool != nullptr);
const VPointF *p = VAbstractTool::data.GeometricObject<const VPointF *>(id);
dialogTool->setTypeLine(typeLine);
dialogTool->setFormula(formula);
@ -90,9 +90,9 @@ void VToolBisector::setDialog()
void VToolBisector::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data)
{
Q_CHECK_PTR(dialog);
SCASSERT(dialog != nullptr);
DialogBisector *dialogTool = qobject_cast<DialogBisector*>(dialog);
Q_CHECK_PTR(dialogTool);
SCASSERT(dialogTool != nullptr);
QString formula = dialogTool->getFormula();
const quint32 firstPointId = dialogTool->getFirstPointId();
const quint32 secondPointId = dialogTool->getSecondPointId();
@ -232,9 +232,9 @@ void VToolBisector::RemoveReferens()
//---------------------------------------------------------------------------------------------------------------------
void VToolBisector::SaveDialog(QDomElement &domElement)
{
Q_CHECK_PTR(dialog);
SCASSERT(dialog != nullptr);
DialogBisector *dialogTool = qobject_cast<DialogBisector*>(dialog);
Q_CHECK_PTR(dialogTool);
SCASSERT(dialogTool != nullptr);
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
doc->SetAttribute(domElement, AttrTypeLine, dialogTool->getTypeLine());
doc->SetAttribute(domElement, AttrLength, dialogTool->getFormula());

View File

@ -67,9 +67,9 @@ VToolCutArc::VToolCutArc(VPattern *doc, VContainer *data, const quint32 &id, con
//---------------------------------------------------------------------------------------------------------------------
void VToolCutArc::setDialog()
{
Q_CHECK_PTR(dialog);
SCASSERT(dialog != nullptr);
DialogCutArc *dialogTool = qobject_cast<DialogCutArc*>(dialog);
Q_CHECK_PTR(dialogTool);
SCASSERT(dialogTool != nullptr);
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
dialogTool->setFormula(formula);
dialogTool->setArcId(arcId, id);
@ -80,9 +80,9 @@ void VToolCutArc::setDialog()
void VToolCutArc::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data)
{
Q_CHECK_PTR(dialog);
SCASSERT(dialog != nullptr);
DialogCutArc *dialogTool = qobject_cast<DialogCutArc*>(dialog);
Q_CHECK_PTR(dialogTool);
SCASSERT(dialogTool != nullptr);
const QString pointName = dialogTool->getPointName();
QString formula = dialogTool->getFormula();
const quint32 arcId = dialogTool->getArcId();
@ -250,9 +250,9 @@ void VToolCutArc::RefreshGeometry()
//---------------------------------------------------------------------------------------------------------------------
void VToolCutArc::SaveDialog(QDomElement &domElement)
{
Q_CHECK_PTR(dialog);
SCASSERT(dialog != nullptr);
DialogCutArc *dialogTool = qobject_cast<DialogCutArc*>(dialog);
Q_CHECK_PTR(dialogTool);
SCASSERT(dialogTool != nullptr);
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
doc->SetAttribute(domElement, AttrLength, dialogTool->getFormula());
doc->SetAttribute(domElement, AttrArc, QString().setNum(dialogTool->getArcId()));

View File

@ -67,9 +67,9 @@ VToolCutSpline::VToolCutSpline(VPattern *doc, VContainer *data, const quint32 &i
//---------------------------------------------------------------------------------------------------------------------
void VToolCutSpline::setDialog()
{
Q_CHECK_PTR(dialog);
SCASSERT(dialog != nullptr);
DialogCutSpline *dialogTool = qobject_cast<DialogCutSpline*>(dialog);
Q_CHECK_PTR(dialogTool);
SCASSERT(dialogTool != nullptr);
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
dialogTool->setFormula(formula);
dialogTool->setSplineId(splineId, id);
@ -80,9 +80,9 @@ void VToolCutSpline::setDialog()
void VToolCutSpline::Create(DialogTool *dialog, VMainGraphicsScene *scene,
VPattern *doc, VContainer *data)
{
Q_CHECK_PTR(dialog);
SCASSERT(dialog != nullptr);
DialogCutSpline *dialogTool = qobject_cast<DialogCutSpline*>(dialog);
Q_CHECK_PTR(dialogTool);
SCASSERT(dialogTool != nullptr);
const QString pointName = dialogTool->getPointName();
QString formula = dialogTool->getFormula();
const quint32 splineId = dialogTool->getSplineId();
@ -251,9 +251,9 @@ void VToolCutSpline::RemoveReferens()
//---------------------------------------------------------------------------------------------------------------------
void VToolCutSpline::SaveDialog(QDomElement &domElement)
{
Q_CHECK_PTR(dialog);
SCASSERT(dialog != nullptr);
DialogCutSpline *dialogTool = qobject_cast<DialogCutSpline*>(dialog);
Q_CHECK_PTR(dialogTool);
SCASSERT(dialogTool != nullptr);
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
doc->SetAttribute(domElement, AttrLength, dialogTool->getFormula());
doc->SetAttribute(domElement, AttrSpline, QString().setNum(dialogTool->getSplineId()));

View File

@ -68,9 +68,9 @@ VToolCutSplinePath::VToolCutSplinePath(VPattern *doc, VContainer *data, const qu
//---------------------------------------------------------------------------------------------------------------------
void VToolCutSplinePath::setDialog()
{
Q_CHECK_PTR(dialog);
SCASSERT(dialog != nullptr);
DialogCutSplinePath *dialogTool = qobject_cast<DialogCutSplinePath*>(dialog);
Q_CHECK_PTR(dialogTool);
SCASSERT(dialogTool != nullptr);
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
dialogTool->setFormula(formula);
dialogTool->setSplinePathId(splinePathId, id);
@ -80,9 +80,9 @@ void VToolCutSplinePath::setDialog()
//---------------------------------------------------------------------------------------------------------------------
void VToolCutSplinePath::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data)
{
Q_CHECK_PTR(dialog);
SCASSERT(dialog != nullptr);
DialogCutSplinePath *dialogTool = qobject_cast<DialogCutSplinePath*>(dialog);
Q_CHECK_PTR(dialogTool);
SCASSERT(dialogTool != nullptr);
const QString pointName = dialogTool->getPointName();
QString formula = dialogTool->getFormula();
const quint32 splinePathId = dialogTool->getSplinePathId();
@ -96,7 +96,7 @@ void VToolCutSplinePath::Create(const quint32 _id, const QString &pointName, QSt
const Document::Documents &parse, const Valentina::Sources &typeCreation)
{
const VSplinePath *splPath = data->GeometricObject<const VSplinePath *>(splinePathId);
Q_CHECK_PTR(splPath);
SCASSERT(splPath != nullptr);
const qreal result = CheckFormula(formula, data);
@ -326,9 +326,9 @@ void VToolCutSplinePath::RemoveReferens()
//---------------------------------------------------------------------------------------------------------------------
void VToolCutSplinePath::SaveDialog(QDomElement &domElement)
{
Q_CHECK_PTR(dialog);
SCASSERT(dialog != nullptr);
DialogCutSplinePath *dialogTool = qobject_cast<DialogCutSplinePath*>(dialog);
Q_CHECK_PTR(dialogTool);
SCASSERT(dialogTool != nullptr);
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
doc->SetAttribute(domElement, AttrLength, dialogTool->getFormula());
doc->SetAttribute(domElement, AttrSplinePath, QString().setNum(dialogTool->getSplinePathId()));

View File

@ -53,9 +53,9 @@ VToolEndLine::VToolEndLine(VPattern *doc, VContainer *data, const quint32 &id,
//---------------------------------------------------------------------------------------------------------------------
void VToolEndLine::setDialog()
{
Q_CHECK_PTR(dialog);
SCASSERT(dialog != nullptr);
DialogEndLine *dialogTool = qobject_cast<DialogEndLine*>(dialog);
Q_CHECK_PTR(dialogTool);
SCASSERT(dialogTool != nullptr);
const VPointF *p = VAbstractTool::data.GeometricObject<const VPointF *>(id);
dialogTool->setTypeLine(typeLine);
dialogTool->setFormula(formula);
@ -68,9 +68,9 @@ void VToolEndLine::setDialog()
VToolEndLine* VToolEndLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data)
{
Q_CHECK_PTR(dialog);
SCASSERT(dialog != nullptr);
DialogEndLine *dialogTool = qobject_cast<DialogEndLine*>(dialog);
Q_CHECK_PTR(dialogTool);
SCASSERT(dialogTool);
const QString pointName = dialogTool->getPointName();
const QString typeLine = dialogTool->getTypeLine();
QString formula = dialogTool->getFormula();
@ -194,9 +194,9 @@ void VToolEndLine::RefreshDataInFile()
//---------------------------------------------------------------------------------------------------------------------
void VToolEndLine::SaveDialog(QDomElement &domElement)
{
Q_CHECK_PTR(dialog);
SCASSERT(dialog != nullptr);
DialogEndLine *dialogTool = qobject_cast<DialogEndLine*>(dialog);
Q_CHECK_PTR(dialogTool);
SCASSERT(dialogTool != nullptr);
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
doc->SetAttribute(domElement, AttrTypeLine, dialogTool->getTypeLine());
doc->SetAttribute(domElement, AttrLength, dialogTool->getFormula());

View File

@ -51,9 +51,9 @@ VToolHeight::VToolHeight(VPattern *doc, VContainer *data, const quint32 &id, con
//---------------------------------------------------------------------------------------------------------------------
void VToolHeight::setDialog()
{
Q_CHECK_PTR(dialog);
SCASSERT(dialog != nullptr);
DialogHeight *dialogTool = qobject_cast<DialogHeight*>(dialog);
Q_CHECK_PTR(dialogTool);
SCASSERT(dialogTool != nullptr);
const VPointF *p = VAbstractTool::data.GeometricObject<const VPointF *>(id);
dialogTool->setTypeLine(typeLine);
dialogTool->setBasePointId(basePointId, id);
@ -66,9 +66,9 @@ void VToolHeight::setDialog()
void VToolHeight::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data)
{
Q_CHECK_PTR(dialog);
SCASSERT(dialog != nullptr);
DialogHeight *dialogTool = qobject_cast<DialogHeight*>(dialog);
Q_CHECK_PTR(dialogTool);
SCASSERT(dialogTool != nullptr);
disconnect(doc, &VPattern::FullUpdateFromFile, dialogTool, &DialogHeight::UpdateList);
const QString pointName = dialogTool->getPointName();
const QString typeLine = dialogTool->getTypeLine();
@ -198,9 +198,9 @@ void VToolHeight::RefreshDataInFile()
//---------------------------------------------------------------------------------------------------------------------
void VToolHeight::SaveDialog(QDomElement &domElement)
{
Q_CHECK_PTR(dialog);
SCASSERT(dialog != nullptr);
DialogHeight *dialogTool = qobject_cast<DialogHeight*>(dialog);
Q_CHECK_PTR(dialogTool);
SCASSERT(dialogTool != nullptr);
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
doc->SetAttribute(domElement, AttrTypeLine, dialogTool->getTypeLine());
doc->SetAttribute(domElement, AttrBasePoint, QString().setNum(dialogTool->getBasePointId()));

View File

@ -62,9 +62,9 @@ VToolLine::VToolLine(VPattern *doc, VContainer *data, quint32 id, quint32 firstP
//---------------------------------------------------------------------------------------------------------------------
void VToolLine::setDialog()
{
Q_CHECK_PTR(dialog);
SCASSERT(dialog != nullptr);
DialogLine *dialogTool = qobject_cast<DialogLine*>(dialog);
Q_CHECK_PTR(dialogTool);
SCASSERT(dialogTool != nullptr);
dialogTool->setFirstPoint(firstPoint);
dialogTool->setSecondPoint(secondPoint);
dialogTool->setTypeLine(typeLine);
@ -73,9 +73,9 @@ void VToolLine::setDialog()
//---------------------------------------------------------------------------------------------------------------------
void VToolLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data)
{
Q_CHECK_PTR(dialog);
SCASSERT(dialog != nullptr);
DialogLine *dialogTool = qobject_cast<DialogLine*>(dialog);
Q_CHECK_PTR(dialogTool);
SCASSERT(dialogTool != nullptr);
const quint32 firstPoint = dialogTool->getFirstPoint();
const quint32 secondPoint = dialogTool->getSecondPoint();
const QString typeLine = dialogTool->getTypeLine();
@ -87,9 +87,9 @@ void VToolLine::Create(const quint32 &_id, const quint32 &firstPoint, const quin
const QString &typeLine, VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
const Document::Documents &parse, const Valentina::Sources &typeCreation)
{
Q_CHECK_PTR(scene);
Q_CHECK_PTR(doc);
Q_CHECK_PTR(data);
SCASSERT(scene != nullptr);
SCASSERT(doc != nullptr);
SCASSERT(data != nullptr);
quint32 id = _id;
if (typeCreation == Valentina::FromGui)
{
@ -243,9 +243,9 @@ void VToolLine::keyReleaseEvent(QKeyEvent *event)
//---------------------------------------------------------------------------------------------------------------------
void VToolLine::SaveDialog(QDomElement &domElement)
{
Q_CHECK_PTR(dialog);
SCASSERT(dialog != nullptr);
DialogLine *dialogTool = qobject_cast<DialogLine*>(dialog);
Q_CHECK_PTR(dialogTool);
SCASSERT(dialogTool != nullptr);
doc->SetAttribute(domElement, AttrFirstPoint, QString().setNum(dialogTool->getFirstPoint()));
doc->SetAttribute(domElement, AttrSecondPoint, QString().setNum(dialogTool->getSecondPoint()));
doc->SetAttribute(domElement, AttrTypeLine, dialogTool->getTypeLine());

View File

@ -53,9 +53,9 @@ VToolLineIntersect::VToolLineIntersect(VPattern *doc, VContainer *data, const qu
//---------------------------------------------------------------------------------------------------------------------
void VToolLineIntersect::setDialog()
{
Q_CHECK_PTR(dialog);
SCASSERT(dialog != nullptr);
DialogLineIntersect *dialogTool = qobject_cast<DialogLineIntersect*>(dialog);
Q_CHECK_PTR(dialogTool);
SCASSERT(dialogTool != nullptr);
const VPointF *p = VAbstractTool::data.GeometricObject<const VPointF *>(id);
dialogTool->setP1Line1(p1Line1);
dialogTool->setP2Line1(p2Line1);
@ -67,9 +67,9 @@ void VToolLineIntersect::setDialog()
//---------------------------------------------------------------------------------------------------------------------
void VToolLineIntersect::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data)
{
Q_CHECK_PTR(dialog);
SCASSERT(dialog != nullptr);
DialogLineIntersect *dialogTool = qobject_cast<DialogLineIntersect*>(dialog);
Q_CHECK_PTR(dialogTool);
SCASSERT(dialogTool != nullptr);
const quint32 p1Line1Id = dialogTool->getP1Line1();
const quint32 p2Line1Id = dialogTool->getP2Line1();
const quint32 p1Line2Id = dialogTool->getP1Line2();
@ -217,9 +217,9 @@ void VToolLineIntersect::RemoveReferens()
//---------------------------------------------------------------------------------------------------------------------
void VToolLineIntersect::SaveDialog(QDomElement &domElement)
{
Q_CHECK_PTR(dialog);
SCASSERT(dialog != nullptr);
DialogLineIntersect *dialogTool = qobject_cast<DialogLineIntersect*>(dialog);
Q_CHECK_PTR(dialogTool);
SCASSERT(dialogTool != nullptr);
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
doc->SetAttribute(domElement, AttrP1Line1, QString().setNum(dialogTool->getP1Line1()));
doc->SetAttribute(domElement, AttrP2Line1, QString().setNum(dialogTool->getP2Line1()));

View File

@ -53,9 +53,9 @@ VToolNormal::VToolNormal(VPattern *doc, VContainer *data, const quint32 &id, con
//---------------------------------------------------------------------------------------------------------------------
void VToolNormal::setDialog()
{
Q_CHECK_PTR(dialog);
SCASSERT(dialog != nullptr);
DialogNormal *dialogTool = qobject_cast<DialogNormal*>(dialog);
Q_CHECK_PTR(dialogTool);
SCASSERT(dialogTool != nullptr);
const VPointF *p = VAbstractTool::data.GeometricObject<const VPointF *>(id);
dialogTool->setTypeLine(typeLine);
dialogTool->setFormula(formula);
@ -68,9 +68,9 @@ void VToolNormal::setDialog()
//---------------------------------------------------------------------------------------------------------------------
void VToolNormal::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data)
{
Q_CHECK_PTR(dialog);
SCASSERT(dialog != nullptr);
DialogNormal *dialogTool = qobject_cast<DialogNormal*>(dialog);
Q_CHECK_PTR(dialogTool);
SCASSERT(dialogTool != nullptr);
QString formula = dialogTool->getFormula();
const quint32 firstPointId = dialogTool->getFirstPointId();
const quint32 secondPointId = dialogTool->getSecondPointId();
@ -218,9 +218,9 @@ void VToolNormal::RemoveReferens()
//---------------------------------------------------------------------------------------------------------------------
void VToolNormal::SaveDialog(QDomElement &domElement)
{
Q_CHECK_PTR(dialog);
SCASSERT(dialog != nullptr);
DialogNormal *dialogTool = qobject_cast<DialogNormal*>(dialog);
Q_CHECK_PTR(dialogTool);
SCASSERT(dialogTool != nullptr);
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
doc->SetAttribute(domElement, AttrTypeLine, dialogTool->getTypeLine());
doc->SetAttribute(domElement, AttrLength, dialogTool->getFormula());

View File

@ -53,9 +53,9 @@ VToolPointOfContact::VToolPointOfContact(VPattern *doc, VContainer *data, const
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfContact::setDialog()
{
Q_CHECK_PTR(dialog);
SCASSERT(dialog != nullptr);
DialogPointOfContact *dialogTool = qobject_cast<DialogPointOfContact*>(dialog);
Q_CHECK_PTR(dialogTool);
SCASSERT(dialogTool != nullptr);
const VPointF *p = VAbstractTool::data.GeometricObject<const VPointF *>(id);
dialogTool->setRadius(arcRadius);
dialogTool->setCenter(center, id);
@ -94,9 +94,9 @@ QPointF VToolPointOfContact::FindPoint(const qreal &radius, const QPointF &cente
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfContact::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data)
{
Q_CHECK_PTR(dialog);
SCASSERT(dialog != nullptr);
DialogPointOfContact *dialogTool = qobject_cast<DialogPointOfContact*>(dialog);
Q_CHECK_PTR(dialogTool);
SCASSERT(dialogTool != nullptr);
QString radius = dialogTool->getRadius();
const quint32 center = dialogTool->getCenter();
const quint32 firstPointId = dialogTool->getFirstPoint();
@ -235,9 +235,9 @@ void VToolPointOfContact::RemoveReferens()
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfContact::SaveDialog(QDomElement &domElement)
{
Q_CHECK_PTR(dialog);
SCASSERT(dialog != nullptr);
DialogPointOfContact *dialogTool = qobject_cast<DialogPointOfContact*>(dialog);
Q_CHECK_PTR(dialogTool);
SCASSERT(dialogTool != nullptr);
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
doc->SetAttribute(domElement, AttrRadius, dialogTool->getRadius());
doc->SetAttribute(domElement, AttrCenter, QString().setNum(dialogTool->getCenter()));

View File

@ -51,9 +51,9 @@ VToolPointOfIntersection::VToolPointOfIntersection(VPattern *doc, VContainer *da
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfIntersection::setDialog()
{
Q_CHECK_PTR(dialog);
SCASSERT(dialog != nullptr);
DialogPointOfIntersection *dialogTool = qobject_cast<DialogPointOfIntersection*>(dialog);
Q_CHECK_PTR(dialogTool);
SCASSERT(dialogTool != nullptr);
const VPointF *p = VAbstractTool::data.GeometricObject<const VPointF *>(id);
dialogTool->setFirstPointId(firstPointId, id);
dialogTool->setSecondPointId(secondPointId, id);
@ -64,9 +64,9 @@ void VToolPointOfIntersection::setDialog()
void VToolPointOfIntersection::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data)
{
Q_CHECK_PTR(dialog);
SCASSERT(dialog != nullptr);
DialogPointOfIntersection *dialogTool = qobject_cast<DialogPointOfIntersection*>(dialog);
Q_CHECK_PTR(dialogTool);
SCASSERT(dialogTool != nullptr);
const quint32 firstPointId = dialogTool->getFirstPointId();
const quint32 secondPointId = dialogTool->getSecondPointId();
const QString pointName = dialogTool->getPointName();
@ -177,9 +177,9 @@ void VToolPointOfIntersection::RefreshDataInFile()
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfIntersection::SaveDialog(QDomElement &domElement)
{
Q_CHECK_PTR(dialog);
SCASSERT(dialog != nullptr);
DialogPointOfIntersection *dialogTool = qobject_cast<DialogPointOfIntersection*>(dialog);
Q_CHECK_PTR(dialogTool);
SCASSERT(dialogTool != nullptr);
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
doc->SetAttribute(domElement, AttrFirstPoint, QString().setNum(dialogTool->getFirstPointId()));
doc->SetAttribute(domElement, AttrSecondPoint, QString().setNum(dialogTool->getSecondPointId()));

View File

@ -52,9 +52,9 @@ VToolShoulderPoint::VToolShoulderPoint(VPattern *doc, VContainer *data, const qu
//---------------------------------------------------------------------------------------------------------------------
void VToolShoulderPoint::setDialog()
{
Q_CHECK_PTR(dialog);
SCASSERT(dialog != nullptr);
DialogShoulderPoint *dialogTool = qobject_cast<DialogShoulderPoint*>(dialog);
Q_CHECK_PTR(dialogTool);
SCASSERT(dialogTool != nullptr);
const VPointF *p = VAbstractTool::data.GeometricObject<const VPointF *>(id);
dialogTool->setTypeLine(typeLine);
dialogTool->setFormula(formula);
@ -96,9 +96,9 @@ QPointF VToolShoulderPoint::FindPoint(const QPointF &p1Line, const QPointF &p2Li
//---------------------------------------------------------------------------------------------------------------------
void VToolShoulderPoint::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data)
{
Q_CHECK_PTR(dialog);
SCASSERT(dialog != nullptr);
DialogShoulderPoint *dialogTool = qobject_cast<DialogShoulderPoint*>(dialog);
Q_CHECK_PTR(dialogTool);
SCASSERT(dialogTool);
QString formula = dialogTool->getFormula();
const quint32 p1Line = dialogTool->getP1Line();
const quint32 p2Line = dialogTool->getP2Line();
@ -241,9 +241,9 @@ void VToolShoulderPoint::RemoveReferens()
//---------------------------------------------------------------------------------------------------------------------
void VToolShoulderPoint::SaveDialog(QDomElement &domElement)
{
Q_CHECK_PTR(dialog);
SCASSERT(dialog != nullptr);
DialogShoulderPoint *dialogTool = qobject_cast<DialogShoulderPoint*>(dialog);
Q_CHECK_PTR(dialogTool);
SCASSERT(dialogTool != nullptr);
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
doc->SetAttribute(domElement, AttrTypeLine, dialogTool->getTypeLine());
doc->SetAttribute(domElement, AttrLength, dialogTool->getFormula());

View File

@ -57,9 +57,9 @@ VToolSinglePoint::VToolSinglePoint (VPattern *doc, VContainer *data, quint32 id,
//---------------------------------------------------------------------------------------------------------------------
void VToolSinglePoint::setDialog()
{
Q_CHECK_PTR(dialog);
SCASSERT(dialog != nullptr);
DialogSinglePoint *dialogTool = qobject_cast<DialogSinglePoint*>(dialog);
Q_CHECK_PTR(dialogTool);
SCASSERT(dialogTool != nullptr);
const VPointF *p = VAbstractTool::data.GeometricObject<const VPointF *>(id);
dialogTool->setData(p->name(), p->toQPointF());
}
@ -145,9 +145,9 @@ void VToolSinglePoint::decrementReferens()
//---------------------------------------------------------------------------------------------------------------------
void VToolSinglePoint::SaveDialog(QDomElement &domElement)
{
Q_CHECK_PTR(dialog);
SCASSERT(dialog != nullptr);
DialogSinglePoint *dialogTool = qobject_cast<DialogSinglePoint*>(dialog);
Q_CHECK_PTR(dialogTool);
SCASSERT(dialogTool != nullptr);
QPointF p = dialogTool->getPoint();
QString name = dialogTool->getName();
doc->SetAttribute(domElement, AttrName, name);

View File

@ -75,9 +75,9 @@ VToolSpline::VToolSpline(VPattern *doc, VContainer *data, quint32 id, const Vale
//---------------------------------------------------------------------------------------------------------------------
void VToolSpline::setDialog()
{
Q_CHECK_PTR(dialog);
SCASSERT(dialog != nullptr);
DialogSpline *dialogTool = qobject_cast<DialogSpline*>(dialog);
Q_CHECK_PTR(dialogTool);
SCASSERT(dialogTool != nullptr);
const VSpline *spl = VAbstractTool::data.GeometricObject<const VSpline *>(id);
dialogTool->setP1(spl->GetP1().id());
dialogTool->setP4(spl->GetP4().id());
@ -92,9 +92,9 @@ void VToolSpline::setDialog()
void VToolSpline::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data)
{
Q_CHECK_PTR(dialog);
SCASSERT(dialog != nullptr);
DialogSpline *dialogTool = qobject_cast<DialogSpline*>(dialog);
Q_CHECK_PTR(dialogTool);
SCASSERT(dialogTool != nullptr);
const quint32 p1 = dialogTool->getP1();
const quint32 p4 = dialogTool->getP4();
const qreal kAsm1 = dialogTool->getKAsm1();
@ -233,9 +233,9 @@ void VToolSpline::RemoveReferens()
//---------------------------------------------------------------------------------------------------------------------
void VToolSpline::SaveDialog(QDomElement &domElement)
{
Q_CHECK_PTR(dialog);
SCASSERT(dialog != nullptr);
DialogSpline *dialogTool = qobject_cast<DialogSpline*>(dialog);
Q_CHECK_PTR(dialogTool);
SCASSERT(dialogTool != nullptr);
VPointF point1 = *VAbstractTool::data.GeometricObject<const VPointF *>(dialogTool->getP1());
VPointF point4 = *VAbstractTool::data.GeometricObject<const VPointF *>(dialogTool->getP4());

View File

@ -76,9 +76,9 @@ VToolSplinePath::VToolSplinePath(VPattern *doc, VContainer *data, quint32 id, co
//---------------------------------------------------------------------------------------------------------------------
void VToolSplinePath::setDialog()
{
Q_CHECK_PTR(dialog);
SCASSERT(dialog != nullptr);
DialogSplinePath *dialogTool = qobject_cast<DialogSplinePath*>(dialog);
Q_CHECK_PTR(dialogTool);
SCASSERT(dialogTool != nullptr);
const VSplinePath *splPath = VAbstractTool::data.GeometricObject<const VSplinePath *>(id);
dialogTool->SetPath(*splPath);
}
@ -86,9 +86,9 @@ void VToolSplinePath::setDialog()
//---------------------------------------------------------------------------------------------------------------------
void VToolSplinePath::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data)
{
Q_CHECK_PTR(dialog);
SCASSERT(dialog != nullptr);
DialogSplinePath *dialogTool = qobject_cast<DialogSplinePath*>(dialog);
Q_CHECK_PTR(dialogTool);
SCASSERT(dialogTool != nullptr);
VSplinePath *path = new VSplinePath(dialogTool->GetPath());
for (qint32 i = 0; i < path->CountPoint(); ++i)
{
@ -287,9 +287,9 @@ void VToolSplinePath::RemoveReferens()
//---------------------------------------------------------------------------------------------------------------------
void VToolSplinePath::SaveDialog(QDomElement &domElement)
{
Q_CHECK_PTR(dialog);
SCASSERT(dialog != nullptr);
DialogSplinePath *dialogTool = qobject_cast<DialogSplinePath*>(dialog);
Q_CHECK_PTR(dialogTool);
SCASSERT(dialogTool != nullptr);
VSplinePath splPath = dialogTool->GetPath();
RefreshSplinePath(splPath);

View File

@ -52,9 +52,9 @@ VToolTriangle::VToolTriangle(VPattern *doc, VContainer *data, const quint32 &id,
//---------------------------------------------------------------------------------------------------------------------
void VToolTriangle::setDialog()
{
Q_CHECK_PTR(dialog);
SCASSERT(dialog != nullptr);
DialogTriangle *dialogTool = qobject_cast<DialogTriangle*>(dialog);
Q_CHECK_PTR(dialogTool);
SCASSERT(dialogTool != nullptr);
const VPointF *p = VAbstractTool::data.GeometricObject<const VPointF *>(id);
dialogTool->setAxisP1Id(axisP1Id, id);
dialogTool->setAxisP2Id(axisP2Id, id);
@ -67,9 +67,9 @@ void VToolTriangle::setDialog()
void VToolTriangle::Create(DialogTool *dialog, VMainGraphicsScene *scene,
VPattern *doc, VContainer *data)
{
Q_CHECK_PTR(dialog);
SCASSERT(dialog != nullptr);
DialogTriangle *dialogTool = qobject_cast<DialogTriangle*>(dialog);
Q_CHECK_PTR(dialogTool);
SCASSERT(dialogTool != nullptr);
const quint32 axisP1Id = dialogTool->getAxisP1Id();
const quint32 axisP2Id = dialogTool->getAxisP2Id();
const quint32 firstPointId = dialogTool->getFirstPointId();
@ -238,9 +238,9 @@ void VToolTriangle::RefreshDataInFile()
//---------------------------------------------------------------------------------------------------------------------
void VToolTriangle::SaveDialog(QDomElement &domElement)
{
Q_CHECK_PTR(dialog);
SCASSERT(dialog != nullptr);
DialogTriangle *dialogTool = qobject_cast<DialogTriangle*>(dialog);
Q_CHECK_PTR(dialogTool);
SCASSERT(dialogTool != nullptr);
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
doc->SetAttribute(domElement, AttrAxisP1, QString().setNum(dialogTool->getAxisP1Id()));
doc->SetAttribute(domElement, AttrAxisP2, QString().setNum(dialogTool->getAxisP2Id()));

View File

@ -66,7 +66,7 @@ void VNodeArc::Create(VPattern *doc, VContainer *data, quint32 id, quint32 idArc
doc->IncrementReferens(idTool);
//Some nodes we don't show on scene. Tool that create this nodes must free memory.
VDataTool *tool = doc->getTool(idTool);
Q_CHECK_PTR(tool);
SCASSERT(tool != nullptr);
arc->setParent(tool);
}
else

View File

@ -77,7 +77,7 @@ void VNodePoint::Create(VPattern *doc, VContainer *data, quint32 id, quint32 idP
doc->IncrementReferens(idTool);
//Some nodes we don't show on scene. Tool that create this nodes must free memory.
VDataTool *tool = doc->getTool(idTool);
Q_CHECK_PTR(tool);
SCASSERT(tool != nullptr);
point->setParent(tool);
}
else

View File

@ -69,7 +69,7 @@ VNodeSpline *VNodeSpline::Create(VPattern *doc, VContainer *data, quint32 id, qu
doc->IncrementReferens(idTool);
//Some nodes we don't show on scene. Tool that create this nodes must free memory.
VDataTool *tool = doc->getTool(idTool);
Q_CHECK_PTR(tool);
SCASSERT(tool != nullptr);
spl->setParent(tool);
}
else

View File

@ -72,7 +72,7 @@ void VNodeSplinePath::Create(VPattern *doc, VContainer *data, quint32 id, quint3
doc->IncrementReferens(idTool);
//Some nodes we don't show on scene. Tool that create this nodes must free memory.
VDataTool *tool = doc->getTool(idTool);
Q_CHECK_PTR(tool);
SCASSERT(tool != nullptr);
splPath->setParent(tool);
}
else

View File

@ -74,7 +74,7 @@ const QString VAbstractTool::TypeLineDashDotDotLine = QStringLiteral("dashDotDot
VAbstractTool::VAbstractTool(VPattern *doc, VContainer *data, quint32 id, QObject *parent)
:VDataTool(data, parent), doc(doc), id(id), baseColor(Qt::black), currentColor(Qt::black), typeLine(TypeLineLine)
{
Q_CHECK_PTR(doc);
SCASSERT(doc != nullptr);
connect(this, &VAbstractTool::toolhaveChange, this->doc, &VPattern::haveLiteChange);
connect(this->doc, &VPattern::FullUpdateFromFile, this, &VAbstractTool::FullUpdateFromFile);
connect(this, &VAbstractTool::FullUpdateTree, this->doc, &VPattern::FullUpdateTree);

View File

@ -31,7 +31,7 @@
//---------------------------------------------------------------------------------------------------------------------
VDataTool::VDataTool(VContainer *data, QObject *parent): QObject(parent), data(*data), _referens(1)
{
Q_CHECK_PTR(data);
SCASSERT(data != nullptr);
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -99,9 +99,9 @@ VToolDetail::~VToolDetail()
//---------------------------------------------------------------------------------------------------------------------
void VToolDetail::setDialog()
{
Q_CHECK_PTR(dialog);
SCASSERT(dialog != nullptr);
DialogDetail *dialogTool = qobject_cast<DialogDetail*>(dialog);
Q_CHECK_PTR(dialogTool);
SCASSERT(dialogTool != nullptr);
VDetail detail = VAbstractTool::data.GetDetail(id);
dialogTool->setDetails(detail);
}
@ -109,9 +109,9 @@ void VToolDetail::setDialog()
//---------------------------------------------------------------------------------------------------------------------
void VToolDetail::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data)
{
Q_CHECK_PTR(dialog);
SCASSERT(dialog != nullptr);
DialogDetail *dialogTool = qobject_cast<DialogDetail*>(dialog);
Q_CHECK_PTR(dialogTool);
SCASSERT(dialogTool != nullptr);
VDetail detail = dialogTool->getDetails();
VDetail det;
for (ptrdiff_t i = 0; i< detail.CountNode(); ++i)
@ -202,9 +202,9 @@ void VToolDetail::FullUpdateFromGui(int result)
QDomElement domElement = doc->elementById(QString().setNum(id));
if (domElement.isElement())
{
Q_CHECK_PTR(dialog);
SCASSERT(dialog != nullptr);
DialogDetail *dialogTool = qobject_cast<DialogDetail*>(dialog);
Q_CHECK_PTR(dialogTool);
SCASSERT(dialogTool != nullptr);
VDetail det = dialogTool->getDetails();
doc->SetAttribute(domElement, AttrName, det.getName());
doc->SetAttribute(domElement, AttrSupplement, QString().setNum(det.getSeamAllowance()));
@ -433,9 +433,9 @@ template <typename Tool>
void VToolDetail::InitTool(VMainGraphicsScene *scene, const VNodeDetail &node)
{
QHash<quint32, VDataTool*>* tools = doc->getTools();
Q_CHECK_PTR(tools);
SCASSERT(tools != nullptr);
Tool *tool = qobject_cast<Tool*>(tools->value(node.getId()));
Q_CHECK_PTR(tool);
SCASSERT(tool != nullptr);
connect(tool, &Tool::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
tool->setParentItem(this);
}

View File

@ -312,7 +312,7 @@ void VToolUnionDetails::UpdatePoints(const quint32 &idDetail, VContainer *data,
VSplinePath *path = new VSplinePath();
path->setMode(Valentina::Modeling);
const VSplinePath *splinePath = data->GeometricObject<const VSplinePath *>(det.at(i).getId());
Q_CHECK_PTR(splinePath);
SCASSERT(splinePath != nullptr);
qint32 k = splinePath->getMaxCountPoints();
for (qint32 i = 1; i <= splinePath->Count(); ++i)
{
@ -387,9 +387,9 @@ void VToolUnionDetails::BiasRotatePoint(VPointF *point, const qreal &dx, const q
//---------------------------------------------------------------------------------------------------------------------
void VToolUnionDetails::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data)
{
Q_CHECK_PTR(dialog);
SCASSERT(dialog != nullptr);
DialogUnionDetails *dialogTool = qobject_cast<DialogUnionDetails*>(dialog);
Q_CHECK_PTR(dialogTool);
SCASSERT(dialogTool != nullptr);
VDetail d1 = data->GetDetail(dialogTool->getD1());
VDetail d2 = data->GetDetail(dialogTool->getD2());
ptrdiff_t indexD1 = dialogTool->getIndexD1();
@ -492,16 +492,16 @@ void VToolUnionDetails::Create(const quint32 _id, const VDetail &d1, const VDeta
newDetail.setName("Detail");
VToolDetail::Create(0, newDetail, scene, doc, data, parse, Valentina::FromTool);
QHash<quint32, VDataTool*>* tools = doc->getTools();
Q_CHECK_PTR(tools);
SCASSERT(tools != nullptr);
{
VToolDetail *toolDet = qobject_cast<VToolDetail*>(tools->value(d1id));
Q_CHECK_PTR(toolDet);
SCASSERT(toolDet != nullptr);
toolDet->Remove();
}
VToolDetail *toolDet = qobject_cast<VToolDetail*>(tools->value(d2id));
Q_CHECK_PTR(toolDet);
SCASSERT(toolDet != nullptr);
toolDet->Remove();
}
else

View File

@ -27,8 +27,8 @@
*************************************************************************/
#include "doubledelegate.h"
#include <QDoubleSpinBox>
#include "../options.h"
//---------------------------------------------------------------------------------------------------------------------
//cppcheck-suppress unusedFunction
@ -51,7 +51,7 @@ void DoubleSpinBoxDelegate::setEditorData(QWidget *editor, const QModelIndex &in
qreal value = index.model()->data(index, Qt::EditRole).toDouble();
QDoubleSpinBox *spinBox = qobject_cast<QDoubleSpinBox*>(editor);
Q_CHECK_PTR(spinBox);
SCASSERT(spinBox != nullptr);
spinBox->setValue(value);
}
@ -60,7 +60,7 @@ void DoubleSpinBoxDelegate::setEditorData(QWidget *editor, const QModelIndex &in
void DoubleSpinBoxDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
{
QDoubleSpinBox *spinBox = qobject_cast<QDoubleSpinBox*>(editor);
Q_CHECK_PTR(spinBox);
SCASSERT(spinBox != nullptr);
spinBox->interpretText();
qreal value = spinBox->value();
@ -80,7 +80,7 @@ void DoubleSpinBoxDelegate::updateEditorGeometry(QWidget *editor, const QStyleOp
void DoubleSpinBoxDelegate::commitAndCloseEditor()
{
QDoubleSpinBox *spinBox = qobject_cast<QDoubleSpinBox*>(sender());
Q_CHECK_PTR(spinBox);
SCASSERT(spinBox != nullptr);
qreal value = spinBox->value();
if (qFuzzyCompare ( lastValue, value ) == false)
{

View File

@ -27,8 +27,8 @@
*************************************************************************/
#include "textdelegate.h"
#include <QLineEdit>
#include "../options.h"
//---------------------------------------------------------------------------------------------------------------------
TextDelegate::TextDelegate(const QString &regex, QObject *parent): QItemDelegate(parent), lastText(QString("Name_")),
@ -56,7 +56,7 @@ void TextDelegate::setEditorData(QWidget *editor, const QModelIndex &index) cons
QString text = index.model()->data(index, Qt::EditRole).toString();
QLineEdit *lineEdit = qobject_cast<QLineEdit*>(editor);
Q_CHECK_PTR(lineEdit);
SCASSERT(lineEdit != nullptr);
if ( lastText != text && text.isEmpty() == false)
{
//Here need save text, but method is const, so, we use signal instead.
@ -69,7 +69,7 @@ void TextDelegate::setEditorData(QWidget *editor, const QModelIndex &index) cons
void TextDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
{
QLineEdit *lineEdit = qobject_cast<QLineEdit*>(editor);
Q_CHECK_PTR(lineEdit);
SCASSERT(lineEdit != nullptr);
QString text = lineEdit->text();
if (text.isEmpty())
{
@ -91,7 +91,7 @@ void TextDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewI
void TextDelegate::commitAndCloseEditor()
{
QLineEdit *lineEdit = qobject_cast<QLineEdit*>(sender());
Q_CHECK_PTR(lineEdit);
SCASSERT(lineEdit != nullptr);
QString text = lineEdit->text();
if ( lastText != text && text.isEmpty() == false)
{

View File

@ -31,6 +31,7 @@
#include <QDebug>
#include <QtWidgets>
#include <QWheelEvent>
#include "../options.h"
//---------------------------------------------------------------------------------------------------------------------
VTableGraphicsView::VTableGraphicsView(QGraphicsScene* pScene, QWidget *parent)
@ -65,7 +66,7 @@ void VTableGraphicsView::MirrorItem()
for ( qint32 i = 0; i < list.count(); ++i )
{
QGraphicsItem *item = list.at(i);
Q_CHECK_PTR(item);
SCASSERT(item != nullptr);
QRectF itemRectOld = item->sceneBoundingRect();
//Get the current transform
QTransform transform(item->transform());
@ -178,7 +179,7 @@ void VTableGraphicsView::rotateIt()
for ( qint32 i = 0; i < list.count(); ++i )
{
QGraphicsItem *item = list.at(i);
Q_CHECK_PTR(item);
SCASSERT(item != nullptr);
item->setTransformOriginPoint(item->boundingRect().center());
item->setRotation(item->rotation() + 90);
}

View File

@ -204,8 +204,8 @@ bool VPattern::SetNameDraw(const QString &name)
//---------------------------------------------------------------------------------------------------------------------
void VPattern::Parse(const Document::Documents &parse, VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail)
{
Q_CHECK_PTR(sceneDraw);
Q_CHECK_PTR(sceneDetail);
SCASSERT(sceneDraw != nullptr);
SCASSERT(sceneDetail != nullptr);
QStringList tags{TagDraw, TagIncrements, TagAuthor, TagDescription, TagNotes, TagMeasurements, TagVersion};
PrepareForParse(parse, sceneDraw, sceneDetail);
QDomNode domNode = documentElement().firstChild();
@ -326,7 +326,7 @@ void VPattern::setCurrentData()
void VPattern::AddTool(const quint32 &id, VDataTool *tool)
{
Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0");
Q_CHECK_PTR(tool);
SCASSERT(tool != nullptr);
tools.insert(id, tool);
}
@ -334,9 +334,9 @@ void VPattern::AddTool(const quint32 &id, VDataTool *tool)
void VPattern::UpdateToolData(const quint32 &id, VContainer *data)
{
Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0");
Q_CHECK_PTR(data);
SCASSERT(data != nullptr);
VDataTool *tool = tools.value(id);
Q_CHECK_PTR(tool);
SCASSERT(tool != nullptr);
tool->VDataTool::setData(data);
}
@ -345,7 +345,7 @@ void VPattern::IncrementReferens(quint32 id) const
{
Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0");
VDataTool *tool = tools.value(id);
Q_CHECK_PTR(tool);
SCASSERT(tool != nullptr);
tool->incrementReferens();
}
@ -354,7 +354,7 @@ void VPattern::DecrementReferens(quint32 id) const
{
Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0");
VDataTool *tool = tools.value(id);
Q_CHECK_PTR(tool);
SCASSERT(tool != nullptr);
tool->decrementReferens();
}
@ -675,8 +675,8 @@ void VPattern::ParseDrawElement(VMainGraphicsScene *sceneDraw, VMainGraphicsScen
void VPattern::ParseDrawMode(VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail, const QDomNode &node,
const Document::Documents &parse, const Valentina::Draws &mode)
{
Q_CHECK_PTR(sceneDraw);
Q_CHECK_PTR(sceneDetail);
SCASSERT(sceneDraw != nullptr);
SCASSERT(sceneDetail != nullptr);
VMainGraphicsScene *scene = nullptr;
if (mode == Valentina::Calculation)
{
@ -723,7 +723,7 @@ void VPattern::ParseDrawMode(VMainGraphicsScene *sceneDraw, VMainGraphicsScene *
void VPattern::ParseDetailElement(VMainGraphicsScene *sceneDetail, const QDomElement &domElement,
const Document::Documents &parse)
{
Q_CHECK_PTR(sceneDetail);
SCASSERT(sceneDetail != nullptr);
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
try
{
@ -791,7 +791,7 @@ void VPattern::ParseDetailElement(VMainGraphicsScene *sceneDetail, const QDomEle
void VPattern::ParseDetails(VMainGraphicsScene *sceneDetail, const QDomElement &domElement,
const Document::Documents &parse)
{
Q_CHECK_PTR(sceneDetail);
SCASSERT(sceneDetail != nullptr);
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
QDomNode domNode = domElement.firstChild();
while (domNode.isNull() == false)
@ -815,7 +815,7 @@ void VPattern::ParseDetails(VMainGraphicsScene *sceneDetail, const QDomElement &
void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElement,
const Document::Documents &parse, const QString &type)
{
Q_CHECK_PTR(scene);
SCASSERT(scene != nullptr);
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
Q_ASSERT_X(type.isEmpty() == false, Q_FUNC_INFO, "type of point is empty");
@ -1315,7 +1315,7 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
void VPattern::ParseLineElement(VMainGraphicsScene *scene, const QDomElement &domElement,
const Document::Documents &parse)
{
Q_CHECK_PTR(scene);
SCASSERT(scene != nullptr);
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
try
{
@ -1339,7 +1339,7 @@ void VPattern::ParseLineElement(VMainGraphicsScene *scene, const QDomElement &do
void VPattern::ParseSplineElement(VMainGraphicsScene *scene, const QDomElement &domElement,
const Document::Documents &parse, const QString &type)
{
Q_CHECK_PTR(scene);
SCASSERT(scene != nullptr);
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
Q_ASSERT_X(type.isEmpty() == false, Q_FUNC_INFO, "type of spline is empty");
@ -1461,7 +1461,7 @@ void VPattern::ParseSplineElement(VMainGraphicsScene *scene, const QDomElement &
void VPattern::ParseArcElement(VMainGraphicsScene *scene, QDomElement &domElement, const Document::Documents &parse,
const QString &type)
{
Q_CHECK_PTR(scene);
SCASSERT(scene != nullptr);
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
Q_ASSERT_X(type.isEmpty() == false, Q_FUNC_INFO, "type of spline is empty");
@ -1535,7 +1535,7 @@ void VPattern::ParseArcElement(VMainGraphicsScene *scene, QDomElement &domElemen
void VPattern::ParseToolsElement(VMainGraphicsScene *scene, const QDomElement &domElement,
const Document::Documents &parse, const QString &type)
{
Q_CHECK_PTR(scene);
SCASSERT(scene != nullptr);
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
Q_ASSERT_X(type.isEmpty() == false, Q_FUNC_INFO, "type of spline is empty");
@ -1648,8 +1648,8 @@ void VPattern::CollectId(const QDomElement &node, QVector<quint32> &vector) cons
void VPattern::PrepareForParse(const Document::Documents &parse, VMainGraphicsScene *sceneDraw,
VMainGraphicsScene *sceneDetail)
{
Q_CHECK_PTR(sceneDraw);
Q_CHECK_PTR(sceneDetail);
SCASSERT(sceneDraw != nullptr);
SCASSERT(sceneDetail != nullptr);
if (parse == Document::FullParse)
{
TestUniqueId();