From db2a3e9ca905e78089bf904c7a7d110ee805c50c Mon Sep 17 00:00:00 2001 From: dismine Date: Mon, 10 Mar 2014 18:22:55 +0200 Subject: [PATCH] Operator new throw exception bad_alloc, so does not make sense to use Q_CHECK_PTR macros for check. --HG-- branch : feature --- src/container/vcontainer.h | 1 - src/dialogs/app/configdialog.cpp | 12 -------- src/dialogs/app/dialoghistory.cpp | 2 -- src/dialogs/app/dialogincrements.cpp | 2 -- src/dialogs/app/pages.cpp | 33 ---------------------- src/dialogs/tools/dialogtool.cpp | 1 + src/exception/vexception.cpp | 1 - src/mainwindow.cpp | 8 ------ src/tools/drawTools/vtoolarc.cpp | 1 - src/tools/drawTools/vtoolcutarc.cpp | 8 ------ src/tools/drawTools/vtoolcutspline.cpp | 8 ------ src/tools/drawTools/vtoolcutsplinepath.cpp | 6 ---- src/tools/drawTools/vtoolline.cpp | 1 - src/tools/drawTools/vtoolpoint.cpp | 3 -- src/tools/drawTools/vtoolspline.cpp | 1 - src/tools/drawTools/vtoolsplinepath.cpp | 1 - src/tools/nodeDetails/vnodearc.cpp | 1 - src/tools/nodeDetails/vnodepoint.cpp | 1 - src/tools/nodeDetails/vnodesplinepath.cpp | 1 - src/tools/vtooldetail.h | 1 - src/tools/vtooluniondetails.cpp | 22 --------------- src/widgets/doubledelegate.cpp | 1 - src/widgets/textdelegate.cpp | 2 -- src/widgets/vmaingraphicsview.cpp | 1 - src/xml/vpattern.cpp | 8 +----- 25 files changed, 2 insertions(+), 125 deletions(-) diff --git a/src/container/vcontainer.h b/src/container/vcontainer.h index 6124857ce..03c2e66cd 100644 --- a/src/container/vcontainer.h +++ b/src/container/vcontainer.h @@ -65,7 +65,6 @@ public: void CopyGObject(const VContainer &data, const quint32 &id) { T *obj = new T(*data.GeometricObject(id)); - Q_CHECK_PTR(obj); UpdateGObject(id, obj); } /** diff --git a/src/dialogs/app/configdialog.cpp b/src/dialogs/app/configdialog.cpp index dd287a059..a5e1a1244 100644 --- a/src/dialogs/app/configdialog.cpp +++ b/src/dialogs/app/configdialog.cpp @@ -32,7 +32,6 @@ ConfigDialog::ConfigDialog(QWidget *parent) : QDialog(parent), contentsWidget(nullptr), pagesWidget(nullptr), configurationPage(nullptr), patternPage(nullptr) { contentsWidget = new QListWidget; - Q_CHECK_PTR(contentsWidget); contentsWidget->setViewMode(QListView::IconMode); contentsWidget->setIconSize(QSize(96, 84)); contentsWidget->setMovement(QListView::Static); @@ -41,20 +40,14 @@ ConfigDialog::ConfigDialog(QWidget *parent) : contentsWidget->setSpacing(12); pagesWidget = new QStackedWidget; - Q_CHECK_PTR(pagesWidget); configurationPage = new ConfigurationPage(); - Q_CHECK_PTR(configurationPage); pagesWidget->addWidget(configurationPage); patternPage = new PatternPage(); - Q_CHECK_PTR(patternPage); pagesWidget->addWidget(patternPage); QPushButton *applyButton = new QPushButton(tr("Apply")); - Q_CHECK_PTR(applyButton); QPushButton *canselButton = new QPushButton(tr("&Cancel")); - Q_CHECK_PTR(canselButton); QPushButton *okButton = new QPushButton(tr("&Ok")); - Q_CHECK_PTR(okButton); createIcons(); contentsWidget->setCurrentRow(0); @@ -64,19 +57,16 @@ ConfigDialog::ConfigDialog(QWidget *parent) : connect(okButton, &QPushButton::clicked, this, &ConfigDialog::Ok); QHBoxLayout *horizontalLayout = new QHBoxLayout; - Q_CHECK_PTR(horizontalLayout); horizontalLayout->addWidget(contentsWidget); horizontalLayout->addWidget(pagesWidget, 1); QHBoxLayout *buttonsLayout = new QHBoxLayout; - Q_CHECK_PTR(buttonsLayout); buttonsLayout->addStretch(1); buttonsLayout->addWidget(applyButton); buttonsLayout->addWidget(canselButton); buttonsLayout->addWidget(okButton); QVBoxLayout *mainLayout = new QVBoxLayout; - Q_CHECK_PTR(mainLayout); mainLayout->addLayout(horizontalLayout); mainLayout->addStretch(1); mainLayout->addSpacing(12); @@ -107,14 +97,12 @@ void ConfigDialog::closeEvent(QCloseEvent *event) void ConfigDialog::createIcons() { QListWidgetItem *configButton = new QListWidgetItem(contentsWidget); - Q_CHECK_PTR(configButton); configButton->setIcon(QIcon("://icon/config.png")); configButton->setText(tr("Configuration")); configButton->setTextAlignment(Qt::AlignHCenter); configButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); QListWidgetItem *patternButton = new QListWidgetItem(contentsWidget); - Q_CHECK_PTR(patternButton); patternButton->setIcon(QIcon("://icon/pattern_config.png")); patternButton->setText(tr("Pattern")); patternButton->setTextAlignment(Qt::AlignHCenter); diff --git a/src/dialogs/app/dialoghistory.cpp b/src/dialogs/app/dialoghistory.cpp index cba05c601..04385ea9f 100644 --- a/src/dialogs/app/dialoghistory.cpp +++ b/src/dialogs/app/dialoghistory.cpp @@ -140,14 +140,12 @@ void DialogHistory::FillTable() { QTableWidgetItem *item = new QTableWidgetItem(QString()); - Q_CHECK_PTR(item); item->setTextAlignment(Qt::AlignHCenter); item->setData(Qt::UserRole, tool.getId()); ui->tableWidget->setItem(currentRow, 0, item); } QTableWidgetItem *item = new QTableWidgetItem(historyRecord); - Q_CHECK_PTR(item); item->setFont(QFont("Times", 12, QFont::Bold)); item->setFlags(item->flags() ^ Qt::ItemIsEditable); ui->tableWidget->setItem(currentRow, 1, item); diff --git a/src/dialogs/app/dialogincrements.cpp b/src/dialogs/app/dialogincrements.cpp index 65a530856..38cda7ffe 100644 --- a/src/dialogs/app/dialogincrements.cpp +++ b/src/dialogs/app/dialogincrements.cpp @@ -39,10 +39,8 @@ DialogIncrements::DialogIncrements(VContainer *data, VPattern *doc, QWidget *par { ui->setupUi(this); TextDelegate *textDelegate = new TextDelegate(ui->tableWidgetIncrement); - Q_CHECK_PTR(textDelegate); ui->tableWidgetIncrement->setItemDelegateForColumn(0, textDelegate); DoubleSpinBoxDelegate *doubleDelegate = new DoubleSpinBoxDelegate(ui->tableWidgetIncrement); - Q_CHECK_PTR(doubleDelegate); ui->tableWidgetIncrement->setItemDelegateForColumn(2, doubleDelegate); ui->tableWidgetIncrement->setItemDelegateForColumn(3, doubleDelegate); ui->tableWidgetIncrement->setItemDelegateForColumn(4, doubleDelegate); diff --git a/src/dialogs/app/pages.cpp b/src/dialogs/app/pages.cpp index 3d12cbe90..8dcf9c239 100644 --- a/src/dialogs/app/pages.cpp +++ b/src/dialogs/app/pages.cpp @@ -71,18 +71,14 @@ QGroupBox *ConfigurationPage::SaveGroup() QApplication::applicationName()); QGroupBox *saveGroup = new QGroupBox(tr("Save")); - Q_CHECK_PTR(saveGroup); autoSaveCheck = new QCheckBox(tr("Auto-save modified pattern")); - Q_CHECK_PTR(autoSaveCheck); bool autoSaveValue = settings.value("configuration/autosave/state", 1).toBool(); autoSaveCheck->setChecked(autoSaveValue); QLabel *intervalLabel = new QLabel(tr("Interval:")); - Q_CHECK_PTR(intervalLabel); autoTime = new QSpinBox(); - Q_CHECK_PTR(autoTime); bool ok = true; qint32 autoTimeValue = settings.value("configuration/autosave/time", 5).toInt(&ok); if (ok == false) @@ -94,13 +90,11 @@ QGroupBox *ConfigurationPage::SaveGroup() autoTime->setSuffix(tr("min")); QHBoxLayout *autosaveLayout = new QHBoxLayout; - Q_CHECK_PTR(autosaveLayout); autosaveLayout->addWidget(autoSaveCheck); autosaveLayout->addWidget(intervalLabel); autosaveLayout->addWidget(autoTime); QVBoxLayout *saveLayout = new QVBoxLayout; - Q_CHECK_PTR(saveLayout); saveLayout->addLayout(autosaveLayout); saveGroup->setLayout(saveLayout); return saveGroup; @@ -112,13 +106,8 @@ QGroupBox *ConfigurationPage::LangGroup() QApplication::applicationName()); QGroupBox *langGroup = new QGroupBox(tr("Language")); - Q_CHECK_PTR(langGroup); - QLabel *guiLabel = new QLabel(tr("GUI language")); - Q_CHECK_PTR(guiLabel); - langCombo = new QComboBox; - Q_CHECK_PTR(langCombo); // format systems language QString defaultLocale = QLocale::system().name(); // e.g. "de_DE" @@ -158,26 +147,21 @@ QGroupBox *ConfigurationPage::LangGroup() &ConfigurationPage::LangChenged); QHBoxLayout *guiLangLayout = new QHBoxLayout; - Q_CHECK_PTR(guiLangLayout); guiLangLayout->addWidget(guiLabel); guiLangLayout->addWidget(langCombo); QLabel *separatorLabel = new QLabel(tr("Decimal separator parts")); - Q_CHECK_PTR(separatorLabel); osOptionCheck = new QCheckBox(tr("With OS options (.)")); - Q_CHECK_PTR(osOptionCheck); //bool osOptionValue = settings.value("configuration/osSeparator", 1).toBool(); //osOptionCheck->setChecked(osOptionValue); osOptionCheck->setEnabled(false); QHBoxLayout *separatorLayout = new QHBoxLayout; - Q_CHECK_PTR(separatorLayout); separatorLayout->addWidget(separatorLabel); separatorLayout->addWidget(osOptionCheck); QVBoxLayout *langLayout = new QVBoxLayout; - Q_CHECK_PTR(langLayout); langLayout->addLayout(guiLangLayout); langLayout->addLayout(separatorLayout); langGroup->setLayout(langLayout); @@ -215,13 +199,9 @@ QGroupBox *PatternPage::UserGroup() QApplication::applicationName()); QGroupBox *userGroup = new QGroupBox(tr("User")); - Q_CHECK_PTR(userGroup); - QLabel *nameLabel = new QLabel(tr("User name")); - Q_CHECK_PTR(nameLabel); userName = new QLineEdit; - Q_CHECK_PTR(userName); #ifdef Q_OS_WIN QString user = settings.value("pattern/user", QString::fromLocal8Bit(qgetenv("USERNAME").constData())).toString(); #else @@ -230,12 +210,10 @@ QGroupBox *PatternPage::UserGroup() userName->setText(user); QHBoxLayout *nameLayout = new QHBoxLayout; - Q_CHECK_PTR(nameLayout); nameLayout->addWidget(nameLabel); nameLayout->addWidget(userName); QVBoxLayout *userLayout = new QVBoxLayout; - Q_CHECK_PTR(userLayout); userLayout->addLayout(nameLayout); userGroup->setLayout(userLayout); return userGroup; @@ -247,20 +225,16 @@ QGroupBox *PatternPage::GraphOutputGroup() // QApplication::applicationName()); QGroupBox *graphOutputGroup = new QGroupBox(tr("Graphical output")); - Q_CHECK_PTR(graphOutputGroup); graphOutputCheck = new QCheckBox(tr("Use antialiasing")); - Q_CHECK_PTR(graphOutputCheck); //bool graphOutputValue = settings.value("pattern/graphicalOutput", 1).toBool(); //graphOutputCheck->setChecked(graphOutputValue); graphOutputCheck->setEnabled(false); QHBoxLayout *graphLayout = new QHBoxLayout; - Q_CHECK_PTR(graphLayout); graphLayout->addWidget(graphOutputCheck); QVBoxLayout *graphOutputLayout = new QVBoxLayout; - Q_CHECK_PTR(graphOutputLayout); graphOutputLayout->addLayout(graphLayout); graphOutputGroup->setLayout(graphOutputLayout); return graphOutputGroup; @@ -272,13 +246,8 @@ QGroupBox *PatternPage::UndoneGroup() // QApplication::applicationName()); QGroupBox *undoneGroup = new QGroupBox(tr("Undone")); - Q_CHECK_PTR(undoneGroup); - QLabel *undoneLabel = new QLabel(tr("Count steps")); - Q_CHECK_PTR(undoneLabel); - undoneCount = new QSpinBox; - Q_CHECK_PTR(undoneCount); // bool ok = true; // qint32 count = settings.value("pattern/undone", 100).toInt(&ok); // if (ok == false) @@ -289,12 +258,10 @@ QGroupBox *PatternPage::UndoneGroup() undoneCount->setEnabled(false); QHBoxLayout *countLayout = new QHBoxLayout; - Q_CHECK_PTR(countLayout); countLayout->addWidget(undoneLabel); countLayout->addWidget(undoneCount); QVBoxLayout *undoneLayout = new QVBoxLayout; - Q_CHECK_PTR(undoneLayout); undoneLayout->addLayout(countLayout); undoneGroup->setLayout(undoneLayout); return undoneGroup; diff --git a/src/dialogs/tools/dialogtool.cpp b/src/dialogs/tools/dialogtool.cpp index 496c52be6..f39f773d0 100644 --- a/src/dialogs/tools/dialogtool.cpp +++ b/src/dialogs/tools/dialogtool.cpp @@ -276,6 +276,7 @@ void DialogTool::PutValHere(QLineEdit *lineEdit, QListWidget *listWidget) Q_CHECK_PTR(lineEdit); Q_CHECK_PTR(listWidget); QListWidgetItem *item = listWidget->currentItem(); + Q_CHECK_PTR(item); int pos = lineEdit->cursorPosition(); lineEdit->setText(lineEdit->text().insert(lineEdit->cursorPosition(), item->text())); lineEdit->setFocus(); diff --git a/src/exception/vexception.cpp b/src/exception/vexception.cpp index 9d76e95be..35216898b 100644 --- a/src/exception/vexception.cpp +++ b/src/exception/vexception.cpp @@ -56,7 +56,6 @@ void VException::CriticalMessageBox(const QString &situation, QWidget * parent) } msgBox.setIcon(QMessageBox::Critical); QSpacerItem* horizontalSpacer = new QSpacerItem(500, 0, QSizePolicy::Minimum, QSizePolicy::Expanding); - Q_CHECK_PTR(horizontalSpacer); QGridLayout* layout = static_cast(msgBox.layout()); Q_CHECK_PTR(layout); layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount()); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index fb05be135..b47bf60ef 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -166,7 +166,6 @@ void MainWindow::ActionNewDraw() const quint32 id = pattern->AddGObject(new VPointF(toPixel((10+comboBoxDraws->count()*5)), toPixel(10), "А", 5, 10)); VToolSinglePoint *spoint = new VToolSinglePoint(doc, pattern, id, Tool::FromGui); - Q_CHECK_PTR(spoint); sceneDraw->addItem(spoint); connect(spoint, &VToolPoint::ChoosedTool, sceneDraw, &VMainGraphicsScene::ChoosedItem); connect(sceneDraw, &VMainGraphicsScene::NewFactor, spoint, &VToolSinglePoint::SetFactor); @@ -218,7 +217,6 @@ void MainWindow::SetToolButton(bool checked, Tool::Tools t, const QString &curso view->setCursor(cur); helpLabel->setText(toolTip); dialogTool = new Dialog(pattern, this); - Q_CHECK_PTR(dialogTool); connect(currentScene, &VMainGraphicsScene::ChoosedObject, dialogTool, &DialogTool::ChoosedObject); connect(dialogTool, &DialogTool::DialogClosed, this, closeDialogSlot); connect(dialogTool, &DialogTool::ToolTip, this, &MainWindow::ShowToolTip); @@ -1001,7 +999,6 @@ void MainWindow::ActionTable(bool checked) if (checked) { dialogTable = new DialogIncrements(pattern, doc, this); - Q_CHECK_PTR(dialogTable); connect(dialogTable, &DialogIncrements::DialogClosed, this, &MainWindow::ClosedActionTable); dialogTable->show(); } @@ -1024,7 +1021,6 @@ void MainWindow::ActionHistory(bool checked) if (checked) { dialogHistory = new DialogHistory(pattern, doc, this); - Q_CHECK_PTR(dialogHistory); dialogHistory->setWindowFlags(Qt::Window); connect(dialogHistory, &DialogHistory::DialogClosed, this, &MainWindow::ClosedActionHistory); dialogHistory->show(); @@ -1284,7 +1280,6 @@ void MainWindow::CreateMenus() ui->menuFile->insertAction(ui->actionExit, recentFileActs[i]); } separatorAct = new QAction(this); - Q_CHECK_PTR(separatorAct); separatorAct->setSeparator(true); ui->menuFile->insertAction(ui->actionExit, separatorAct); UpdateRecentFileActions(); @@ -1315,7 +1310,6 @@ void MainWindow::CreateActions() for (int i = 0; i < MaxRecentFiles; ++i) { recentFileActs[i] = new QAction(this); - Q_CHECK_PTR(recentFileActs[i]); recentFileActs[i]->setVisible(false); connect(recentFileActs[i], &QAction::triggered, this, &MainWindow::OpenRecentFile); } @@ -1340,7 +1334,6 @@ void MainWindow::InitAutoSave() } autoSaveTimer = new QTimer(this); - Q_CHECK_PTR(autoSaveTimer); autoSaveTimer->setTimerType(Qt::VeryCoarseTimer); connect(autoSaveTimer, &QTimer::timeout, this, &MainWindow::AutoSavePattern); autoSaveTimer->start(autoTime*60000); @@ -1350,7 +1343,6 @@ void MainWindow::InitAutoSave() QString MainWindow::PatternPieceName(const QString &text) { QInputDialog *dlg = new QInputDialog(this); - Q_CHECK_PTR(dlg); dlg->setInputMode( QInputDialog::TextInput ); dlg->setLabelText(tr("Pattern piece:")); dlg->setTextEchoMode(QLineEdit::Normal); diff --git a/src/tools/drawTools/vtoolarc.cpp b/src/tools/drawTools/vtoolarc.cpp index f7e504b51..04c4687cb 100644 --- a/src/tools/drawTools/vtoolarc.cpp +++ b/src/tools/drawTools/vtoolarc.cpp @@ -112,7 +112,6 @@ void VToolArc::Create(const quint32 _id, const quint32 ¢er, const QString &r VPointF c = *data->GeometricObject(center); VArc *arc = new VArc(c, calcRadius, radius, calcF1, f1, calcF2, f2 ); - Q_CHECK_PTR(arc); quint32 id = _id; if (typeCreation == Tool::FromGui) { diff --git a/src/tools/drawTools/vtoolcutarc.cpp b/src/tools/drawTools/vtoolcutarc.cpp index d03df03ee..a16a9f87c 100644 --- a/src/tools/drawTools/vtoolcutarc.cpp +++ b/src/tools/drawTools/vtoolcutarc.cpp @@ -44,13 +44,11 @@ VToolCutArc::VToolCutArc(VPattern *doc, VContainer *data, const quint32 &id, con Q_ASSERT_X(arc2id > 0, Q_FUNC_INFO, "arc2id <= 0"); firstArc = new VSimpleArc(arc1id, ¤tColor, &factor); - Q_CHECK_PTR(firstArc); RefreshArc(firstArc, arc1id, SimpleArc::ForthPoint); firstArc->setParentItem(this); connect(firstArc, &VSimpleArc::Choosed, this, &VToolCutArc::ArcChoosed); secondArc = new VSimpleArc(arc2id, ¤tColor, &factor); - Q_CHECK_PTR(secondArc); RefreshArc(secondArc, arc2id, SimpleArc::FirstPoint); secondArc->setParentItem(this); connect(secondArc, &VSimpleArc::Choosed, this, &VToolCutArc::ArcChoosed); @@ -108,32 +106,26 @@ void VToolCutArc::Create(const quint32 _id, const QString &pointName, const QStr if (typeCreation == Tool::FromGui) { VPointF *p = new VPointF(point.x(), point.y(), pointName, mx, my); - Q_CHECK_PTR(p); id = data->AddGObject(p); VArc * ar1 = new VArc(arc1); - Q_CHECK_PTR(ar1); arc1id = data->AddGObject(ar1); VArc * ar2 = new VArc(arc2); - Q_CHECK_PTR(ar2); arc2id = data->AddGObject(ar2); } else { VPointF *p = new VPointF(point.x(), point.y(), pointName, mx, my); - Q_CHECK_PTR(p); data->UpdateGObject(id, p); arc1id = id + 1; arc2id = id + 2; VArc * ar1 = new VArc(arc1); - Q_CHECK_PTR(ar1); data->UpdateGObject(arc1id, ar1); VArc * ar2 = new VArc(arc2); - Q_CHECK_PTR(ar2); data->UpdateGObject(arc2id, ar2); if (parse != Document::FullParse) diff --git a/src/tools/drawTools/vtoolcutspline.cpp b/src/tools/drawTools/vtoolcutspline.cpp index ee7608e94..c806746e2 100644 --- a/src/tools/drawTools/vtoolcutspline.cpp +++ b/src/tools/drawTools/vtoolcutspline.cpp @@ -44,13 +44,11 @@ VToolCutSpline::VToolCutSpline(VPattern *doc, VContainer *data, const quint32 &i Q_ASSERT_X(spl2id > 0, Q_FUNC_INFO, "spl2id <= 0"); firstSpline = new VSimpleSpline(spl1id, ¤tColor, &factor); - Q_CHECK_PTR(firstSpline); RefreshSpline(firstSpline, spl1id, SimpleSpline::ForthPoint); firstSpline->setParentItem(this); connect(firstSpline, &VSimpleSpline::Choosed, this, &VToolCutSpline::SplineChoosed); secondSpline = new VSimpleSpline(spl2id, ¤tColor, &factor); - Q_CHECK_PTR(secondSpline); RefreshSpline(secondSpline, spl2id, SimpleSpline::FirstPoint); secondSpline->setParentItem(this); connect(secondSpline, &VSimpleSpline::Choosed, this, &VToolCutSpline::SplineChoosed); @@ -108,35 +106,29 @@ void VToolCutSpline::Create(const quint32 _id, const QString &pointName, if (typeCreation == Tool::FromGui) { VPointF *p = new VPointF(point.x(), point.y(), pointName, mx, my); - Q_CHECK_PTR(p); id = data->AddGObject(p); VSpline *spline1 = new VSpline(spl->GetP1(), spl1p2, spl1p3, *p, spl->GetKcurve()); - 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_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_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_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_CHECK_PTR(spline2); data->UpdateGObject(spl2id, spline2); data->AddLengthSpline(spline2->name(), toMM(spline2->GetLength())); diff --git a/src/tools/drawTools/vtoolcutsplinepath.cpp b/src/tools/drawTools/vtoolcutsplinepath.cpp index 138d4dd0b..e9eaa2647 100644 --- a/src/tools/drawTools/vtoolcutsplinepath.cpp +++ b/src/tools/drawTools/vtoolcutsplinepath.cpp @@ -45,13 +45,11 @@ VToolCutSplinePath::VToolCutSplinePath(VPattern *doc, VContainer *data, const qu Q_ASSERT_X(splPath2id > 0, Q_FUNC_INFO, "spl2id <= 0"); firstSpline = new VSimpleSpline(splPath1id, ¤tColor, &factor); - Q_CHECK_PTR(firstSpline); RefreshSpline(firstSpline, splPath1id, SimpleSpline::ForthPoint); firstSpline->setParentItem(this); connect(firstSpline, &VSimpleSpline::Choosed, this, &VToolCutSplinePath::SplineChoosed); secondSpline = new VSimpleSpline(splPath2id, ¤tColor, &factor); - Q_CHECK_PTR(secondSpline); RefreshSpline(secondSpline, splPath2id, SimpleSpline::FirstPoint); secondSpline->setParentItem(this); connect(secondSpline, &VSimpleSpline::Choosed, this, &VToolCutSplinePath::SplineChoosed); @@ -106,7 +104,6 @@ void VToolCutSplinePath::Create(const quint32 _id, const QString &pointName, con const QPointF point = splPath->CutSplinePath(toPixel(result), p1, p2, spl1p2, spl1p3, spl2p2, spl2p3); VPointF *p = new VPointF(point.x(), point.y(), pointName, mx, my); - Q_CHECK_PTR(p); if (typeCreation == Tool::FromGui) { id = data->AddGObject(p); @@ -125,9 +122,7 @@ void VToolCutSplinePath::Create(const quint32 _id, const QString &pointName, con const VSpline spl2 = VSpline(*p, spl2p2, spl2p3, splP2.P(), splPath->getKCurve()); VSplinePath *splPath1 = new VSplinePath(); - Q_CHECK_PTR(splPath1); VSplinePath *splPath2 = new VSplinePath(); - Q_CHECK_PTR(splPath2); if (typeCreation == Tool::FromGui) { for (qint32 i = 0; i < splPath->CountPoint(); i++) @@ -220,7 +215,6 @@ void VToolCutSplinePath::Create(const quint32 _id, const QString &pointName, con { VToolCutSplinePath *point = new VToolCutSplinePath(doc, data, id, formula, splinePathId, splPath1id, splPath2id, typeCreation); - Q_CHECK_PTR(point); scene->addItem(point); connect(point, &VToolPoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolPoint::SetFactor); diff --git a/src/tools/drawTools/vtoolline.cpp b/src/tools/drawTools/vtoolline.cpp index 7a03394fd..938855141 100644 --- a/src/tools/drawTools/vtoolline.cpp +++ b/src/tools/drawTools/vtoolline.cpp @@ -104,7 +104,6 @@ void VToolLine::Create(const quint32 &_id, const quint32 &firstPoint, const quin if (parse == Document::FullParse) { VToolLine *line = new VToolLine(doc, data, id, firstPoint, secondPoint, typeLine, typeCreation); - Q_CHECK_PTR(line); scene->addItem(line); connect(line, &VToolLine::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); connect(scene, &VMainGraphicsScene::NewFactor, line, &VToolLine::SetFactor); diff --git a/src/tools/drawTools/vtoolpoint.cpp b/src/tools/drawTools/vtoolpoint.cpp index cb3b2c32a..4b63db3b8 100644 --- a/src/tools/drawTools/vtoolpoint.cpp +++ b/src/tools/drawTools/vtoolpoint.cpp @@ -34,11 +34,9 @@ VToolPoint::VToolPoint(VPattern *doc, VContainer *data, quint32 id, QGraphicsIte QGraphicsEllipseItem(parent), radius(toPixel(2)), namePoint(0), lineName(0) { namePoint = new VGraphicsSimpleTextItem(this); - Q_CHECK_PTR(namePoint); connect(namePoint, &VGraphicsSimpleTextItem::ShowContextMenu, this, &VToolPoint::ShowContextMenu); namePoint->setBrush(Qt::black); lineName = new QGraphicsLineItem(this); - Q_CHECK_PTR(lineName); lineName->setPen(QPen(Qt::black)); connect(namePoint, &VGraphicsSimpleTextItem::NameChangePosition, this, &VToolPoint::NameChangePosition); this->setBrush(QBrush(Qt::NoBrush)); @@ -51,7 +49,6 @@ VToolPoint::VToolPoint(VPattern *doc, VContainer *data, quint32 id, QGraphicsIte void VToolPoint::NameChangePosition(const QPointF &pos) { VPointF *point = new VPointF(*VAbstractTool::data.GeometricObject(id)); - Q_CHECK_PTR(point); QPointF p = pos - this->pos(); point->setMx(p.x()); point->setMy(p.y()); diff --git a/src/tools/drawTools/vtoolspline.cpp b/src/tools/drawTools/vtoolspline.cpp index ef942471f..09fbf4381 100644 --- a/src/tools/drawTools/vtoolspline.cpp +++ b/src/tools/drawTools/vtoolspline.cpp @@ -111,7 +111,6 @@ void VToolSpline::Create(const quint32 _id, const quint32 &p1, const quint32 &p4 VPointF point1 = *data->GeometricObject(p1); VPointF point4 = *data->GeometricObject(p4); VSpline *spline = new VSpline(point1, point4, angle1, angle2, kAsm1, kAsm2, kCurve); - Q_CHECK_PTR(spline); quint32 id = _id; if (typeCreation == Tool::FromGui) { diff --git a/src/tools/drawTools/vtoolsplinepath.cpp b/src/tools/drawTools/vtoolsplinepath.cpp index 2f8bdc246..3f4df7ef0 100644 --- a/src/tools/drawTools/vtoolsplinepath.cpp +++ b/src/tools/drawTools/vtoolsplinepath.cpp @@ -87,7 +87,6 @@ void VToolSplinePath::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPat DialogSplinePath *dialogTool = qobject_cast(dialog); Q_CHECK_PTR(dialogTool); VSplinePath *path = new VSplinePath(dialogTool->GetPath()); - Q_CHECK_PTR(path); for (qint32 i = 0; i < path->CountPoint(); ++i) { doc->IncrementReferens((*path)[i].P().id()); diff --git a/src/tools/nodeDetails/vnodearc.cpp b/src/tools/nodeDetails/vnodearc.cpp index 9706f4d42..e2d55ef9f 100644 --- a/src/tools/nodeDetails/vnodearc.cpp +++ b/src/tools/nodeDetails/vnodearc.cpp @@ -57,7 +57,6 @@ void VNodeArc::Create(VPattern *doc, VContainer *data, quint32 id, quint32 idArc if (parse == Document::FullParse) { VNodeArc *arc = new VNodeArc(doc, data, id, idArc, typeCreation, idTool, parent); - Q_CHECK_PTR(arc); doc->AddTool(id, arc); if (idTool != 0) { diff --git a/src/tools/nodeDetails/vnodepoint.cpp b/src/tools/nodeDetails/vnodepoint.cpp index f11fb05e3..cf21cc2e1 100644 --- a/src/tools/nodeDetails/vnodepoint.cpp +++ b/src/tools/nodeDetails/vnodepoint.cpp @@ -68,7 +68,6 @@ void VNodePoint::Create(VPattern *doc, VContainer *data, quint32 id, quint32 idP //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_CHECK_PTR(point); doc->AddTool(id, point); if (idTool != 0) { diff --git a/src/tools/nodeDetails/vnodesplinepath.cpp b/src/tools/nodeDetails/vnodesplinepath.cpp index d707ce348..5470e1cd0 100644 --- a/src/tools/nodeDetails/vnodesplinepath.cpp +++ b/src/tools/nodeDetails/vnodesplinepath.cpp @@ -59,7 +59,6 @@ void VNodeSplinePath::Create(VPattern *doc, VContainer *data, quint32 id, quint3 if (parse == Document::FullParse) { VNodeSplinePath *splPath = new VNodeSplinePath(doc, data, id, idSpline, typeCreation, idTool, parent); - Q_CHECK_PTR(splPath); doc->AddTool(id, splPath); const VSplinePath *path = data->GeometricObject(id); const QVector *points = path->GetPoint(); diff --git a/src/tools/vtooldetail.h b/src/tools/vtooldetail.h index c15d4da54..21f84bb48 100644 --- a/src/tools/vtooldetail.h +++ b/src/tools/vtooldetail.h @@ -67,7 +67,6 @@ public: { //We can't use exist object. Need create new. T *node = new T(*data->GeometricObject(id)); - Q_CHECK_PTR(node); node->setMode(Draw::Modeling); return data->AddGObject(node); } diff --git a/src/tools/vtooluniondetails.cpp b/src/tools/vtooluniondetails.cpp index a0aa457cb..31c68715c 100644 --- a/src/tools/vtooluniondetails.cpp +++ b/src/tools/vtooluniondetails.cpp @@ -72,13 +72,11 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VPattern *doc, VContainer else { VPointF *point = new VPointF(*data->GeometricObject(det.at(i).getId())); - Q_CHECK_PTR(point); point->setMode(Draw::Modeling); BiasRotatePoint(point, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); idObject = data->AddGObject(point); VPointF *point1 = new VPointF(*point); - Q_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 +97,6 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VPattern *doc, VContainer VPointF p2 = VPointF(arc->GetP2().x(), arc->GetP2().y(), "A", 0, 0); BiasRotatePoint(&p2, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); VPointF *center = new VPointF(arc->GetCenter()); - Q_CHECK_PTR(center); BiasRotatePoint(center, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); @@ -111,12 +108,10 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VPattern *doc, VContainer VArc *arc1 = new VArc(*center, arc->GetRadius(), arc->GetFormulaRadius(), l1.angle(), QString().setNum(l1.angle()), l2.angle(), QString().setNum(l2.angle())); - Q_CHECK_PTR(arc1); arc1->setMode(Draw::Modeling); idObject = data->AddGObject(arc1); VArc *arc2 = new VArc(*arc1); - Q_CHECK_PTR(arc2); arc2->setMode(Draw::Modeling); id = data->AddGObject(arc2); @@ -135,7 +130,6 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VPattern *doc, VContainer const VSpline *spline = data->GeometricObject(det.at(i).getId()); VPointF *p1 = new VPointF(spline->GetP1()); - Q_CHECK_PTR(p1); BiasRotatePoint(p1, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); quint32 idP1 = data->AddGObject(p1); @@ -146,17 +140,14 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VPattern *doc, VContainer BiasRotatePoint(&p3, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); VPointF *p4 = new VPointF(spline->GetP4()); - Q_CHECK_PTR(p4); BiasRotatePoint(p4, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); quint32 idP4 = data->AddGObject(p4); VSpline *spl = new VSpline(*p1, p2.toQPointF(), p3.toQPointF(), *p4, spline->GetKcurve(), 0, Draw::Modeling); - Q_CHECK_PTR(spl); idObject = data->AddGObject(spl); VSpline *spl1 = new VSpline(*spl); - 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 +163,6 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VPattern *doc, VContainer else { VSplinePath *path = new VSplinePath(); - Q_CHECK_PTR(path); path->setMode(Draw::Modeling); const VSplinePath *splinePath = data->GeometricObject(det.at(i).getId()); qint32 k = splinePath->getMaxCountPoints(); @@ -183,7 +173,6 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VPattern *doc, VContainer splinePath->at(i).KAsm1(), splinePath->getKCurve()); VPointF *p1 = new VPointF(spline.GetP1()); - Q_CHECK_PTR(p1); BiasRotatePoint(p1, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); quint32 idP1 = data->AddGObject(p1); @@ -198,7 +187,6 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VPattern *doc, VContainer angle); VPointF *p4 = new VPointF(spline.GetP4()); - Q_CHECK_PTR(p4); BiasRotatePoint(p4, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); quint32 idP4 = data->AddGObject(p4); @@ -221,7 +209,6 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VPattern *doc, VContainer idObject = data->AddGObject(path); VSplinePath *path1 = new VSplinePath(*path); - 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 +233,6 @@ void VToolUnionDetails::UpdatePoints(const quint32 &idDetail, VContainer *data, if (qFuzzyCompare(dx+1, 1) == false || qFuzzyCompare(dy+1, 1) == false || pRotate != 0) { VPointF *point = new VPointF(*data->GeometricObject(det.at(i).getId())); - Q_CHECK_PTR(point); point->setMode(Draw::Modeling); BiasRotatePoint(point, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); ++idCount; @@ -266,7 +252,6 @@ void VToolUnionDetails::UpdatePoints(const quint32 &idDetail, VContainer *data, VPointF p2 = VPointF(arc->GetP2()); BiasRotatePoint(&p2, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); VPointF *center = new VPointF(arc->GetCenter()); - Q_CHECK_PTR(center); BiasRotatePoint(center, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); @@ -277,7 +262,6 @@ void VToolUnionDetails::UpdatePoints(const quint32 &idDetail, VContainer *data, 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_CHECK_PTR(arc1); arc1->setMode(Draw::Modeling); ++idCount; data->UpdateGObject(idDetail+idCount, arc1); @@ -293,7 +277,6 @@ void VToolUnionDetails::UpdatePoints(const quint32 &idDetail, VContainer *data, const VSpline *spline = data->GeometricObject(det.at(i).getId()); VPointF *p1 = new VPointF(spline->GetP1()); - Q_CHECK_PTR(p1); BiasRotatePoint(p1, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); ++idCount; data->UpdateGObject(idDetail+idCount, p1); @@ -305,7 +288,6 @@ void VToolUnionDetails::UpdatePoints(const quint32 &idDetail, VContainer *data, BiasRotatePoint(&p3, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); VPointF *p4 = new VPointF(spline->GetP4()); - Q_CHECK_PTR(p4); BiasRotatePoint(p4, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); ++idCount; data->UpdateGObject(idDetail+idCount, p4); @@ -313,7 +295,6 @@ void VToolUnionDetails::UpdatePoints(const quint32 &idDetail, VContainer *data, VSpline *spl = new VSpline(*p1, p2.toQPointF(), p3.toQPointF(), *p4, spline->GetKcurve(), 0, Draw::Modeling); - Q_CHECK_PTR(spl); ++idCount; data->UpdateGObject(idDetail+idCount, spl); @@ -326,7 +307,6 @@ void VToolUnionDetails::UpdatePoints(const quint32 &idDetail, VContainer *data, if (qFuzzyCompare(dx+1, 1) == false || qFuzzyCompare(dy+1, 1) == false || pRotate != 0) { VSplinePath *path = new VSplinePath(); - Q_CHECK_PTR(path); path->setMode(Draw::Modeling); const VSplinePath *splinePath = data->GeometricObject(det.at(i).getId()); Q_CHECK_PTR(splinePath); @@ -338,7 +318,6 @@ void VToolUnionDetails::UpdatePoints(const quint32 &idDetail, VContainer *data, splinePath->at(i).KAsm1(), splinePath->getKCurve()); VPointF *p1 = new VPointF(spline.GetP1()); - Q_CHECK_PTR(p1); BiasRotatePoint(p1, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); ++idCount; @@ -354,7 +333,6 @@ void VToolUnionDetails::UpdatePoints(const quint32 &idDetail, VContainer *data, angle); VPointF *p4 = new VPointF(spline.GetP4()); - Q_CHECK_PTR(p4); BiasRotatePoint(p4, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); ++idCount; diff --git a/src/widgets/doubledelegate.cpp b/src/widgets/doubledelegate.cpp index 1b2bccf23..596bbbd91 100644 --- a/src/widgets/doubledelegate.cpp +++ b/src/widgets/doubledelegate.cpp @@ -37,7 +37,6 @@ QWidget *DoubleSpinBoxDelegate::createEditor(QWidget *parent, const QStyleOption Q_UNUSED(option); Q_UNUSED(index); QDoubleSpinBox *editor = new QDoubleSpinBox(parent); - Q_CHECK_PTR(editor); editor->setMinimum(-10000.0); editor->setMaximum(10000.0); connect(editor, &QDoubleSpinBox::editingFinished, this, &DoubleSpinBoxDelegate::commitAndCloseEditor); diff --git a/src/widgets/textdelegate.cpp b/src/widgets/textdelegate.cpp index a073dadf7..45c57d6c6 100644 --- a/src/widgets/textdelegate.cpp +++ b/src/widgets/textdelegate.cpp @@ -41,10 +41,8 @@ QWidget *TextDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem Q_UNUSED(option); Q_UNUSED(index); QLineEdit *editor = new QLineEdit(parent); - Q_CHECK_PTR(editor); QRegExp re("^(([^+ -/()\\^*%:;\"\'=.,><0-9]){1,1}[^+ -/()\\^*%:;\"\'=><]([0-9]){0,}){0,}$"); QRegExpValidator *v = new QRegExpValidator(re); - Q_CHECK_PTR(v); editor->setValidator( v ); connect(editor, &QLineEdit::editingFinished, this, &TextDelegate::commitAndCloseEditor); return editor; diff --git a/src/widgets/vmaingraphicsview.cpp b/src/widgets/vmaingraphicsview.cpp index ada2d8c81..2b972be03 100644 --- a/src/widgets/vmaingraphicsview.cpp +++ b/src/widgets/vmaingraphicsview.cpp @@ -54,7 +54,6 @@ void VMainGraphicsView::wheelEvent(QWheelEvent *event) } QTimeLine *anim = new QTimeLine(300, this); - Q_CHECK_PTR(anim); anim->setUpdateInterval(20); if (QApplication::keyboardModifiers() == Qt::ControlModifier) diff --git a/src/xml/vpattern.cpp b/src/xml/vpattern.cpp index 3c265a8e5..f3a8b64e2 100644 --- a/src/xml/vpattern.cpp +++ b/src/xml/vpattern.cpp @@ -402,7 +402,6 @@ bool VPattern::GetActivNodeElement(const QString &name, QDomElement &element) void VPattern::FullUpdateTree() { VMainGraphicsScene *scene = new VMainGraphicsScene(); - Q_CHECK_PTR(scene); try { Parse(Document::LiteParse, scene, scene); @@ -482,7 +481,7 @@ void VPattern::ParseDrawMode(VMainGraphicsScene *sceneDraw, VMainGraphicsScene * { Q_CHECK_PTR(sceneDraw); Q_CHECK_PTR(sceneDetail); - VMainGraphicsScene *scene = 0; + VMainGraphicsScene *scene = nullptr; if (mode == Draw::Calculation) { scene = sceneDraw; @@ -652,7 +651,6 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d if (parse == Document::FullParse) { spoint = new VToolSinglePoint(this, data, id, Tool::FromFile); - Q_CHECK_PTR(spoint); scene->addItem(spoint); connect(spoint, &VToolSinglePoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); connect(scene, &VMainGraphicsScene::NewFactor, spoint, &VToolSinglePoint::SetFactor); @@ -1042,7 +1040,6 @@ void VPattern::ParseSplineElement(VMainGraphicsScene *scene, const QDomElement & const quint32 id = GetParametrId(domElement); const qreal kCurve = GetParametrDouble(domElement, VAbstractTool::AttrKCurve, "1.0"); VSplinePath *path = new VSplinePath(kCurve); - Q_CHECK_PTR(path); const QDomNodeList nodeList = domElement.childNodes(); const qint32 num = nodeList.size(); @@ -1088,7 +1085,6 @@ void VPattern::ParseSplineElement(VMainGraphicsScene *scene, const QDomElement & const quint32 idObject = GetParametrUInt(domElement, VAbstractNode::AttrIdObject, "0"); const quint32 idTool = GetParametrUInt(domElement, VAbstractNode::AttrIdTool, "0"); VSpline *spl = new VSpline(*data->GeometricObject(idObject)); - Q_CHECK_PTR(spl); spl->setIdObject(idObject); spl->setMode(Draw::Modeling); data->UpdateGObject(id, spl); @@ -1108,7 +1104,6 @@ void VPattern::ParseSplineElement(VMainGraphicsScene *scene, const QDomElement & const quint32 idObject = GetParametrUInt(domElement, VAbstractNode::AttrIdObject, "0"); const quint32 idTool = GetParametrUInt(domElement, VAbstractNode::AttrIdTool, "0"); VSplinePath *path = new VSplinePath(*data->GeometricObject(idObject)); - Q_CHECK_PTR(path); path->setIdObject(idObject); path->setMode(Draw::Modeling); data->UpdateGObject(id, path); @@ -1164,7 +1159,6 @@ void VPattern::ParseArcElement(VMainGraphicsScene *scene, const QDomElement &dom const quint32 idObject = GetParametrUInt(domElement, VAbstractNode::AttrIdObject, "0"); const quint32 idTool = GetParametrUInt(domElement, VAbstractNode::AttrIdTool, "0"); VArc *arc = new VArc(*data->GeometricObject(idObject)); - Q_CHECK_PTR(arc); arc->setIdObject(idObject); arc->setMode(Draw::Modeling); data->UpdateGObject(id, arc);