From 88324a11f284a5b7cfc21c7b50981d71513332c9 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Wed, 28 Oct 2015 16:22:36 +0200 Subject: [PATCH] Static Code Analysis. --HG-- branch : develop --- .../configpages/tapeconfigurationpage.cpp | 14 +- .../tape/dialogs/configpages/tapepathpage.cpp | 21 +-- src/app/tape/dialogs/dialogmdatabase.cpp | 25 ++-- src/app/tape/mapplication.cpp | 4 +- src/app/tape/tmainwindow.cpp | 28 ++-- src/app/valentina/core/vapplication.cpp | 2 +- .../core/vtooloptionspropertybrowser.cpp | 2 +- .../core/vtooloptionspropertybrowser.h | 2 +- .../dialogs/configpages/communitypage.cpp | 41 +++--- .../dialogs/configpages/configurationpage.cpp | 28 ++-- .../dialogs/configpages/pathpage.cpp | 32 ++--- .../dialogs/configpages/patternpage.cpp | 7 +- src/app/valentina/dialogs/dialoghistory.cpp | 2 +- .../valentina/dialogs/dialogincrements.cpp | 2 +- src/app/valentina/dialogs/dialogincrements.h | 4 +- .../dialogs/dialoglayoutsettings.cpp | 43 +++--- .../dialogs/dialogpatternxmledit.cpp | 76 +++-------- src/app/valentina/mainwindow.cpp | 54 ++++---- src/app/valentina/mainwindowsnogui.cpp | 23 ++-- src/app/valentina/xml/vpattern.cpp | 76 +++++------ src/libs/ifc/exception/vexception.cpp | 2 +- .../exception/vexceptionconversionerror.cpp | 2 +- .../exception/vexceptionemptyparameter.cpp | 4 +- .../ifc/exception/vexceptionobjecterror.cpp | 2 +- src/libs/ifc/exception/vexceptionwrongid.cpp | 2 +- src/libs/ifc/xml/vabstractpattern.cpp | 16 +-- src/libs/ifc/xml/vdomdocument.cpp | 18 +-- src/libs/qmuparser/qmuparserbase.cpp | 84 ++++++------ src/libs/qmuparser/qmuparserbytecode.cpp | 122 +++++++++--------- src/libs/qmuparser/qmuparsertest.cpp | 24 ++-- src/libs/vdxf/dxflib/dl_dxf.cpp | 98 +++++--------- src/libs/vdxf/dxflib/dl_writer.cpp | 2 +- src/libs/vdxf/dxflib/dl_writer_ascii.cpp | 2 +- src/libs/vdxf/vdxfengine.cpp | 15 ++- src/libs/vgeometry/varc.cpp | 2 +- src/libs/vgeometry/vgobject.cpp | 2 +- src/libs/vgeometry/vspline_p.h | 4 +- src/libs/vgeometry/vsplinepath.cpp | 34 +++-- src/libs/vlayout/vcontour.cpp | 4 +- src/libs/vlayout/vlayoutdetail.cpp | 20 +-- src/libs/vlayout/vlayoutpaper.cpp | 2 +- src/libs/vlayout/vposition.cpp | 9 +- src/libs/vlayout/vposter.cpp | 29 +++-- src/libs/vmisc/projectversion.cpp | 3 +- src/libs/vobj/vobjengine.cpp | 10 +- src/libs/vobj/vobjpaintdevice.cpp | 6 +- src/libs/vpatterndb/vcontainer.cpp | 12 +- src/libs/vpatterndb/vcontainer.h | 4 +- src/libs/vpatterndb/vdetail.cpp | 4 +- src/libs/vpatterndb/vtranslatevars.cpp | 7 +- .../plugins/Vector3d/vvector3dproperty.h | 2 +- .../vpropertyexplorer/vpropertyformview.cpp | 2 +- .../support/dialogeditwrongformula.cpp | 2 +- .../dialogs/support/dialogeditwrongformula.h | 2 +- .../vtools/dialogs/tools/dialogdetail.cpp | 5 +- .../tools/dialogpointfromarcandtangent.cpp | 2 +- .../tools/dialogpointfromarcandtangent.h | 2 +- .../tools/dialogpointfromcircleandtangent.cpp | 2 +- .../tools/dialogpointfromcircleandtangent.h | 2 +- .../tools/dialogpointofintersectionarcs.cpp | 2 +- .../tools/dialogpointofintersectionarcs.h | 2 +- .../dialogpointofintersectioncircles.cpp | 2 +- .../tools/dialogpointofintersectioncircles.h | 2 +- .../vtools/dialogs/tools/dialogsplinepath.cpp | 3 +- src/libs/vtools/dialogs/tools/dialogtool.cpp | 2 +- .../tools/drawTools/toolcurve/vtoolarc.cpp | 13 +- .../toolcurve/vtoolarcwithlength.cpp | 13 +- .../tools/drawTools/toolcurve/vtoolspline.cpp | 5 +- .../drawTools/toolcurve/vtoolsplinepath.cpp | 3 +- .../tooldoublepoint/vtooltruedarts.cpp | 6 +- .../toolsinglepoint/toolcut/vtoolcut.cpp | 8 +- .../toolsinglepoint/toolcut/vtoolcutarc.cpp | 4 +- .../toolcut/vtoolcutspline.cpp | 5 +- .../toolcut/vtoolcutsplinepath.cpp | 5 +- .../toollinepoint/vtoolalongline.cpp | 5 +- .../toollinepoint/vtoolbisector.cpp | 5 +- .../toollinepoint/vtoolcurveintersectaxis.cpp | 6 +- .../toollinepoint/vtoolendline.cpp | 5 +- .../toollinepoint/vtoolheight.cpp | 5 +- .../toollinepoint/vtoollineintersectaxis.cpp | 6 +- .../toollinepoint/vtoollinepoint.cpp | 2 +- .../toollinepoint/vtoolnormal.cpp | 5 +- .../toollinepoint/vtoolshoulderpoint.cpp | 5 +- .../toolsinglepoint/vtoolbasepoint.cpp | 2 +- .../toolsinglepoint/vtoollineintersect.cpp | 5 +- .../vtoolpointfromarcandtangent.cpp | 7 +- .../vtoolpointfromarcandtangent.h | 2 +- .../vtoolpointfromcircleandtangent.cpp | 7 +- .../vtoolpointfromcircleandtangent.h | 2 +- .../toolsinglepoint/vtoolpointofcontact.cpp | 5 +- .../vtoolpointofintersection.cpp | 5 +- .../vtoolpointofintersectionarcs.cpp | 20 +-- .../vtoolpointofintersectionarcs.h | 2 +- .../vtoolpointofintersectioncircles.cpp | 8 +- .../vtoolpointofintersectioncircles.h | 2 +- .../toolsinglepoint/vtooltriangle.cpp | 5 +- src/libs/vtools/tools/drawTools/vdrawtool.h | 3 +- src/libs/vtools/tools/drawTools/vtoolline.cpp | 5 +- src/libs/vtools/tools/vdatatool.cpp | 17 --- src/libs/vtools/tools/vdatatool.h | 3 +- src/libs/vtools/tools/vtooldetail.cpp | 22 ++-- src/libs/vtools/tools/vtooluniondetails.cpp | 93 ++++++------- src/libs/vtools/visualization/visline.cpp | 2 +- .../vtools/visualization/vistoolalongline.cpp | 2 +- .../vtools/visualization/vistoolbisector.cpp | 2 +- .../vistoolcurveintersectaxis.cpp | 2 +- .../vtools/visualization/vistoolheight.cpp | 2 +- .../vtools/visualization/vistoolnormal.cpp | 2 +- .../vistoolpointfromcircleandtangent.cpp | 2 +- .../vistoolpointofintersection.cpp | 2 +- .../vistoolpointofintersectioncircles.cpp | 2 +- .../visualization/vistoolshoulderpoint.cpp | 4 +- .../vtools/visualization/vistoolspline.cpp | 2 +- .../vtools/visualization/vistooltriangle.cpp | 2 +- .../vtools/visualization/vistooltruedarts.cpp | 2 +- src/test/ParserTest/main.cpp | 4 +- src/test/ValentinaTest/tst_vlayoutdetail.cpp | 4 +- src/test/ValentinaTest/tst_vlockguard.cpp | 4 + 118 files changed, 682 insertions(+), 744 deletions(-) diff --git a/src/app/tape/dialogs/configpages/tapeconfigurationpage.cpp b/src/app/tape/dialogs/configpages/tapeconfigurationpage.cpp index 95ce1393c..4ca5a2f0a 100644 --- a/src/app/tape/dialogs/configpages/tapeconfigurationpage.cpp +++ b/src/app/tape/dialogs/configpages/tapeconfigurationpage.cpp @@ -76,16 +76,17 @@ TapeConfigurationPage::TapeConfigurationPage(QWidget *parent) //--------------------------------------------------------------------------------------------------------------------- void TapeConfigurationPage::Apply() { - qApp->TapeSettings()->SetOsSeparator(osOptionCheck->isChecked()); + VTapeSettings *settings = qApp->TapeSettings(); + settings->SetOsSeparator(osOptionCheck->isChecked()); if (langChanged || systemChanged) { const QString locale = qvariant_cast(langCombo->itemData(langCombo->currentIndex())); - qApp->TapeSettings()->SetLocale(locale); + settings->SetLocale(locale); langChanged = false; const QString code = qvariant_cast(systemCombo->itemData(systemCombo->currentIndex())); - qApp->TapeSettings()->SetPMSystemCode(code); + settings->SetPMSystemCode(code); systemChanged = false; qApp->LoadTranslation(locale); @@ -173,7 +174,8 @@ QGroupBox *TapeConfigurationPage::LangGroup() } // set default translators and language checked - qint32 index = langCombo->findData(qApp->TapeSettings()->GetLocale()); + VTapeSettings *settings = qApp->TapeSettings(); + qint32 index = langCombo->findData(settings->GetLocale()); if (index != -1) { langCombo->setCurrentIndex(index); @@ -209,7 +211,7 @@ QGroupBox *TapeConfigurationPage::LangGroup() &TapeConfigurationPage::SystemChanged); // set default pattern making system - index = systemCombo->findData(qApp->TapeSettings()->GetPMSystemCode()); + index = systemCombo->findData(settings->GetPMSystemCode()); if (index != -1) { systemCombo->setCurrentIndex(index); @@ -219,7 +221,7 @@ QGroupBox *TapeConfigurationPage::LangGroup() separatorLabel = new QLabel(tr("Decimal separator parts")); osOptionCheck = new QCheckBox(tr("With OS options (%1)").arg(QLocale::system().decimalPoint().toLatin1())); - osOptionCheck->setChecked(qApp->TapeSettings()->GetOsSeparator()); + osOptionCheck->setChecked(settings->GetOsSeparator()); langLayout->addRow(separatorLabel, osOptionCheck); //----------------------- diff --git a/src/app/tape/dialogs/configpages/tapepathpage.cpp b/src/app/tape/dialogs/configpages/tapepathpage.cpp index 621b7902c..389f81451 100644 --- a/src/app/tape/dialogs/configpages/tapepathpage.cpp +++ b/src/app/tape/dialogs/configpages/tapepathpage.cpp @@ -65,9 +65,10 @@ TapePathPage::TapePathPage(QWidget *parent) //--------------------------------------------------------------------------------------------------------------------- void TapePathPage::Apply() { - qApp->TapeSettings()->SetPathIndividualMeasurements(pathTable->item(0, 1)->text()); - qApp->TapeSettings()->SetPathStandardMeasurements(pathTable->item(1, 1)->text()); - qApp->TapeSettings()->SetPathTemplate(pathTable->item(2, 1)->text()); + VTapeSettings *settings = qApp->TapeSettings(); + settings->SetPathIndividualMeasurements(pathTable->item(0, 1)->text()); + settings->SetPathStandardMeasurements(pathTable->item(1, 1)->text()); + settings->SetPathTemplate(pathTable->item(2, 1)->text()); } //--------------------------------------------------------------------------------------------------------------------- @@ -194,24 +195,26 @@ void TapePathPage::InitTable() const QStringList tableHeader = QStringList() << tr("Type") << tr("Path"); pathTable->setHorizontalHeaderLabels(tableHeader); + const VTapeSettings *settings = qApp->TapeSettings(); + { pathTable->setItem(0, 0, new QTableWidgetItem(tr("Individual measurements"))); - QTableWidgetItem *item = new QTableWidgetItem(qApp->TapeSettings()->GetPathIndividualMeasurements()); - item->setToolTip(qApp->TapeSettings()->GetPathIndividualMeasurements()); + QTableWidgetItem *item = new QTableWidgetItem(settings->GetPathIndividualMeasurements()); + item->setToolTip(settings->GetPathIndividualMeasurements()); pathTable->setItem(0, 1, item); } { pathTable->setItem(1, 0, new QTableWidgetItem(tr("Standard measurements"))); - QTableWidgetItem *item = new QTableWidgetItem(qApp->TapeSettings()->GetPathStandardMeasurements()); - item->setToolTip(qApp->TapeSettings()->GetPathStandardMeasurements()); + QTableWidgetItem *item = new QTableWidgetItem(settings->GetPathStandardMeasurements()); + item->setToolTip(settings->GetPathStandardMeasurements()); pathTable->setItem(1, 1, item); } { pathTable->setItem(2, 0, new QTableWidgetItem(tr("Templates"))); - QTableWidgetItem *item = new QTableWidgetItem(qApp->TapeSettings()->GetPathTemplate()); - item->setToolTip(qApp->TapeSettings()->GetPathTemplate()); + QTableWidgetItem *item = new QTableWidgetItem(settings->GetPathTemplate()); + item->setToolTip(settings->GetPathTemplate()); pathTable->setItem(2, 1, item); } diff --git a/src/app/tape/dialogs/dialogmdatabase.cpp b/src/app/tape/dialogs/dialogmdatabase.cpp index 7e1033100..5de17dd8b 100644 --- a/src/app/tape/dialogs/dialogmdatabase.cpp +++ b/src/app/tape/dialogs/dialogmdatabase.cpp @@ -236,31 +236,29 @@ void DialogMDataBase::UpdateChecks(QTreeWidgetItem *item, int column) } else if (item->childCount() == 0 || column == -1) { - if (item->parent() == nullptr) + QTreeWidgetItem *parent = item->parent(); + if (parent == nullptr) { return; } - for (int j = 0; j < item->parent()->childCount(); ++j) + for (int j = 0; j < parent->childCount(); ++j) { - if (j != item->parent()->indexOfChild(item) - && item->checkState(0) != item->parent()->child(j)->checkState(0)) + if (j != parent->indexOfChild(item) + && item->checkState(0) != parent->child(j)->checkState(0)) { diff = true; } } if (diff) { - item->parent()->setCheckState(0, Qt::PartiallyChecked); + parent->setCheckState(0, Qt::PartiallyChecked); } else { - item->parent()->setCheckState(0, item->checkState(0)); + parent->setCheckState(0, item->checkState(0)); } - if (item->parent() != nullptr) - { - UpdateChecks(item->parent(), -1); - } + UpdateChecks(parent, -1); } } @@ -286,7 +284,8 @@ void DialogMDataBase::ShowDescription(QTreeWidgetItem *item, int column) } const QString name = item->data(0, Qt::UserRole).toString(); - const QString number = qApp->TrVars()->MNumber(name); + const VTranslateVars *trv = qApp->TrVars(); + const QString number = trv->MNumber(name); const QString iconPath = QString("://diagrams/%1.png").arg(MapDiagrams(number)); QString text = QString("

") .arg(iconPath) .arg(number) - .arg(qApp->TrVars()->GuiText(name)) - .arg(qApp->TrVars()->Description(name)); + .arg(trv->GuiText(name)) + .arg(trv->Description(name)); ui->textEdit->setHtml(text); } diff --git a/src/app/tape/mapplication.cpp b/src/app/tape/mapplication.cpp index 65a2bb8e9..d6dfdda36 100644 --- a/src/app/tape/mapplication.cpp +++ b/src/app/tape/mapplication.cpp @@ -158,7 +158,7 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con break; #endif case QtDebugMsg: - Q_UNREACHABLE(); + Q_UNREACHABLE(); //-V501 default: break; } @@ -249,7 +249,7 @@ bool MApplication::notify(QObject *receiver, QEvent *event) } catch (const VExceptionObjectError &e) { - qCCritical(mApp, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Error parsing file. Program will be terminated.")), + qCCritical(mApp, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Error parsing file. Program will be terminated.")), //-V807 qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation())); exit(V_EX_DATAERR); } diff --git a/src/app/tape/tmainwindow.cpp b/src/app/tape/tmainwindow.cpp index a684ce9c7..69a43c641 100644 --- a/src/app/tape/tmainwindow.cpp +++ b/src/app/tape/tmainwindow.cpp @@ -109,16 +109,8 @@ TMainWindow::TMainWindow(QWidget *parent) //--------------------------------------------------------------------------------------------------------------------- TMainWindow::~TMainWindow() { - if (data != nullptr) - { - delete data; - } - - if (m != nullptr) - { - delete m; - } - + delete data; + delete m; delete ui; } @@ -2411,20 +2403,22 @@ void TMainWindow::MeasurementReadOnly(bool ro) //--------------------------------------------------------------------------------------------------------------------- void TMainWindow::ReadSettings() { - restoreGeometry(qApp->TapeSettings()->GetGeometry()); - restoreState(qApp->TapeSettings()->GetWindowState()); - restoreState(qApp->TapeSettings()->GetToolbarsState(), APP_VERSION); + const VTapeSettings *settings = qApp->TapeSettings(); + restoreGeometry(settings->GetGeometry()); + restoreState(settings->GetWindowState()); + restoreState(settings->GetToolbarsState(), APP_VERSION); // Stack limit - //qApp->getUndoStack()->setUndoLimit(qApp->TapeSettings()->GetUndoCount()); + //qApp->getUndoStack()->setUndoLimit(settings->GetUndoCount()); } //--------------------------------------------------------------------------------------------------------------------- void TMainWindow::WriteSettings() { - qApp->TapeSettings()->SetGeometry(saveGeometry()); - qApp->TapeSettings()->SetWindowState(saveState()); - qApp->TapeSettings()->SetToolbarsState(saveState(APP_VERSION)); + VTapeSettings *settings = qApp->TapeSettings(); + settings->SetGeometry(saveGeometry()); + settings->SetWindowState(saveState()); + settings->SetToolbarsState(saveState(APP_VERSION)); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/app/valentina/core/vapplication.cpp b/src/app/valentina/core/vapplication.cpp index f392e4e7f..96a2eb350 100644 --- a/src/app/valentina/core/vapplication.cpp +++ b/src/app/valentina/core/vapplication.cpp @@ -307,7 +307,7 @@ bool VApplication::notify(QObject *receiver, QEvent *event) } catch (const VExceptionObjectError &e) { - qCCritical(vApp, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Error parsing file. Program will be terminated.")), + qCCritical(vApp, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Error parsing file. Program will be terminated.")), //-V807 qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation())); exit(V_EX_DATAERR); } diff --git a/src/app/valentina/core/vtooloptionspropertybrowser.cpp b/src/app/valentina/core/vtooloptionspropertybrowser.cpp index 58447ca0f..835145765 100644 --- a/src/app/valentina/core/vtooloptionspropertybrowser.cpp +++ b/src/app/valentina/core/vtooloptionspropertybrowser.cpp @@ -591,7 +591,7 @@ void VToolOptionsPropertyBrowser::SetPointName2(const QString &name) //--------------------------------------------------------------------------------------------------------------------- template -void VToolOptionsPropertyBrowser::SetCrossCirclesPoint(const QVariant value) +void VToolOptionsPropertyBrowser::SetCrossCirclesPoint(const QVariant &value) { if (Tool *i = qgraphicsitem_cast(currentItem)) { diff --git a/src/app/valentina/core/vtooloptionspropertybrowser.h b/src/app/valentina/core/vtooloptionspropertybrowser.h index cba5aef90..211522e3d 100644 --- a/src/app/valentina/core/vtooloptionspropertybrowser.h +++ b/src/app/valentina/core/vtooloptionspropertybrowser.h @@ -75,7 +75,7 @@ private: void SetPointName2(const QString &name); template - void SetCrossCirclesPoint(const QVariant value); + void SetCrossCirclesPoint(const QVariant &value); template void AddPropertyPointName(Tool *i, const QString &propertyName); diff --git a/src/app/valentina/dialogs/configpages/communitypage.cpp b/src/app/valentina/dialogs/configpages/communitypage.cpp index 638337312..35822dbc6 100644 --- a/src/app/valentina/dialogs/configpages/communitypage.cpp +++ b/src/app/valentina/dialogs/configpages/communitypage.cpp @@ -57,17 +57,18 @@ CommunityPage::CommunityPage(QWidget *parent): //--------------------------------------------------------------------------------------------------------------------- void CommunityPage::Apply() { - qApp->ValentinaSettings()->SetServer(this->server->text()); - qApp->ValentinaSettings()->SetServerSecure(this->secureComm->isChecked()); - qApp->ValentinaSettings()->SetProxy(this->useProxy->isChecked()); - qApp->ValentinaSettings()->SetProxyAddress(this->proxyAddress->text()); - qApp->ValentinaSettings()->SetProxyPort(this->proxyPort->text()); - qApp->ValentinaSettings()->SetProxyUser(this->proxyUser->text()); - qApp->ValentinaSettings()->SetProxyPass(this->proxyPass->text()); + VSettings *settings = qApp->ValentinaSettings(); + settings->SetServer(this->server->text()); + settings->SetServerSecure(this->secureComm->isChecked()); + settings->SetProxy(this->useProxy->isChecked()); + settings->SetProxyAddress(this->proxyAddress->text()); + settings->SetProxyPort(this->proxyPort->text()); + settings->SetProxyUser(this->proxyUser->text()); + settings->SetProxyPass(this->proxyPass->text()); - qApp->ValentinaSettings()->SetUsername(this->username->text()); - qApp->ValentinaSettings()->SetSavePassword(this->savePassword->isChecked()); - qApp->ValentinaSettings()->SetUserPassword(this->userpassword->text()); + settings->SetUsername(this->username->text()); + settings->SetSavePassword(this->savePassword->isChecked()); + settings->SetUserPassword(this->userpassword->text()); } @@ -136,12 +137,13 @@ QGroupBox *CommunityPage::ProxyGroup() QFormLayout *proxyLayout = new QFormLayout; - CommunityPage::add_checkbox(&this->useProxy, proxyLayout, qApp->ValentinaSettings()->GetProxy(), tr("Use Proxy")); - CommunityPage::add_lineedit(&this->proxyAddress, proxyLayout, qApp->ValentinaSettings()->GetProxyAddress(), + const VSettings *settings = qApp->ValentinaSettings(); + CommunityPage::add_checkbox(&this->useProxy, proxyLayout, settings->GetProxy(), tr("Use Proxy")); + CommunityPage::add_lineedit(&this->proxyAddress, proxyLayout, settings->GetProxyAddress(), tr("Proxy address")); - CommunityPage::add_lineedit(&this->proxyPort, proxyLayout, qApp->ValentinaSettings()->GetProxyPort(), tr("Proxy port")); - CommunityPage::add_lineedit(&this->proxyUser, proxyLayout, qApp->ValentinaSettings()->GetProxyUser(), tr("Proxy user")); - CommunityPage::add_lineedit(&this->proxyPass, proxyLayout, qApp->ValentinaSettings()->GetProxyPass(), tr("Proxy pass")); + CommunityPage::add_lineedit(&this->proxyPort, proxyLayout, settings->GetProxyPort(), tr("Proxy port")); + CommunityPage::add_lineedit(&this->proxyUser, proxyLayout, settings->GetProxyUser(), tr("Proxy user")); + CommunityPage::add_lineedit(&this->proxyPass, proxyLayout, settings->GetProxyPass(), tr("Proxy pass")); connect(this->useProxy, &QCheckBox::stateChanged, this, &CommunityPage::ProxyCheckChanged); this->ProxyCheckChanged(); @@ -156,11 +158,10 @@ QGroupBox *CommunityPage::UserGroup() QGroupBox *userGroup = new QGroupBox(tr("User settings")); QFormLayout *userLayout = new QFormLayout; - CommunityPage::add_lineedit(&this->username, userLayout, qApp->ValentinaSettings()->GetUsername(), tr("User Name")); - CommunityPage::add_checkbox(&this->savePassword, userLayout, qApp->ValentinaSettings()->GetSavePassword(), - tr("Save password")); - CommunityPage::add_lineedit(&this->userpassword, userLayout, qApp->ValentinaSettings()->GetUserPassword(), - tr("Password")); + const VSettings *settings = qApp->ValentinaSettings(); + CommunityPage::add_lineedit(&this->username, userLayout, settings->GetUsername(), tr("User Name")); + CommunityPage::add_checkbox(&this->savePassword, userLayout, settings->GetSavePassword(), tr("Save password")); + CommunityPage::add_lineedit(&this->userpassword, userLayout, settings->GetUserPassword(), tr("Password")); connect(this->savePassword, &QCheckBox::stateChanged, this, &CommunityPage::PasswordCheckChanged); this->PasswordCheckChanged(); diff --git a/src/app/valentina/dialogs/configpages/configurationpage.cpp b/src/app/valentina/dialogs/configpages/configurationpage.cpp index 10f0aa181..0e57b1351 100644 --- a/src/app/valentina/dialogs/configpages/configurationpage.cpp +++ b/src/app/valentina/dialogs/configpages/configurationpage.cpp @@ -67,23 +67,24 @@ ConfigurationPage::ConfigurationPage(QWidget *parent) //--------------------------------------------------------------------------------------------------------------------- void ConfigurationPage::Apply() { - qApp->ValentinaSettings()->SetAutosaveState(autoSaveCheck->isChecked()); - qApp->ValentinaSettings()->SetAutosaveTime(autoTime->value()); + VSettings *settings = qApp->ValentinaSettings(); + settings->SetAutosaveState(autoSaveCheck->isChecked()); + settings->SetAutosaveTime(autoTime->value()); QTimer *autoSaveTimer = qApp->getAutoSaveTimer(); SCASSERT(autoSaveTimer); autoSaveCheck->isChecked() ? autoSaveTimer->start(autoTime->value()*60000) : autoSaveTimer->stop(); - qApp->ValentinaSettings()->SetOsSeparator(osOptionCheck->isChecked()); - qApp->ValentinaSettings()->SetSendReportState(sendReportCheck->isChecked()); - qApp->ValentinaSettings()->SetConfirmItemDelete(askPointDeletionCheck->isChecked()); - qApp->ValentinaSettings()->SetToolBarStyle(toolBarStyleCheck->isChecked()); + settings->SetOsSeparator(osOptionCheck->isChecked()); + settings->SetSendReportState(sendReportCheck->isChecked()); + settings->SetConfirmItemDelete(askPointDeletionCheck->isChecked()); + settings->SetToolBarStyle(toolBarStyleCheck->isChecked()); if (langChanged) { const QString locale = qvariant_cast(langCombo->itemData(langCombo->currentIndex())); - qApp->ValentinaSettings()->SetLocale(locale); + settings->SetLocale(locale); langChanged = false; const QString text = tr("Setup user interface language updated and will be used the next time start") + " " + QApplication::applicationName(); @@ -92,7 +93,7 @@ void ConfigurationPage::Apply() if (this->unitChanged) { const QString unit = qvariant_cast(this->unitCombo->itemData(this->unitCombo->currentIndex())); - qApp->ValentinaSettings()->SetUnit(unit); + settings->SetUnit(unit); this->unitChanged = false; const QString text = tr("Default unit updated and will be used the next pattern creation"); QMessageBox::information(this, QApplication::applicationName(), text); @@ -100,7 +101,7 @@ void ConfigurationPage::Apply() if (labelLangChanged) { const QString locale = qvariant_cast(labelCombo->itemData(labelCombo->currentIndex())); - qApp->ValentinaSettings()->SetLabelLanguage(locale); + settings->SetLabelLanguage(locale); labelLangChanged = false; } } @@ -181,7 +182,8 @@ QGroupBox *ConfigurationPage::LangGroup() } // set default translators and language checked - qint32 index = langCombo->findData(qApp->ValentinaSettings()->GetLocale()); + const VSettings *settings = qApp->ValentinaSettings(); + qint32 index = langCombo->findData(settings->GetLocale()); if (index != -1) { langCombo->setCurrentIndex(index); @@ -197,7 +199,7 @@ QGroupBox *ConfigurationPage::LangGroup() QLabel *separatorLabel = new QLabel(tr("Decimal separator parts")); osOptionCheck = new QCheckBox(tr("With OS options (%1)").arg(QLocale::system().decimalPoint().toLatin1())); - osOptionCheck->setChecked(qApp->ValentinaSettings()->GetOsSeparator()); + osOptionCheck->setChecked(settings->GetOsSeparator()); QHBoxLayout *separatorLayout = new QHBoxLayout; separatorLayout->addWidget(separatorLabel); @@ -212,7 +214,7 @@ QGroupBox *ConfigurationPage::LangGroup() this->unitCombo->addItem(tr("Inches"), "in"); // set default unit - qint32 indexUnit = this->unitCombo->findData(qApp->ValentinaSettings()->GetUnit()); + qint32 indexUnit = this->unitCombo->findData(settings->GetUnit()); if (indexUnit != -1) { this->unitCombo->setCurrentIndex(indexUnit); @@ -231,7 +233,7 @@ QGroupBox *ConfigurationPage::LangGroup() SetLabelComboBox(VApplication::LabelLanguages()); - index = labelCombo->findData(qApp->ValentinaSettings()->GetLabelLanguage()); + index = labelCombo->findData(settings->GetLabelLanguage()); if (index != -1) { labelCombo->setCurrentIndex(index); diff --git a/src/app/valentina/dialogs/configpages/pathpage.cpp b/src/app/valentina/dialogs/configpages/pathpage.cpp index c57cf42b0..8915ded0b 100644 --- a/src/app/valentina/dialogs/configpages/pathpage.cpp +++ b/src/app/valentina/dialogs/configpages/pathpage.cpp @@ -62,11 +62,12 @@ PathPage::PathPage(QWidget *parent) //--------------------------------------------------------------------------------------------------------------------- void PathPage::Apply() { - qApp->ValentinaSettings()->SetPathIndividualMeasurements(pathTable->item(0, 1)->text()); - qApp->ValentinaSettings()->SetPathStandardMeasurements(pathTable->item(1, 1)->text()); - qApp->ValentinaSettings()->SetPathPattern(pathTable->item(2, 1)->text()); - qApp->ValentinaSettings()->SetPathLayout(pathTable->item(3, 1)->text()); - qApp->ValentinaSettings()->SetPathTemplate(pathTable->item(4, 1)->text()); + VSettings *settings = qApp->ValentinaSettings(); + settings->SetPathIndividualMeasurements(pathTable->item(0, 1)->text()); + settings->SetPathStandardMeasurements(pathTable->item(1, 1)->text()); + settings->SetPathPattern(pathTable->item(2, 1)->text()); + settings->SetPathLayout(pathTable->item(3, 1)->text()); + settings->SetPathTemplate(pathTable->item(4, 1)->text()); } //--------------------------------------------------------------------------------------------------------------------- @@ -187,39 +188,40 @@ void PathPage::InitTable() QStringList tableHeader = QStringList() << tr("Type") << tr("Path"); pathTable->setHorizontalHeaderLabels(tableHeader); + const VSettings *settings = qApp->ValentinaSettings(); { pathTable->setItem(0, 0, new QTableWidgetItem(tr("Individual measurements"))); - QTableWidgetItem *item = new QTableWidgetItem(qApp->ValentinaSettings()->GetPathIndividualMeasurements()); - item->setToolTip(qApp->ValentinaSettings()->GetPathIndividualMeasurements()); + QTableWidgetItem *item = new QTableWidgetItem(settings->GetPathIndividualMeasurements()); + item->setToolTip(settings->GetPathIndividualMeasurements()); pathTable->setItem(0, 1, item); } { pathTable->setItem(1, 0, new QTableWidgetItem(tr("Standard measurements"))); - QTableWidgetItem *item = new QTableWidgetItem(qApp->ValentinaSettings()->GetPathStandardMeasurements()); - item->setToolTip(qApp->ValentinaSettings()->GetPathStandardMeasurements()); + QTableWidgetItem *item = new QTableWidgetItem(settings->GetPathStandardMeasurements()); + item->setToolTip(settings->GetPathStandardMeasurements()); pathTable->setItem(1, 1, item); } { pathTable->setItem(2, 0, new QTableWidgetItem(tr("Patterns"))); - QTableWidgetItem *item = new QTableWidgetItem(qApp->ValentinaSettings()->GetPathPattern()); - item->setToolTip(qApp->ValentinaSettings()->GetPathPattern()); + QTableWidgetItem *item = new QTableWidgetItem(settings->GetPathPattern()); + item->setToolTip(settings->GetPathPattern()); pathTable->setItem(2, 1, item); } { pathTable->setItem(3, 0, new QTableWidgetItem(tr("Layout"))); - QTableWidgetItem *item = new QTableWidgetItem(qApp->ValentinaSettings()->GetPathLayout()); - item->setToolTip(qApp->ValentinaSettings()->GetPathLayout()); + QTableWidgetItem *item = new QTableWidgetItem(settings->GetPathLayout()); + item->setToolTip(settings->GetPathLayout()); pathTable->setItem(3, 1, item); } { pathTable->setItem(4, 0, new QTableWidgetItem(tr("Templates"))); - QTableWidgetItem *item = new QTableWidgetItem(qApp->ValentinaSettings()->GetPathTemplate()); - item->setToolTip(qApp->ValentinaSettings()->GetPathTemplate()); + QTableWidgetItem *item = new QTableWidgetItem(settings->GetPathTemplate()); + item->setToolTip(settings->GetPathTemplate()); pathTable->setItem(4, 1, item); } diff --git a/src/app/valentina/dialogs/configpages/patternpage.cpp b/src/app/valentina/dialogs/configpages/patternpage.cpp index 744b5fe12..e515adbca 100644 --- a/src/app/valentina/dialogs/configpages/patternpage.cpp +++ b/src/app/valentina/dialogs/configpages/patternpage.cpp @@ -58,17 +58,18 @@ PatternPage::PatternPage(QWidget *parent): //--------------------------------------------------------------------------------------------------------------------- void PatternPage::Apply() { - qApp->ValentinaSettings()->SetUser(userName->text()); + VSettings *settings = qApp->ValentinaSettings(); + settings->SetUser(userName->text()); // Scene antialiasing - qApp->ValentinaSettings()->SetGraphicalOutput(graphOutputCheck->isChecked()); + settings->SetGraphicalOutput(graphOutputCheck->isChecked()); qApp->getSceneView()->setRenderHint(QPainter::Antialiasing, graphOutputCheck->isChecked()); qApp->getSceneView()->setRenderHint(QPainter::SmoothPixmapTransform, graphOutputCheck->isChecked()); /* Maximum number of commands in undo stack may only be set when the undo stack is empty, since setting it on a * non-empty stack might delete the command at the current index. Calling setUndoLimit() on a non-empty stack * prints a warning and does nothing.*/ - qApp->ValentinaSettings()->SetUndoCount(undoCount->value()); + settings->SetUndoCount(undoCount->value()); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/app/valentina/dialogs/dialoghistory.cpp b/src/app/valentina/dialogs/dialoghistory.cpp index f9a8465fd..828a7bf57 100644 --- a/src/app/valentina/dialogs/dialoghistory.cpp +++ b/src/app/valentina/dialogs/dialoghistory.cpp @@ -211,7 +211,7 @@ QString DialogHistory::Record(const VToolRecord &tool) switch ( tool.getTypeTool() ) { case Tool::Arrow: - Q_UNREACHABLE(); + Q_UNREACHABLE(); //-V501 break; case Tool::BasePoint: { diff --git a/src/app/valentina/dialogs/dialogincrements.cpp b/src/app/valentina/dialogs/dialogincrements.cpp index 4d78026de..f129d167b 100644 --- a/src/app/valentina/dialogs/dialogincrements.cpp +++ b/src/app/valentina/dialogs/dialogincrements.cpp @@ -158,7 +158,7 @@ void DialogIncrements::FillIncrements() //--------------------------------------------------------------------------------------------------------------------- template -void DialogIncrements::FillTable(const QMap varTable, QTableWidget *table) +void DialogIncrements::FillTable(const QMap &varTable, QTableWidget *table) { SCASSERT(table != nullptr); diff --git a/src/app/valentina/dialogs/dialogincrements.h b/src/app/valentina/dialogs/dialogincrements.h index c6e8cc52c..c391ec7c5 100644 --- a/src/app/valentina/dialogs/dialogincrements.h +++ b/src/app/valentina/dialogs/dialogincrements.h @@ -80,7 +80,7 @@ private: Ui::DialogIncrements *ui; /** @brief data container with data */ - VContainer *data; // need because we must change data + VContainer *data; // need because we must change data //-V703 /** @brief doc dom document container */ VPattern *doc; @@ -88,7 +88,7 @@ private: int formulaBaseHeight; template - void FillTable(const QMap varTable, QTableWidget *table); + void FillTable(const QMap &varTable, QTableWidget *table); void FillIncrements(); void FillLengthsLines(); diff --git a/src/app/valentina/dialogs/dialoglayoutsettings.cpp b/src/app/valentina/dialogs/dialoglayoutsettings.cpp index 91a4802d4..574faf658 100644 --- a/src/app/valentina/dialogs/dialoglayoutsettings.cpp +++ b/src/app/valentina/dialogs/dialoglayoutsettings.cpp @@ -694,34 +694,35 @@ void DialogLayoutSettings::MinimumLayoutSize() //--------------------------------------------------------------------------------------------------------------------- void DialogLayoutSettings::ReadSettings() { + const VSettings *settings = qApp->ValentinaSettings(); + SetLayoutWidth(settings->GetLayoutWidth()); + SetShift(settings->GetLayoutShift()); - SetLayoutWidth(qApp->ValentinaSettings()->GetLayoutWidth()); - SetShift(qApp->ValentinaSettings()->GetLayoutShift()); - - const qreal width = UnitConvertor(qApp->ValentinaSettings()->GetLayoutPaperWidth(), Unit::Px, LayoutUnit()); - const qreal height = UnitConvertor(qApp->ValentinaSettings()->GetLayoutPaperHeight(), Unit::Px, LayoutUnit()); + const qreal width = UnitConvertor(settings->GetLayoutPaperWidth(), Unit::Px, LayoutUnit()); + const qreal height = UnitConvertor(settings->GetLayoutPaperHeight(), Unit::Px, LayoutUnit()); SheetSize(QSizeF(width, height)); - SetGroup(qApp->ValentinaSettings()->GetLayoutGroup()); - SetRotate(qApp->ValentinaSettings()->GetLayoutRotate()); - SetIncrease(qApp->ValentinaSettings()->GetLayoutRotationIncrease()); - SetAutoCrop(qApp->ValentinaSettings()->GetLayoutAutoCrop()); - SetSaveLength(qApp->ValentinaSettings()->GetLayoutSaveLength()); - SetUnitePages(qApp->ValentinaSettings()->GetLayoutUnitePages()); + SetGroup(settings->GetLayoutGroup()); + SetRotate(settings->GetLayoutRotate()); + SetIncrease(settings->GetLayoutRotationIncrease()); + SetAutoCrop(settings->GetLayoutAutoCrop()); + SetSaveLength(settings->GetLayoutSaveLength()); + SetUnitePages(settings->GetLayoutUnitePages()); } //--------------------------------------------------------------------------------------------------------------------- void DialogLayoutSettings::WriteSettings() const { - qApp->ValentinaSettings()->SetLayoutWidth(GetLayoutWidth()); - qApp->ValentinaSettings()->SetLayoutGroup(GetGroup()); - qApp->ValentinaSettings()->SetLayoutPaperHeight(GetPaperHeight()); - qApp->ValentinaSettings()->SetLayoutPaperWidth(GetPaperWidth()); - qApp->ValentinaSettings()->SetLayoutShift(GetShift()); - qApp->ValentinaSettings()->SetLayoutRotate(GetRotate()); - qApp->ValentinaSettings()->SetLayoutRotationIncrease(GetIncrease()); - qApp->ValentinaSettings()->SetLayoutAutoCrop(GetAutoCrop()); - qApp->ValentinaSettings()->SetLayoutSaveLength(IsSaveLength()); - qApp->ValentinaSettings()->SetLayoutUnitePages(IsUnitePages()); + VSettings *settings = qApp->ValentinaSettings(); + settings->SetLayoutWidth(GetLayoutWidth()); + settings->SetLayoutGroup(GetGroup()); + settings->SetLayoutPaperHeight(GetPaperHeight()); + settings->SetLayoutPaperWidth(GetPaperWidth()); + settings->SetLayoutShift(GetShift()); + settings->SetLayoutRotate(GetRotate()); + settings->SetLayoutRotationIncrease(GetIncrease()); + settings->SetLayoutAutoCrop(GetAutoCrop()); + settings->SetLayoutSaveLength(IsSaveLength()); + settings->SetLayoutUnitePages(IsUnitePages()); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/app/valentina/dialogs/dialogpatternxmledit.cpp b/src/app/valentina/dialogs/dialogpatternxmledit.cpp index 74a3f4763..ae2dcd356 100644 --- a/src/app/valentina/dialogs/dialogpatternxmledit.cpp +++ b/src/app/valentina/dialogs/dialogpatternxmledit.cpp @@ -590,22 +590,10 @@ void DialogPatternXmlEdit::RemoveChangeStackElement(ChangesStackElement* elmt) if (changeStackRoot == elmt) { - if (elmt->newText != nullptr) - { - delete elmt->newText; - } - if (elmt->newValue != nullptr) - { - delete elmt->newValue; - } - if (elmt->oldText != nullptr) - { - delete elmt->oldText; - } - if (elmt->oldValue != nullptr) - { - delete elmt->oldValue; - } + delete elmt->newText; + delete elmt->newValue; + delete elmt->oldText; + delete elmt->oldValue; this->changeStackRoot = elmt->next; if (this->changeStackLast == elmt) { @@ -627,22 +615,10 @@ void DialogPatternXmlEdit::RemoveChangeStackElement(ChangesStackElement* elmt) SCASSERT(index->next != nullptr); return; } - if (index->next->newText != nullptr) - { - delete index->next->newText; - } - if (index->next->newValue != nullptr) - { - delete index->next->newValue; - } - if (index->next->oldText != nullptr) - { - delete index->next->oldText; - } - if (index->next->oldValue != nullptr) - { - delete index->next->oldValue; - } + delete index->next->newText; + delete index->next->newValue; + delete index->next->oldText; + delete index->next->oldValue; index->next=index->next->next; if (this->changeStackLast == elmt) { @@ -903,7 +879,7 @@ void DialogPatternXmlEdit::NameTextEdited(QString newtext) } //--------------------------------------------------------------------------------------------------------------------- -void DialogPatternXmlEdit::ValueTextEdited(QString newtext) +void DialogPatternXmlEdit::ValueTextEdited(QString newtext) //-V524 { Q_UNUSED(newtext) //QMessageBox::information(this, "valueTextEdited", QString("%1").arg(newtext)); @@ -934,14 +910,8 @@ void DialogPatternXmlEdit::ClearStack() ChangesStackElement * tmp; while (changeStackRoot != nullptr) { - if (changeStackRoot->newText != nullptr) - { - delete changeStackRoot->newText; - } - if (changeStackRoot->newValue != nullptr) - { - delete changeStackRoot->newValue; - } + delete changeStackRoot->newText; + delete changeStackRoot->newValue; tmp=changeStackRoot; changeStackRoot=changeStackRoot->next; delete tmp; @@ -1084,13 +1054,14 @@ void DialogPatternXmlEdit::ReadNodes(QDomNode dNode, VXMLTreeElement* root, VXML { for (int i = 0; i < tNode.attributes().size(); i++) { - if ((tNode.attributes().item(i).nodeName() == "name") + const QDomNode node = tNode.attributes().item(i); + if ((node.nodeName() == "name") && (refresh == false)) { - ui->comboBox_Base_Selection->addItem(tNode.attributes().item(i).nodeValue(), + ui->comboBox_Base_Selection->addItem(node.nodeValue(), QVariant(rootBasesNum)); rootBases[rootBasesNum]=new VXMLTreeElement( - QString("Drawing %1").arg(tNode.attributes().item(i).nodeValue()), + QString("Drawing %1").arg(node.nodeValue()), VXMLTreeElement::TypeRoot, tNode, false); rootBasesNum++; //QStandardItem* rootNode = (QStandardItem*) rootBases[rootBasesNum]->invisibleRootItem(); @@ -1124,11 +1095,12 @@ void DialogPatternXmlEdit::ReadNodes(QDomNode dNode, VXMLTreeElement* root, VXML tElement->SetTreeNodeValue(tNode.nodeValue()); } - for (int i = 0; i < tNode.attributes().size(); i++) + const QDomNamedNodeMap attr = tNode.attributes(); + for (int i = 0; i < attr.size(); i++) { - tElement2 = new VXMLTreeElement(tNode.attributes().item(i).nodeName(), VXMLTreeElement::TypeAttr, + tElement2 = new VXMLTreeElement(attr.item(i).nodeName(), VXMLTreeElement::TypeAttr, tNode, false); - tElement2->SetTreeNodeValue(tNode.attributes().item(i).nodeValue()); + tElement2->SetTreeNodeValue(attr.item(i).nodeValue()); tElement->appendRow(tElement2); xmlmodel->appendchain(tElement2); } @@ -1172,22 +1144,12 @@ void VXMLTreeView::appendchain(VXMLTreeElement* elmt) if (last == nullptr) { // first element current = new TreeElementchain; - if (current == nullptr) - { - SCASSERT(current != nullptr); - // TODO : throw exception - } current->elmt=elmt; current->next=nullptr; last=items=current; return; } TreeElementchain* temp= new TreeElementchain; - if (temp == nullptr) - { - SCASSERT(temp != nullptr); - // TODO : throw exception - } temp->elmt=elmt; temp->next=nullptr; last->next=temp; diff --git a/src/app/valentina/mainwindow.cpp b/src/app/valentina/mainwindow.cpp index 99d8b8975..5ceb060bd 100644 --- a/src/app/valentina/mainwindow.cpp +++ b/src/app/valentina/mainwindow.cpp @@ -1540,7 +1540,7 @@ void MainWindow::CancelTool() ui->actionStopTool->setEnabled(true); return; case Tool::BasePoint: - Q_UNREACHABLE(); + Q_UNREACHABLE(); //-V501 //Nothing to do here because we can't create this tool from main window. break; case Tool::EndLine: @@ -2231,7 +2231,7 @@ void MainWindow::FullParseFile() } catch (const VExceptionObjectError &e) { - qCCritical(vMainWindow, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Error parsing file.")), + qCCritical(vMainWindow, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Error parsing file.")), //-V807 qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation())); SetEnabledGUI(false); if (not VApplication::CheckGUI()) @@ -2836,7 +2836,8 @@ void MainWindow::setCurrentFile(const QString &fileName) else { qCDebug(vMainWindow, "Updating recent file list."); - QStringList files = qApp->ValentinaSettings()->GetRecentFileList(); + VSettings *settings = qApp->ValentinaSettings(); + QStringList files = settings->GetRecentFileList(); files.removeAll(fileName); files.prepend(fileName); while (files.size() > MaxRecentFiles) @@ -2844,14 +2845,14 @@ void MainWindow::setCurrentFile(const QString &fileName) files.removeLast(); } - qApp->ValentinaSettings()->SetRecentFileList(files); + settings->SetRecentFileList(files); UpdateRecentFileActions(); qCDebug(vMainWindow, "Updating restore file list."); - QStringList restoreFiles = qApp->ValentinaSettings()->GetRestoreFileList(); + QStringList restoreFiles = settings->GetRestoreFileList(); restoreFiles.removeAll(fileName); restoreFiles.prepend(fileName); - qApp->ValentinaSettings()->SetRestoreFileList(restoreFiles); + settings->SetRestoreFileList(restoreFiles); } shownName+="[*]"; setWindowTitle(shownName); @@ -2875,17 +2876,18 @@ QString MainWindow::strippedName(const QString &fullFileName) void MainWindow::ReadSettings() { qCDebug(vMainWindow, "Reading settings."); - restoreGeometry(qApp->ValentinaSettings()->GetGeometry()); - restoreState(qApp->ValentinaSettings()->GetWindowState()); - restoreState(qApp->ValentinaSettings()->GetToolbarsState(), APP_VERSION); + const VSettings *settings = qApp->ValentinaSettings(); + restoreGeometry(settings->GetGeometry()); + restoreState(settings->GetWindowState()); + restoreState(settings->GetToolbarsState(), APP_VERSION); // Scene antialiasing - const bool graphOutputValue = qApp->ValentinaSettings()->GetGraphicalOutput(); + const bool graphOutputValue = settings->GetGraphicalOutput(); ui->view->setRenderHint(QPainter::Antialiasing, graphOutputValue); ui->view->setRenderHint(QPainter::SmoothPixmapTransform, graphOutputValue); // Stack limit - qApp->getUndoStack()->setUndoLimit(qApp->ValentinaSettings()->GetUndoCount()); + qApp->getUndoStack()->setUndoLimit(settings->GetUndoCount()); // Text under tool buton icon ToolBarStyles(); @@ -2899,9 +2901,10 @@ void MainWindow::WriteSettings() { ActionDraw(true); - qApp->ValentinaSettings()->SetGeometry(saveGeometry()); - qApp->ValentinaSettings()->SetWindowState(saveState()); - qApp->ValentinaSettings()->SetToolbarsState(saveState(APP_VERSION)); + VSettings *setings = qApp->ValentinaSettings(); + setings->SetGeometry(saveGeometry()); + setings->SetWindowState(saveState()); + setings->SetToolbarsState(saveState(APP_VERSION)); } //--------------------------------------------------------------------------------------------------------------------- @@ -3004,7 +3007,7 @@ void MainWindow::LastUsedTool() ArrowTool(); break; case Tool::BasePoint: - Q_UNREACHABLE(); + Q_UNREACHABLE(); //-V501 //Nothing to do here because we can't create this tool from main window. break; case Tool::EndLine: @@ -3849,7 +3852,8 @@ void MainWindow::SetHeight(const QString &text) //--------------------------------------------------------------------------------------------------------------------- void MainWindow::ProcessCMD() { - auto args = qApp->CommandLine()->OptInputFileNames(); + const VCommandLinePtr cmd = qApp->CommandLine(); + auto args = cmd->OptInputFileNames(); //Before we load pattern show window. if (VApplication::CheckGUI()) @@ -3869,33 +3873,33 @@ void MainWindow::ProcessCMD() for (int i=0, sz = args.size(); i < sz; ++i) { - const bool loaded = LoadPattern(args.at(static_cast(i)), qApp->CommandLine()->OptMeasurePath()); + const bool loaded = LoadPattern(args.at(static_cast(i)), cmd->OptMeasurePath()); if (not loaded && not VApplication::CheckGUI()) { return; // process only one input file } - if (qApp->CommandLine()->IsTestModeEnabled() || qApp->CommandLine()->IsExportEnabled()) + if (cmd->IsTestModeEnabled() || cmd->IsExportEnabled()) { - if (qApp->CommandLine()->IsSetGradationSize()) + if (cmd->IsSetGradationSize()) { - SetSize(qApp->CommandLine()->OptGradationSize()); + SetSize(cmd->OptGradationSize()); } - if (qApp->CommandLine()->IsSetGradationHeight()) + if (cmd->IsSetGradationHeight()) { - SetHeight(qApp->CommandLine()->OptGradationHeight()); + SetHeight(cmd->OptGradationHeight()); } } - if (not qApp->CommandLine()->IsTestModeEnabled()) + if (not cmd->IsTestModeEnabled()) { - if (qApp->CommandLine()->IsExportEnabled()) + if (cmd->IsExportEnabled()) { if (loaded) { - DoExport(qApp->CommandLine()); + DoExport(cmd); return; // process only one input file } break; diff --git a/src/app/valentina/mainwindowsnogui.cpp b/src/app/valentina/mainwindowsnogui.cpp index f449020db..003190811 100644 --- a/src/app/valentina/mainwindowsnogui.cpp +++ b/src/app/valentina/mainwindowsnogui.cpp @@ -419,11 +419,11 @@ void MainWindowsNoGUI::PrepareDetailsForLayout(const QHash *de { idetail.next(); VLayoutDetail det = VLayoutDetail(); - det.SetCountourPoints(idetail.value().ContourPoints(pattern)); - det.SetSeamAllowencePoints(idetail.value().SeamAllowancePoints(pattern), - idetail.value().getSeamAllowance()); - det.setName(idetail.value().getName()); - det.setWidth(qApp->toPixel(idetail.value().getWidth())); + const VDetail &d = idetail.value(); + det.SetCountourPoints(d.ContourPoints(pattern)); + det.SetSeamAllowencePoints(d.SeamAllowancePoints(pattern), d.getSeamAllowance()); + det.setName(d.getName()); + det.setWidth(qApp->toPixel(d.getWidth())); listDetails.append(det); } @@ -935,20 +935,21 @@ void MainWindowsNoGUI::UnitePages() for (int i = 0; i < papers.size(); ++i) { QGraphicsRectItem *paper = qgraphicsitem_cast(papers.at(i)); - SCASSERT(paper != nullptr) - if (length + paper->rect().height() <= QIMAGE_MAX) + SCASSERT(paper != nullptr); + const QRectF rec = paper->rect(); + if (length + rec.height() <= QIMAGE_MAX) { UniteDetails(j, nDetails, length, i); - length += paper->rect().height(); - UnitePapers(j, nPapers, paper->rect().width(), length); + length += rec.height(); + UnitePapers(j, nPapers, rec.width(), length); } else { length = 0; // Strat new paper ++j;// New paper UniteDetails(j, nDetails, length, i); - length += paper->rect().height(); - UnitePapers(j, nPapers, paper->rect().width(), length); + length += rec.height(); + UnitePapers(j, nPapers, rec.width(), length); } } diff --git a/src/app/valentina/xml/vpattern.cpp b/src/app/valentina/xml/vpattern.cpp index 19f7f9731..196510b84 100644 --- a/src/app/valentina/xml/vpattern.cpp +++ b/src/app/valentina/xml/vpattern.cpp @@ -265,7 +265,7 @@ void VPattern::setCurrentData() */ void VPattern::UpdateToolData(const quint32 &id, VContainer *data) { - Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0"); + Q_ASSERT_X(id != 0, Q_FUNC_INFO, "id == 0"); //-V712 //-V654 SCASSERT(data != nullptr); ToolExists(id); VDataTool *tool = tools.value(id); @@ -355,7 +355,7 @@ void VPattern::LiteParseTree(const Document &parse) } catch (const VExceptionObjectError &e) { - qCCritical(vXML, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Error parsing file.")), + qCCritical(vXML, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Error parsing file.")), //-V807 qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation())); emit SetEnabledGUI(false); if (not VApplication::CheckGUI()) @@ -548,7 +548,7 @@ void VPattern::ParseDrawMode(const QDomNode &node, const Document &parse, const */ void VPattern::ParseDetailElement(const QDomElement &domElement, const Document &parse) { - Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); + Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); try { VDetail detail; @@ -620,7 +620,7 @@ void VPattern::ParseDetailElement(const QDomElement &domElement, const Document */ void VPattern::ParseDetails(const QDomElement &domElement, const Document &parse) { - Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); + Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); QDomNode domNode = domElement.firstChild(); while (domNode.isNull() == false) { @@ -675,8 +675,8 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem const Document &parse, const QString &type) { 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"); + Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); + Q_ASSERT_X(not type.isEmpty(), Q_FUNC_INFO, "type of point is empty"); QStringList points = QStringList() << VToolBasePoint::ToolType /*0*/ << VToolEndLine::ToolType /*1*/ @@ -785,7 +785,7 @@ void VPattern::ParseLineElement(VMainGraphicsScene *scene, const QDomElement &do const Document &parse) { SCASSERT(scene != nullptr); - Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); + Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); try { quint32 id = 0; @@ -904,7 +904,7 @@ QString VPattern::GetLabelBase(quint32 index) const void VPattern::ParseToolBasePoint(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse) { SCASSERT(scene != nullptr); - Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); + Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); VToolBasePoint *spoint = 0; try @@ -949,7 +949,7 @@ void VPattern::ParseToolBasePoint(VMainGraphicsScene *scene, const QDomElement & void VPattern::ParseToolEndLine(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse) { SCASSERT(scene != nullptr); - Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); + Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); try { @@ -998,7 +998,7 @@ void VPattern::ParseToolEndLine(VMainGraphicsScene *scene, QDomElement &domEleme void VPattern::ParseToolAlongLine(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse) { SCASSERT(scene != nullptr); - Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); + Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); try { @@ -1042,7 +1042,7 @@ void VPattern::ParseToolAlongLine(VMainGraphicsScene *scene, QDomElement &domEle void VPattern::ParseToolShoulderPoint(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse) { SCASSERT(scene != nullptr); - Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); + Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); try { @@ -1087,7 +1087,7 @@ void VPattern::ParseToolShoulderPoint(VMainGraphicsScene *scene, QDomElement &do void VPattern::ParseToolNormal(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse) { SCASSERT(scene != nullptr); - Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); + Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); try { @@ -1132,7 +1132,7 @@ void VPattern::ParseToolNormal(VMainGraphicsScene *scene, QDomElement &domElemen void VPattern::ParseToolBisector(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse) { SCASSERT(scene != nullptr); - Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); + Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); try { @@ -1177,7 +1177,7 @@ void VPattern::ParseToolBisector(VMainGraphicsScene *scene, QDomElement &domElem void VPattern::ParseToolLineIntersect(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse) { SCASSERT(scene != nullptr); - Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); + Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); try { @@ -1207,7 +1207,7 @@ void VPattern::ParseToolLineIntersect(VMainGraphicsScene *scene, const QDomEleme void VPattern::ParseToolPointOfContact(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse) { SCASSERT(scene != nullptr); - Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); + Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); try { @@ -1249,7 +1249,7 @@ void VPattern::ParseToolPointOfContact(VMainGraphicsScene *scene, QDomElement &d //--------------------------------------------------------------------------------------------------------------------- void VPattern::ParseNodePoint(const QDomElement &domElement, const Document &parse) { - Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); + Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); try { @@ -1277,7 +1277,7 @@ void VPattern::ParseNodePoint(const QDomElement &domElement, const Document &par void VPattern::ParseToolHeight(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse) { SCASSERT(scene != nullptr); - Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); + Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); try { @@ -1308,7 +1308,7 @@ void VPattern::ParseToolHeight(VMainGraphicsScene *scene, const QDomElement &dom void VPattern::ParseToolTriangle(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse) { SCASSERT(scene != nullptr); - Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); + Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); try { @@ -1339,7 +1339,7 @@ void VPattern::ParseToolPointOfIntersection(VMainGraphicsScene *scene, const QDo const Document &parse) { SCASSERT(scene != nullptr); - Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); + Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); try { @@ -1367,7 +1367,7 @@ void VPattern::ParseToolPointOfIntersection(VMainGraphicsScene *scene, const QDo void VPattern::ParseToolCutSpline(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse) { SCASSERT(scene != nullptr); - Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); + Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); try { @@ -1410,7 +1410,7 @@ void VPattern::ParseToolCutSpline(VMainGraphicsScene *scene, QDomElement &domEle void VPattern::ParseToolCutSplinePath(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse) { SCASSERT(scene != nullptr); - Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); + Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); try { @@ -1454,7 +1454,7 @@ void VPattern::ParseToolCutSplinePath(VMainGraphicsScene *scene, QDomElement &do void VPattern::ParseToolCutArc(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse) { SCASSERT(scene != nullptr); - Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); + Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); try { @@ -1496,7 +1496,7 @@ void VPattern::ParseToolLineIntersectAxis(VMainGraphicsScene *scene, QDomElement const Document &parse) { SCASSERT(scene != nullptr); - Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); + Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); try { @@ -1546,7 +1546,7 @@ void VPattern::ParseToolCurveIntersectAxis(VMainGraphicsScene *scene, QDomElemen const Document &parse) { SCASSERT(scene != nullptr); - Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); + Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); try { @@ -1594,7 +1594,7 @@ void VPattern::ParseToolPointOfIntersectionArcs(VMainGraphicsScene *scene, const const Document &parse) { SCASSERT(scene != nullptr); - Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); + Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); try { @@ -1626,7 +1626,7 @@ void VPattern::ParseToolPointOfIntersectionCircles(VMainGraphicsScene *scene, QD const Document &parse) { SCASSERT(scene != nullptr); - Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); + Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); try { @@ -1668,7 +1668,7 @@ void VPattern::ParseToolPointFromCircleAndTangent(VMainGraphicsScene *scene, QDo const Document &parse) { SCASSERT(scene != nullptr); - Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); + Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); try { @@ -1708,7 +1708,7 @@ void VPattern::ParseToolPointFromArcAndTangent(VMainGraphicsScene *scene, const const Document &parse) { SCASSERT(scene != nullptr); - Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); + Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); try { @@ -1739,7 +1739,7 @@ void VPattern::ParseToolPointFromArcAndTangent(VMainGraphicsScene *scene, const void VPattern::ParseToolTrueDarts(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse) { SCASSERT(scene != nullptr); - Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); + Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); try { @@ -1781,7 +1781,7 @@ void VPattern::ParseToolTrueDarts(VMainGraphicsScene *scene, const QDomElement & void VPattern::ParseToolSpline(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse) { SCASSERT(scene != nullptr); - Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); + Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); try { @@ -1812,7 +1812,7 @@ void VPattern::ParseToolSpline(VMainGraphicsScene *scene, const QDomElement &dom void VPattern::ParseToolSplinePath(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse) { SCASSERT(scene != nullptr); - Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); + Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); try { @@ -1864,7 +1864,7 @@ void VPattern::ParseToolSplinePath(VMainGraphicsScene *scene, const QDomElement //--------------------------------------------------------------------------------------------------------------------- void VPattern::ParseNodeSpline(const QDomElement &domElement, const Document &parse) { - Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); + Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); try { @@ -1890,7 +1890,7 @@ void VPattern::ParseNodeSpline(const QDomElement &domElement, const Document &pa //--------------------------------------------------------------------------------------------------------------------- void VPattern::ParseNodeSplinePath(const QDomElement &domElement, const Document &parse) { - Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); + Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); try { @@ -1960,7 +1960,7 @@ void VPattern::ParseToolArc(VMainGraphicsScene *scene, QDomElement &domElement, //--------------------------------------------------------------------------------------------------------------------- void VPattern::ParseNodeArc(const QDomElement &domElement, const Document &parse) { - Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); + Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); try { @@ -2145,8 +2145,8 @@ void VPattern::ParseArcElement(VMainGraphicsScene *scene, QDomElement &domElemen const QString &type) { 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"); + Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); + Q_ASSERT_X(not type.isEmpty(), Q_FUNC_INFO, "type of arc is empty"); QStringList arcs = QStringList() << VToolArc::ToolType /*0*/ << VNodeArc::ToolType /*1*/ @@ -2604,7 +2604,7 @@ QRectF VPattern::ToolBoundingRect(const QRectF &rec, const quint32 &id) const */ void VPattern::IncrementReferens(quint32 id) const { - Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0"); + Q_ASSERT_X(id != 0, Q_FUNC_INFO, "id == 0"); ToolExists(id); VDataTool *tool = tools.value(id); SCASSERT(tool != nullptr); @@ -2618,7 +2618,7 @@ void VPattern::IncrementReferens(quint32 id) const */ void VPattern::DecrementReferens(quint32 id) const { - Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0"); + Q_ASSERT_X(id != 0, Q_FUNC_INFO, "id == 0"); ToolExists(id); VDataTool *tool = tools.value(id); SCASSERT(tool != nullptr); diff --git a/src/libs/ifc/exception/vexception.cpp b/src/libs/ifc/exception/vexception.cpp index 02887f2b8..ee0123c2c 100644 --- a/src/libs/ifc/exception/vexception.cpp +++ b/src/libs/ifc/exception/vexception.cpp @@ -44,7 +44,7 @@ */ VException::VException(const QString &what):QException(), what(what), moreInfo(QString()) { - Q_ASSERT_X(what.isEmpty() == false, Q_FUNC_INFO, "Error message is empty"); + Q_ASSERT_X(not what.isEmpty(), Q_FUNC_INFO, "Error message is empty"); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/ifc/exception/vexceptionconversionerror.cpp b/src/libs/ifc/exception/vexceptionconversionerror.cpp index 3ae802ec7..8c8d8369c 100644 --- a/src/libs/ifc/exception/vexceptionconversionerror.cpp +++ b/src/libs/ifc/exception/vexceptionconversionerror.cpp @@ -37,7 +37,7 @@ VExceptionConversionError::VExceptionConversionError(const QString &what, const QString &str) :VException(what), str(str) { - Q_ASSERT_X(str.isEmpty() == false, Q_FUNC_INFO, "Error converting string is empty"); + Q_ASSERT_X(not str.isEmpty(), Q_FUNC_INFO, "Error converting string is empty"); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/ifc/exception/vexceptionemptyparameter.cpp b/src/libs/ifc/exception/vexceptionemptyparameter.cpp index 1123d65b4..97fcc8679 100644 --- a/src/libs/ifc/exception/vexceptionemptyparameter.cpp +++ b/src/libs/ifc/exception/vexceptionemptyparameter.cpp @@ -41,8 +41,8 @@ VExceptionEmptyParameter::VExceptionEmptyParameter(const QString &what, const QS const QDomElement &domElement) : VException(what), name(name), tagText(QString()), tagName(QString()), lineNumber(-1) { - Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); - Q_ASSERT_X(name.isEmpty() == false, Q_FUNC_INFO, "Parameter name is empty"); + Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); + Q_ASSERT_X(not name.isEmpty(), Q_FUNC_INFO, "Parameter name is empty"); QTextStream stream(&tagText); domElement.save(stream, 4); tagName = domElement.tagName(); diff --git a/src/libs/ifc/exception/vexceptionobjecterror.cpp b/src/libs/ifc/exception/vexceptionobjecterror.cpp index b3d1258d4..757e2ae84 100644 --- a/src/libs/ifc/exception/vexceptionobjecterror.cpp +++ b/src/libs/ifc/exception/vexceptionobjecterror.cpp @@ -39,7 +39,7 @@ VExceptionObjectError::VExceptionObjectError(const QString &what, const QDomElement &domElement) :VException(what), tagText(QString()), tagName(QString()), lineNumber(-1) { - Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); + Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); QTextStream stream(&tagText); domElement.save(stream, 4); tagName = domElement.tagName(); diff --git a/src/libs/ifc/exception/vexceptionwrongid.cpp b/src/libs/ifc/exception/vexceptionwrongid.cpp index 93fdd7fb5..1a2c5e196 100644 --- a/src/libs/ifc/exception/vexceptionwrongid.cpp +++ b/src/libs/ifc/exception/vexceptionwrongid.cpp @@ -39,7 +39,7 @@ VExceptionWrongId::VExceptionWrongId(const QString &what, const QDomElement &domElement) :VException(what), tagText(QString()), tagName(QString()), lineNumber(-1) { - Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); + Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); QTextStream stream(&tagText); domElement.save(stream, 4); tagName = domElement.tagName(); diff --git a/src/libs/ifc/xml/vabstractpattern.cpp b/src/libs/ifc/xml/vabstractpattern.cpp index a98302dc5..675e9d3ea 100644 --- a/src/libs/ifc/xml/vabstractpattern.cpp +++ b/src/libs/ifc/xml/vabstractpattern.cpp @@ -170,7 +170,7 @@ QStringList VAbstractPattern::ListMeasurements() const */ void VAbstractPattern::ChangeActivPP(const QString &name, const Document &parse) { - Q_ASSERT_X(name.isEmpty() == false, "ChangeActivPP", "name pattern piece is empty"); + Q_ASSERT_X(not name.isEmpty(), Q_FUNC_INFO, "name pattern piece is empty"); if (CheckExistNamePP(name) && this->nameActivPP != name) { this->nameActivPP = name; @@ -231,7 +231,7 @@ bool VAbstractPattern::GetActivDrawElement(QDomElement &element) const */ bool VAbstractPattern::CheckExistNamePP(const QString &name) const { - Q_ASSERT_X(name.isEmpty() == false, "CheckNameDraw", "name draw is empty"); + Q_ASSERT_X(not name.isEmpty(), Q_FUNC_INFO, "name draw is empty"); const QDomNodeList elements = this->documentElement().elementsByTagName( TagDraw ); if (elements.size() == 0) { @@ -260,7 +260,7 @@ bool VAbstractPattern::CheckExistNamePP(const QString &name) const */ bool VAbstractPattern::GetActivNodeElement(const QString &name, QDomElement &element) const { - Q_ASSERT_X(name.isEmpty() == false, "GetActivNodeElement", "name draw is empty"); + Q_ASSERT_X(not name.isEmpty(), Q_FUNC_INFO, "name draw is empty"); QDomElement drawElement; if (GetActivDrawElement(drawElement)) { @@ -328,8 +328,8 @@ QDomElement VAbstractPattern::GetPPElement(const QString &name) */ bool VAbstractPattern::ChangeNamePP(const QString &oldName, const QString &newName) { - Q_ASSERT_X(newName.isEmpty() == false, "SetNamePP", "new name pattern piece is empty"); - Q_ASSERT_X(oldName.isEmpty() == false, "SetNamePP", "old name pattern piece is empty"); + Q_ASSERT_X(not newName.isEmpty(), Q_FUNC_INFO, "new name pattern piece is empty"); + Q_ASSERT_X(not oldName.isEmpty(), Q_FUNC_INFO, "old name pattern piece is empty"); if (CheckExistNamePP(oldName) == false) { @@ -373,7 +373,7 @@ bool VAbstractPattern::ChangeNamePP(const QString &oldName, const QString &newNa */ bool VAbstractPattern::appendPP(const QString &name) { - Q_ASSERT_X(name.isEmpty() == false, "appendPP", "name pattern piece is empty"); + Q_ASSERT_X(not name.isEmpty(), Q_FUNC_INFO, "name pattern piece is empty"); if (name.isEmpty()) { return false; @@ -422,7 +422,7 @@ VDataTool *VAbstractPattern::getTool(const quint32 &id) */ void VAbstractPattern::AddTool(const quint32 &id, VDataTool *tool) { - Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0"); + Q_ASSERT_X(id != 0, Q_FUNC_INFO, "id == 0"); SCASSERT(tool != nullptr); tools.insert(id, tool); } @@ -913,7 +913,7 @@ void VAbstractPattern::ToolExists(const quint32 &id) const */ void VAbstractPattern::SetActivPP(const QString &name) { - Q_ASSERT_X(name.isEmpty() == false, "SetActivPP", "name pattern piece is empty"); + Q_ASSERT_X(not name.isEmpty(), Q_FUNC_INFO, "name pattern piece is empty"); this->nameActivPP = name; emit ChangedActivPP(name); } diff --git a/src/libs/ifc/xml/vdomdocument.cpp b/src/libs/ifc/xml/vdomdocument.cpp index c2a1c0ae1..dce3be75f 100644 --- a/src/libs/ifc/xml/vdomdocument.cpp +++ b/src/libs/ifc/xml/vdomdocument.cpp @@ -203,8 +203,8 @@ bool VDomDocument::find(const QDomElement &node, const QString& id) */ quint32 VDomDocument::GetParametrUInt(const QDomElement &domElement, const QString &name, const QString &defValue) const { - Q_ASSERT_X(name.isEmpty() == false, Q_FUNC_INFO, "name of parametr is empty"); - Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); + Q_ASSERT_X(not name.isEmpty(), Q_FUNC_INFO, "name of parametr is empty"); + Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); //-V591 bool ok = false; QString parametr; @@ -233,8 +233,8 @@ quint32 VDomDocument::GetParametrUInt(const QDomElement &domElement, const QStri //--------------------------------------------------------------------------------------------------------------------- bool VDomDocument::GetParametrBool(const QDomElement &domElement, const QString &name, const QString &defValue) const { - Q_ASSERT_X(name.isEmpty() == false, Q_FUNC_INFO, "name of parametr is empty"); - Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); + Q_ASSERT_X(not name.isEmpty(), Q_FUNC_INFO, "name of parametr is empty"); + Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); QString parametr; bool val = true; @@ -279,8 +279,8 @@ bool VDomDocument::GetParametrBool(const QDomElement &domElement, const QString QString VDomDocument::GetParametrString(const QDomElement &domElement, const QString &name, const QString &defValue) const { - Q_ASSERT_X(name.isEmpty() == false, Q_FUNC_INFO, "name of parametr is empty"); - Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); + Q_ASSERT_X(not name.isEmpty(), Q_FUNC_INFO, "name of parametr is empty"); + Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); const QString parameter = domElement.attribute(name, defValue); if (parameter.isEmpty()) { @@ -305,8 +305,8 @@ QString VDomDocument::GetParametrString(const QDomElement &domElement, const QSt */ qreal VDomDocument::GetParametrDouble(const QDomElement &domElement, const QString &name, const QString &defValue) const { - Q_ASSERT_X(name.isEmpty() == false, Q_FUNC_INFO, "name of parametr is empty"); - Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); + Q_ASSERT_X(not name.isEmpty(), Q_FUNC_INFO, "name of parametr is empty"); + Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); bool ok = false; qreal param = 0; @@ -338,7 +338,7 @@ qreal VDomDocument::GetParametrDouble(const QDomElement &domElement, const QStri */ quint32 VDomDocument::GetParametrId(const QDomElement &domElement) const { - Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); + Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); quint32 id = 0; diff --git a/src/libs/qmuparser/qmuparserbase.cpp b/src/libs/qmuparser/qmuparserbase.cpp index cd8592993..590bf3c6e 100644 --- a/src/libs/qmuparser/qmuparserbase.cpp +++ b/src/libs/qmuparser/qmuparserbase.cpp @@ -841,13 +841,13 @@ void QmuParserBase::ApplyIfElse(QStack &a_stOpt, QStack while (a_stOpt.size() && a_stOpt.top().GetCode()==cmELSE) { token_type opElse = a_stOpt.pop(); - Q_ASSERT(a_stOpt.size()>0); + Q_ASSERT(a_stOpt.size()>0); //-V654 // Take the value associated with the else branch from the value stack token_type vVal2 = a_stVal.pop(); - Q_ASSERT(a_stOpt.size()>0); - Q_ASSERT(a_stVal.size()>=2); + Q_ASSERT(a_stOpt.size()>0); //-V654 + Q_ASSERT(a_stVal.size()>=2); //-V654 // it then else is a ternary operator Pop all three values from the value s // tack and just return the right value @@ -857,8 +857,8 @@ void QmuParserBase::ApplyIfElse(QStack &a_stOpt, QStack a_stVal.push( (qFuzzyCompare(vExpr.GetVal()+1, 1+0)==false) ? vVal1 : vVal2); token_type opIf = a_stOpt.pop(); - Q_ASSERT(opElse.GetCode()==cmELSE); - Q_ASSERT(opIf.GetCode()==cmIF); + Q_ASSERT(opElse.GetCode()==cmELSE); //-V654 + Q_ASSERT(opIf.GetCode()==cmIF); //-V654 m_vRPN.AddIfElse(cmENDIF); } // while pending if-else-clause found @@ -877,7 +877,7 @@ void QmuParserBase::ApplyBinOprt(QStack &a_stOpt, QStack } else { - Q_ASSERT(a_stVal.size()>=2); + Q_ASSERT(a_stVal.size()>=2); //-V654 token_type valTok1 = a_stVal.pop(), valTok2 = a_stVal.pop(), optTok = a_stOpt.pop(), @@ -913,14 +913,12 @@ void QmuParserBase::ApplyBinOprt(QStack &a_stOpt, QStack */ void QmuParserBase::ApplyRemainingOprt(QStack &stOpt, QStack &stVal) const { - while (stOpt.size() && stOpt.top().GetCode() != cmBO && stOpt.top().GetCode() != cmIF) + const ECmdCode code = stOpt.top().GetCode(); + while (stOpt.size() && code != cmBO && code != cmIF) { - token_type tok = stOpt.top(); - const ECmdCode code = tok.GetCode(); - if ((code >= cmLE && code <= cmASSIGN) || code == cmOPRT_INFIX || code == cmOPRT_BIN) { - if (stOpt.top().GetCode()==cmOPRT_INFIX) + if (code==cmOPRT_INFIX) { ApplyFunc(stOpt, stVal, 1); } @@ -1177,7 +1175,7 @@ qreal QmuParserBase::ParseCmdCodeBulk(int nOffset, int nThreadID) const // The index of the string argument in the string table int iIdxStack = pTok->Fun.idx; - Q_ASSERT( iIdxStack>=0 && iIdxStack=0 && iIdxStackFun.argc) // switch according to argument count { @@ -1332,21 +1330,30 @@ void QmuParserBase::CreateRPN() const // Next three are different kind of value entries // case cmSTRING: + { opt.SetIdx(m_vStringBuf.size()); // Assign buffer index to token stVal.push(opt); - m_vStringBuf.push_back(opt.GetAsString()); // Store string in internal buffer - m_Tokens.insert(m_pTokenReader->GetPos()-opt.GetAsString().length(), opt.GetAsString()); + const QString &str = opt.GetAsString(); + m_vStringBuf.push_back(str); // Store string in internal buffer + m_Tokens.insert(m_pTokenReader->GetPos()-str.length(), str); break; + } case cmVAR: + { stVal.push(opt); m_vRPN.AddVar( static_cast(opt.GetVar()) ); - m_Tokens.insert(m_pTokenReader->GetPos()-opt.GetAsString().length(), opt.GetAsString()); + const QString &str = opt.GetAsString(); + m_Tokens.insert(m_pTokenReader->GetPos()-str.length(), str); break; + } case cmVAL: + { stVal.push(opt); m_vRPN.AddVal( opt.GetVal() ); - m_Numbers.insert(m_pTokenReader->GetPos()-opt.GetAsString().length(), opt.GetAsString()); + const QString &str = opt.GetAsString(); + m_Numbers.insert(m_pTokenReader->GetPos()-str.length(), str); break; + } case cmELSE: m_nIfElseCounter--; if (m_nIfElseCounter<0) @@ -1388,7 +1395,8 @@ void QmuParserBase::CreateRPN() const ApplyRemainingOprt(stOpt, stVal); // Check if the bracket content has been evaluated completely - if (stOpt.size() && stOpt.top().GetCode()==cmBO) + token_type &topToken = stOpt.top(); + if (stOpt.size() && topToken.GetCode()==cmBO) { // if opt is ")" and opta is "(" the bracket has been evaluated, now its time to check // if there is either a function or a sign pending @@ -1401,17 +1409,17 @@ void QmuParserBase::CreateRPN() const stOpt.pop(); // Take opening bracket from stack - if (iArgCount>1 && ( stOpt.size()==0 || (stOpt.top().GetCode()!=cmFUNC && - stOpt.top().GetCode()!=cmFUNC_BULK && - stOpt.top().GetCode()!=cmFUNC_STR) ) ) + if (iArgCount>1 && ( stOpt.size()==0 || (topToken.GetCode()!=cmFUNC && + topToken.GetCode()!=cmFUNC_BULK && + topToken.GetCode()!=cmFUNC_STR) ) ) { Error(ecUNEXPECTED_ARG, m_pTokenReader->GetPos()); } // The opening bracket was popped from the stack now check if there // was a function before this bracket - if (stOpt.size() && stOpt.top().GetCode()!=cmOPRT_INFIX && stOpt.top().GetCode()!=cmOPRT_BIN && - stOpt.top().GetFuncAddr()!=0) + if (stOpt.size() && topToken.GetCode()!=cmOPRT_INFIX && topToken.GetCode()!=cmOPRT_BIN && + topToken.GetFuncAddr()!=0) { ApplyFunc(stOpt, stVal, iArgCount); } @@ -1445,14 +1453,16 @@ void QmuParserBase::CreateRPN() const case cmLOR: case cmASSIGN: case cmOPRT_BIN: + { + const token_type &topToken = stOpt.top(); // A binary operator (user defined or built in) has been found. - while ( stOpt.size() && stOpt.top().GetCode() != cmBO && stOpt.top().GetCode() != cmELSE && - stOpt.top().GetCode() != cmIF) + while ( stOpt.size() && topToken.GetCode() != cmBO && topToken.GetCode() != cmELSE && + topToken.GetCode() != cmIF) { - int nPrec1 = GetOprtPrecedence(stOpt.top()), + int nPrec1 = GetOprtPrecedence(topToken), nPrec2 = GetOprtPrecedence(opt); - if (stOpt.top().GetCode()==opt.GetCode()) + if (topToken.GetCode()==opt.GetCode()) { // Deal with operator associativity EOprtAssociativity eOprtAsct = GetOprtAssociativity(opt); @@ -1467,7 +1477,7 @@ void QmuParserBase::CreateRPN() const // In case the operators are not equal the precedence decides alone... break; } - if (stOpt.top().GetCode()==cmOPRT_INFIX) + if (topToken.GetCode()==cmOPRT_INFIX) { ApplyFunc(stOpt, stVal, 1); } @@ -1485,6 +1495,7 @@ void QmuParserBase::CreateRPN() const // The operator can't be evaluated right now, push back to the operator stack stOpt.push(opt); break; + } // // Last section contains functions and operators implicitely mapped to functions // @@ -1541,7 +1552,7 @@ void QmuParserBase::CreateRPN() const } // get the last value (= final result) from the stack - Q_ASSERT(stArgCount.size()==1); + Q_ASSERT(stArgCount.size()==1); //-V654 m_nFinalResultIdx = stArgCount.top(); if (m_nFinalResultIdx==0) { @@ -1788,13 +1799,14 @@ void QmuParserBase::StackDump(const QStack &a_stVal, const QStack &a_stVal, const QStack &a_stVal, const QStack=2 && m_vRPN[sz-2].Cmd == cmVAL && m_vRPN[sz-1].Cmd == cmVAL) + if (sz>=2 && m_vRPN.at(sz-2).Cmd == cmVAL && m_vRPN.at(sz-1).Cmd == cmVAL) { ConstantFolding(a_Oprt); bOptimized = true; @@ -243,17 +243,17 @@ void QmuParserByteCode::AddOp(ECmdCode a_Oprt) { case cmPOW: // Optimization for ploynomials of low order - if (m_vRPN[sz-2].Cmd == cmVAR && m_vRPN[sz-1].Cmd == cmVAL) + if (m_vRPN.at(sz-2).Cmd == cmVAR && m_vRPN.at(sz-1).Cmd == cmVAL) //-V807 { - if (qFuzzyCompare(m_vRPN[sz-1].Val.data2, 2)) + if (qFuzzyCompare(m_vRPN.at(sz-1).Val.data2, 2)) //-V807 { m_vRPN[sz-2].Cmd = cmVARPOW2; } - else if (qFuzzyCompare(m_vRPN[sz-1].Val.data2, 3)) + else if (qFuzzyCompare(m_vRPN.at(sz-1).Val.data2, 3)) { m_vRPN[sz-2].Cmd = cmVARPOW3; } - else if (qFuzzyCompare(m_vRPN[sz-1].Val.data2, 4)) + else if (qFuzzyCompare(m_vRPN.at(sz-1).Val.data2, 4)) { m_vRPN[sz-2].Cmd = cmVARPOW4; } @@ -270,69 +270,69 @@ void QmuParserByteCode::AddOp(ECmdCode a_Oprt) case cmADD: // Simple optimization based on pattern recognition for a shitload of different // bytecode combinations of addition/subtraction - if ( (m_vRPN[sz-1].Cmd == cmVAR && m_vRPN[sz-2].Cmd == cmVAL) || - (m_vRPN[sz-1].Cmd == cmVAL && m_vRPN[sz-2].Cmd == cmVAR) || - (m_vRPN[sz-1].Cmd == cmVAL && m_vRPN[sz-2].Cmd == cmVARMUL) || - (m_vRPN[sz-1].Cmd == cmVARMUL && m_vRPN[sz-2].Cmd == cmVAL) || - (m_vRPN[sz-1].Cmd == cmVAR && m_vRPN[sz-2].Cmd == cmVAR && - m_vRPN[sz-2].Val.ptr == m_vRPN[sz-1].Val.ptr) || - (m_vRPN[sz-1].Cmd == cmVAR && m_vRPN[sz-2].Cmd == cmVARMUL - && m_vRPN[sz-2].Val.ptr == m_vRPN[sz-1].Val.ptr) || - (m_vRPN[sz-1].Cmd == cmVARMUL && m_vRPN[sz-2].Cmd == cmVAR && - m_vRPN[sz-2].Val.ptr == m_vRPN[sz-1].Val.ptr) || - (m_vRPN[sz-1].Cmd == cmVARMUL && m_vRPN[sz-2].Cmd == cmVARMUL && - m_vRPN[sz-2].Val.ptr == m_vRPN[sz-1].Val.ptr) ) + if ( (m_vRPN.at(sz-1).Cmd == cmVAR && m_vRPN.at(sz-2).Cmd == cmVAL) || + (m_vRPN.at(sz-1).Cmd == cmVAL && m_vRPN.at(sz-2).Cmd == cmVAR) || + (m_vRPN.at(sz-1).Cmd == cmVAL && m_vRPN.at(sz-2).Cmd == cmVARMUL) || + (m_vRPN.at(sz-1).Cmd == cmVARMUL && m_vRPN.at(sz-2).Cmd == cmVAL) || + (m_vRPN.at(sz-1).Cmd == cmVAR && m_vRPN.at(sz-2).Cmd == cmVAR && + m_vRPN.at(sz-2).Val.ptr == m_vRPN.at(sz-1).Val.ptr) || //-V807 + (m_vRPN.at(sz-1).Cmd == cmVAR && m_vRPN.at(sz-2).Cmd == cmVARMUL + && m_vRPN.at(sz-2).Val.ptr == m_vRPN.at(sz-1).Val.ptr) || + (m_vRPN.at(sz-1).Cmd == cmVARMUL && m_vRPN.at(sz-2).Cmd == cmVAR && + m_vRPN.at(sz-2).Val.ptr == m_vRPN.at(sz-1).Val.ptr) || + (m_vRPN.at(sz-1).Cmd == cmVARMUL && m_vRPN.at(sz-2).Cmd == cmVARMUL && + m_vRPN.at(sz-2).Val.ptr == m_vRPN.at(sz-1).Val.ptr) ) { - assert( (m_vRPN[sz-2].Val.ptr==nullptr && m_vRPN[sz-1].Val.ptr!=nullptr) || - (m_vRPN[sz-2].Val.ptr!=nullptr && m_vRPN[sz-1].Val.ptr==nullptr) || - (m_vRPN[sz-2].Val.ptr == m_vRPN[sz-1].Val.ptr) ); + assert( (m_vRPN.at(sz-2).Val.ptr==nullptr && m_vRPN.at(sz-1).Val.ptr!=nullptr) || + (m_vRPN.at(sz-2).Val.ptr!=nullptr && m_vRPN.at(sz-1).Val.ptr==nullptr) || + (m_vRPN.at(sz-2).Val.ptr == m_vRPN.at(sz-1).Val.ptr) ); m_vRPN[sz-2].Cmd = cmVARMUL; - m_vRPN[sz-2].Val.ptr = reinterpret_cast( - reinterpret_cast(m_vRPN[sz-2].Val.ptr) | - reinterpret_cast(m_vRPN[sz-1].Val.ptr)); // variable - m_vRPN[sz-2].Val.data2 += ((a_Oprt==cmSUB) ? -1 : 1) * m_vRPN[sz-1].Val.data2; // offset - m_vRPN[sz-2].Val.data += ((a_Oprt==cmSUB) ? -1 : 1) * m_vRPN[sz-1].Val.data; // multiplikatior + m_vRPN[sz-2].Val.ptr = reinterpret_cast( //-V807 + reinterpret_cast(m_vRPN.at(sz-2).Val.ptr) | + reinterpret_cast(m_vRPN.at(sz-1).Val.ptr)); // variable + m_vRPN[sz-2].Val.data2 += ((a_Oprt==cmSUB) ? -1 : 1) * m_vRPN.at(sz-1).Val.data2; // offset + m_vRPN[sz-2].Val.data += ((a_Oprt==cmSUB) ? -1 : 1) * m_vRPN.at(sz-1).Val.data; // multiplikatior m_vRPN.pop_back(); bOptimized = true; } break; case cmMUL: - if ( (m_vRPN[sz-1].Cmd == cmVAR && m_vRPN[sz-2].Cmd == cmVAL) || - (m_vRPN[sz-1].Cmd == cmVAL && m_vRPN[sz-2].Cmd == cmVAR) ) + if ( (m_vRPN.at(sz-1).Cmd == cmVAR && m_vRPN.at(sz-2).Cmd == cmVAL) || + (m_vRPN.at(sz-1).Cmd == cmVAL && m_vRPN.at(sz-2).Cmd == cmVAR) ) { m_vRPN[sz-2].Cmd = cmVARMUL; m_vRPN[sz-2].Val.ptr = reinterpret_cast( - reinterpret_cast(m_vRPN[sz-2].Val.ptr) | - reinterpret_cast(m_vRPN[sz-1].Val.ptr)); - m_vRPN[sz-2].Val.data = m_vRPN[sz-2].Val.data2 + m_vRPN[sz-1].Val.data2; + reinterpret_cast(m_vRPN.at(sz-2).Val.ptr) | + reinterpret_cast(m_vRPN.at(sz-1).Val.ptr)); + m_vRPN[sz-2].Val.data = m_vRPN.at(sz-2).Val.data2 + m_vRPN.at(sz-1).Val.data2; m_vRPN[sz-2].Val.data2 = 0; m_vRPN.pop_back(); bOptimized = true; } - else if ( (m_vRPN[sz-1].Cmd == cmVAL && m_vRPN[sz-2].Cmd == cmVARMUL) || - (m_vRPN[sz-1].Cmd == cmVARMUL && m_vRPN[sz-2].Cmd == cmVAL) ) + else if ( (m_vRPN.at(sz-1).Cmd == cmVAL && m_vRPN.at(sz-2).Cmd == cmVARMUL) || + (m_vRPN.at(sz-1).Cmd == cmVARMUL && m_vRPN.at(sz-2).Cmd == cmVAL) ) { // Optimization: 2*(3*b+1) or (3*b+1)*2 -> 6*b+2 m_vRPN[sz-2].Cmd = cmVARMUL; m_vRPN[sz-2].Val.ptr = reinterpret_cast( - reinterpret_cast(m_vRPN[sz-2].Val.ptr) | - reinterpret_cast(m_vRPN[sz-1].Val.ptr)); - if (m_vRPN[sz-1].Cmd == cmVAL) + reinterpret_cast(m_vRPN.at(sz-2).Val.ptr) | + reinterpret_cast(m_vRPN.at(sz-1).Val.ptr)); + if (m_vRPN.at(sz-1).Cmd == cmVAL) { - m_vRPN[sz-2].Val.data *= m_vRPN[sz-1].Val.data2; - m_vRPN[sz-2].Val.data2 *= m_vRPN[sz-1].Val.data2; + m_vRPN[sz-2].Val.data *= m_vRPN.at(sz-1).Val.data2; + m_vRPN[sz-2].Val.data2 *= m_vRPN.at(sz-1).Val.data2; } else { - m_vRPN[sz-2].Val.data = m_vRPN[sz-1].Val.data * m_vRPN[sz-2].Val.data2; - m_vRPN[sz-2].Val.data2 = m_vRPN[sz-1].Val.data2 * m_vRPN[sz-2].Val.data2; + m_vRPN[sz-2].Val.data = m_vRPN.at(sz-1).Val.data * m_vRPN.at(sz-2).Val.data2; + m_vRPN[sz-2].Val.data2 = m_vRPN.at(sz-1).Val.data2 * m_vRPN.at(sz-2).Val.data2; } m_vRPN.pop_back(); bOptimized = true; } - else if (m_vRPN[sz-1].Cmd == cmVAR && m_vRPN[sz-2].Cmd == cmVAR && - m_vRPN[sz-1].Val.ptr == m_vRPN[sz-2].Val.ptr) + else if (m_vRPN.at(sz-1).Cmd == cmVAR && m_vRPN.at(sz-2).Cmd == cmVAR && + m_vRPN.at(sz-1).Val.ptr == m_vRPN.at(sz-2).Val.ptr) { // Optimization: a*a -> a^2 m_vRPN[sz-2].Cmd = cmVARPOW2; @@ -341,12 +341,12 @@ void QmuParserByteCode::AddOp(ECmdCode a_Oprt) } break; case cmDIV: - if (m_vRPN[sz-1].Cmd == cmVAL && m_vRPN[sz-2].Cmd == cmVARMUL && - (qFuzzyCompare(m_vRPN[sz-1].Val.data2+1, 1+0)==false)) + if (m_vRPN.at(sz-1).Cmd == cmVAL && m_vRPN.at(sz-2).Cmd == cmVARMUL && + (qFuzzyCompare(m_vRPN.at(sz-1).Val.data2+1, 1+0)==false)) { // Optimization: 4*a/2 -> 2*a - m_vRPN[sz-2].Val.data /= m_vRPN[sz-1].Val.data2; - m_vRPN[sz-2].Val.data2 /= m_vRPN[sz-1].Val.data2; + m_vRPN[sz-2].Val.data /= m_vRPN.at(sz-1).Val.data2; + m_vRPN[sz-2].Val.data2 /= m_vRPN.at(sz-1).Val.data2; m_vRPN.pop_back(); bOptimized = true; } @@ -550,37 +550,37 @@ void QmuParserByteCode::AsciiDump() } qDebug() << "Number of RPN tokens:" << m_vRPN.size() << "\n"; - for (int i=0; i(FAIL); \ + } \ iStat += iErr; // constant names @@ -1209,7 +1209,7 @@ int QmuParserTester::EqnTestWithVarChange ( const QString &a_str, double a_fVar1 fVal[0] = p.Eval(); // cppcheck-suppress redundantAssignment - var = a_fVar2; + var = a_fVar2; //-V519 fVal[1] = p.Eval(); if ( fabs ( a_fRes1 - fVal[0] ) > 0.0000000001 ) diff --git a/src/libs/vdxf/dxflib/dl_dxf.cpp b/src/libs/vdxf/dxflib/dl_dxf.cpp index 4840aaaf3..8ec088a0b 100644 --- a/src/libs/vdxf/dxflib/dl_dxf.cpp +++ b/src/libs/vdxf/dxflib/dl_dxf.cpp @@ -81,30 +81,12 @@ DL_Dxf::DL_Dxf() */ DL_Dxf::~DL_Dxf() { - if (vertices!=nullptr) - { - delete[] vertices; - } - if (knots!=nullptr) - { - delete[] knots; - } - if (controlPoints!=nullptr) - { - delete[] controlPoints; - } - if (fitPoints!=nullptr) - { - delete[] fitPoints; - } - if (weights!=nullptr) - { - delete[] weights; - } - if (leaderVertices!=nullptr) - { - delete[] leaderVertices; - } + delete[] vertices; + delete[] knots; + delete[] controlPoints; + delete[] fitPoints; + delete[] weights; + delete[] leaderVertices; } @@ -270,7 +252,7 @@ bool DL_Dxf::getStrippedLine(std::string& s, quint32 size, FILE *fp) } else { - s = ""; + s.clear(); return false; } } @@ -341,7 +323,7 @@ bool DL_Dxf::stripWhiteSpace(char** s) ++(*s); } - return ((*s) ? true : false); + return true; } @@ -616,7 +598,7 @@ bool DL_Dxf::processDXFGroup(DL_CreationInterface* creationInterface, // } values.clear(); settingValue[0] = '\0'; - settingKey = ""; + settingKey.clear(); firstHatchLoop = true; //firstHatchEdge = true; hatchEdge = DL_HatchEdgeData(); @@ -1618,10 +1600,7 @@ bool DL_Dxf::handleLWPolylineData(DL_CreationInterface* /*creationInterface*/) maxVertices = toInt(groupValue); if (maxVertices>0) { - if (vertices!=nullptr) - { - delete[] vertices; - } + delete[] vertices; vertices = new double[4*maxVertices]; for (int i=0; i0) { - if (knots!=nullptr) - { - delete[] knots; - } + delete[] knots; knots = new double[maxKnots]; for (int i=0; i0) { - if (controlPoints!=nullptr) - { - delete[] controlPoints; - } - if (weights!=nullptr) - { - delete[] weights; - } + delete[] controlPoints; + delete[] weights; controlPoints = new double[3*maxControlPoints]; weights = new double[maxControlPoints]; for (int i=0; i0) { - if (fitPoints!=nullptr) - { - delete[] fitPoints; - } + delete[] fitPoints; fitPoints = new double[3*maxFitPoints]; for (int i=0; i0) { - if (leaderVertices!=nullptr) - { - delete[] leaderVertices; - } + delete[] leaderVertices; leaderVertices = new double[3*maxLeaderVertices]; for (int i=0; i(dw.incHandle()); - dw.dxfHex(340, handle); + dw.dxfHex(340, handle); //-V525 // flags dw.dxfInt(70, 15); @@ -4084,10 +4048,10 @@ void DL_Dxf::writeImageDef(DL_WriterA& dw, dw.dxfString(0, "IMAGEDEF"); if (version==DL_VERSION_2000) { - dw.dxfHex(5, handle); + dw.dxfHex(5, handle); } - if (version==DL_VERSION_2000) + if (version==DL_VERSION_2000) //-V581 { dw.dxfString(100, "AcDbRasterImageDef"); dw.dxfInt(90, 0); @@ -4381,7 +4345,7 @@ void DL_Dxf::writeVPort(DL_WriterA& dw) const dw.dxfHex(5, 0x8); } //dw.dxfHex(330, 0); - if (version==DL_VERSION_2000) + if (version==DL_VERSION_2000) //-V581 { dw.dxfString(100, "AcDbSymbolTable"); } @@ -4393,7 +4357,7 @@ void DL_Dxf::writeVPort(DL_WriterA& dw) const dw.handle(); } //dw.dxfHex(330, 8); - if (version==DL_VERSION_2000) + if (version==DL_VERSION_2000) //-V581 { dw.dxfString(100, "AcDbSymbolTableRecord"); dw.dxfString(100, "AcDbViewportTableRecord"); @@ -4484,7 +4448,7 @@ void DL_Dxf::writeStyle(DL_WriterA& dw, const DL_StyleData& style) } } //dw.dxfHex(330, 3); - if (version==DL_VERSION_2000) + if (version==DL_VERSION_2000) //-V581 { dw.dxfString(100, "AcDbSymbolTableRecord"); dw.dxfString(100, "AcDbTextStyleTableRecord"); @@ -4538,7 +4502,7 @@ void DL_Dxf::writeView(DL_WriterA& dw) const dw.dxfHex(5, 6); } //dw.dxfHex(330, 0); - if (version==DL_VERSION_2000) + if (version==DL_VERSION_2000) //-V581 { dw.dxfString(100, "AcDbSymbolTable"); } @@ -4562,7 +4526,7 @@ void DL_Dxf::writeUcs(DL_WriterA& dw) const dw.dxfHex(5, 7); } //dw.dxfHex(330, 0); - if (version==DL_VERSION_2000) + if (version==DL_VERSION_2000) //-V581 { dw.dxfString(100, "AcDbSymbolTable"); } @@ -4604,7 +4568,7 @@ void DL_Dxf::writeDimStyle(DL_WriterA& dw, } //dw.handle(105); //dw.dxfHex(330, 0xA); - if (version==DL_VERSION_2000) + if (version==DL_VERSION_2000) //-V581 { dw.dxfString(100, "AcDbSymbolTableRecord"); dw.dxfString(100, "AcDbDimStyleTableRecord"); @@ -4706,7 +4670,7 @@ void DL_Dxf::writeBlockRecord(DL_WriterA& dw) const dw.dxfHex(5, 1); } //dw.dxfHex(330, 0); - if (version==DL_VERSION_2000) + if (version==DL_VERSION_2000) //-V581 { dw.dxfString(100, "AcDbSymbolTable"); } @@ -4720,7 +4684,7 @@ void DL_Dxf::writeBlockRecord(DL_WriterA& dw) const //int msh = dw.handle(); //dw.setModelSpaceHandle(msh); //dw.dxfHex(330, 1); - if (version==DL_VERSION_2000) + if (version==DL_VERSION_2000) //-V581 { dw.dxfString(100, "AcDbSymbolTableRecord"); dw.dxfString(100, "AcDbBlockTableRecord"); @@ -4736,7 +4700,7 @@ void DL_Dxf::writeBlockRecord(DL_WriterA& dw) const //int psh = dw.handle(); //dw.setPaperSpaceHandle(psh); //dw.dxfHex(330, 1); - if (version==DL_VERSION_2000) + if (version==DL_VERSION_2000) //-V581 { dw.dxfString(100, "AcDbSymbolTableRecord"); dw.dxfString(100, "AcDbBlockTableRecord"); @@ -4752,7 +4716,7 @@ void DL_Dxf::writeBlockRecord(DL_WriterA& dw) const //int ps0h = dw.handle(); //dw.setPaperSpace0Handle(ps0h); //dw.dxfHex(330, 1); - if (version==DL_VERSION_2000) + if (version==DL_VERSION_2000) //-V581 { dw.dxfString(100, "AcDbSymbolTableRecord"); dw.dxfString(100, "AcDbBlockTableRecord"); @@ -4776,7 +4740,7 @@ void DL_Dxf::writeBlockRecord(DL_WriterA& dw, const std::string& name) const dw.handle(); } //dw->dxfHex(330, 1); - if (version==DL_VERSION_2000) + if (version==DL_VERSION_2000) //-V581 { dw.dxfString(100, "AcDbSymbolTableRecord"); dw.dxfString(100, "AcDbBlockTableRecord"); @@ -5235,10 +5199,6 @@ bool DL_Dxf::checkVariable(const char* var, DL_Codes::version version) { return true; } - if (!strcmp(var, "$ACADVER")) - { - return true; - } if (!strcmp(var, "$ANGBASE")) { return true; diff --git a/src/libs/vdxf/dxflib/dl_writer.cpp b/src/libs/vdxf/dxflib/dl_writer.cpp index 68df5a23b..bf7199d1b 100644 --- a/src/libs/vdxf/dxflib/dl_writer.cpp +++ b/src/libs/vdxf/dxflib/dl_writer.cpp @@ -347,7 +347,7 @@ void DL_Writer::entityAttributes(const DL_Attributes &attrib) const { dxfInt(370, attrib.getWidth()); } - if (version>=DL_VERSION_2000) + if (version>=DL_VERSION_2000) //-V581 { dxfReal(48, attrib.getLinetypeScale()); } diff --git a/src/libs/vdxf/dxflib/dl_writer_ascii.cpp b/src/libs/vdxf/dxflib/dl_writer_ascii.cpp index 932ec9ac4..3d5647cea 100644 --- a/src/libs/vdxf/dxflib/dl_writer_ascii.cpp +++ b/src/libs/vdxf/dxflib/dl_writer_ascii.cpp @@ -72,7 +72,7 @@ void DL_WriterA::dxfReal(int gc, double value) const // Cut away those zeros at the end: bool dot = false; int end = -1; - for (quint32 i=0; iwriteText( *dw, DL_TextData(startPoint.x(), @@ -311,7 +312,7 @@ void VDxfEngine::drawTextItem(const QPointF & p, const QTextItem & textItem) 0, // Horizontal justification (0 = Left (default), 1 = Center, 2 = Right,) 0, // Vertical justification (0 = Baseline (default), 1 = Bottom, 2 = Middle, 3= Top) textItem.text().toUtf8().constData(), // text data - textItem.font().family().toUtf8().constData(), // font + f.family().toUtf8().constData(), // font -rotationAngle ), DL_Attributes("0", getPenColor(), state->pen().width(), getPenStyle(), 1.0)); @@ -341,7 +342,7 @@ QSize VDxfEngine::getSize() const //--------------------------------------------------------------------------------------------------------------------- void VDxfEngine::setSize(const QSize &value) { - Q_ASSERT(!isActive()); + Q_ASSERT(not isActive()); size = value; } @@ -354,7 +355,7 @@ int VDxfEngine::getResolution() const //--------------------------------------------------------------------------------------------------------------------- void VDxfEngine::setResolution(int value) { - Q_ASSERT(!isActive()); + Q_ASSERT(not isActive()); resolution = value; } @@ -367,7 +368,7 @@ QString VDxfEngine::getFileName() const //--------------------------------------------------------------------------------------------------------------------- void VDxfEngine::setFileName(const QString &value) { - Q_ASSERT(!isActive()); + Q_ASSERT(not isActive()); fileName = value; } @@ -471,13 +472,13 @@ int VDxfEngine::getPenColor() //--------------------------------------------------------------------------------------------------------------------- void VDxfEngine::setMeasurement(const VarMeasurement &var) { - Q_ASSERT(!isActive()); + Q_ASSERT(not isActive()); varMeasurement = var; } //--------------------------------------------------------------------------------------------------------------------- void VDxfEngine::setInsunits(const VarInsunits &var) { - Q_ASSERT(!isActive()); + Q_ASSERT(not isActive()); varInsunits = var; } diff --git a/src/libs/vgeometry/varc.cpp b/src/libs/vgeometry/varc.cpp index becc0ecf1..d98089d60 100644 --- a/src/libs/vgeometry/varc.cpp +++ b/src/libs/vgeometry/varc.cpp @@ -195,7 +195,7 @@ QVector VArc::GetPoints() const qreal i = 0; const qreal angle = AngleArc(); const qint32 k = static_cast(angle); - const qreal s = angle/(k/4); + const qreal s = angle/(k/4); //-V636 do { QPointF pStart; diff --git a/src/libs/vgeometry/vgobject.cpp b/src/libs/vgeometry/vgobject.cpp index 5f3c71653..69dd3574c 100644 --- a/src/libs/vgeometry/vgobject.cpp +++ b/src/libs/vgeometry/vgobject.cpp @@ -472,7 +472,7 @@ double VGObject::GetEpsilon(const QPointF &p1, const QPointF &p2) { const int dx1 = p2.toPoint().x() - p1.toPoint().x(); const int dy1 = p2.toPoint().y() - p1.toPoint().y(); - const double epsilon = 0.003 * (dx1 * dx1 + dy1 * dy1); + const double epsilon = 0.003 * (dx1 * dx1 + dy1 * dy1); //-V636 return epsilon; } diff --git a/src/libs/vgeometry/vspline_p.h b/src/libs/vgeometry/vspline_p.h index 4cdacc03c..a18ec6b4e 100644 --- a/src/libs/vgeometry/vspline_p.h +++ b/src/libs/vgeometry/vspline_p.h @@ -58,7 +58,7 @@ public: qreal L = 0, radius = 0, angle = 90; QPointF point1 = this->p1.toQPointF(); QPointF point4 = this->p4.toQPointF(); - radius = QLineF(point1, point4).length()/1.414213;//1.414213=sqrt(2); + radius = QLineF(point1, point4).length()/M_SQRT2; L = kCurve * radius * 4 / 3 * tan( angle * M_PI / 180.0 / 4 ); QLineF p1p2(this->p1.x(), this->p1.y(), this->p1.x() + L * kAsm1, this->p1.y()); p1p2.setAngle(angle1); @@ -77,7 +77,7 @@ public: qreal L = 0, radius = 0, angle = 90; QPointF point1 = this->p1.toQPointF(); QPointF point4 = this->p4.toQPointF(); - radius = QLineF(point1, point4).length()/1.414213;//1.414213=sqrt(2); + radius = QLineF(point1, point4).length()/M_SQRT2; L = kCurve * radius * 4 / 3 * tan( angle * M_PI / 180.0 / 4 ); this->kCurve = kCurve; diff --git a/src/libs/vgeometry/vsplinepath.cpp b/src/libs/vgeometry/vsplinepath.cpp index ab9322c8b..a4ea4a8ff 100644 --- a/src/libs/vgeometry/vsplinepath.cpp +++ b/src/libs/vgeometry/vsplinepath.cpp @@ -53,7 +53,7 @@ VSplinePath::~VSplinePath() //--------------------------------------------------------------------------------------------------------------------- void VSplinePath::append(const VSplinePoint &point) { - if (d->path.size() > 0 && d->path.last().P().toQPointF() == point.P().toQPointF()) + if (d->path.size() > 0 && d->path.last().P().toQPointF() == point.P().toQPointF()) //-V807 { return; } @@ -92,8 +92,9 @@ VSpline VSplinePath::GetSpline(qint32 index) const { throw VException(tr("This spline does not exist.")); } - VSpline spl(d->path.at(index-1).P(), d->path.at(index).P(), d->path.at(index-1).Angle2(), - d->path.at(index).Angle1(), d->path.at(index-1).KAsm2(), d->path.at(index).KAsm1(), d->kCurve); + const VSplinePoint &p1 = d->path.at(index-1); + const VSplinePoint &p2 = d->path.at(index); + VSpline spl(p1.P(), p2.P(), p1.Angle2(), p2.Angle1(), p1.KAsm2(), p2.KAsm1(), d->kCurve); return spl; } @@ -103,8 +104,9 @@ QPainterPath VSplinePath::GetPath(PathDirection direction) const QPainterPath painterPath; for (qint32 i = 1; i <= Count(); ++i) { - VSpline spl(d->path.at(i-1).P(), d->path.at(i).P(), d->path.at(i-1).Angle2(), d->path.at(i).Angle1(), - d->path.at(i-1).KAsm2(), d->path.at(i).KAsm1(), d->kCurve); + const VSplinePoint &p1 = d->path.at(i-1); + const VSplinePoint &p2 = d->path.at(i); + VSpline spl(p1.P(), p2.P(), p1.Angle2(), p2.Angle1(), p1.KAsm2(), p2.KAsm1(), d->kCurve); painterPath.addPath(spl.GetPath(direction)); } return painterPath; @@ -116,8 +118,9 @@ QVector VSplinePath::GetPoints() const QVector pathPoints; for (qint32 i = 1; i <= Count(); ++i) { - VSpline spl(d->path.at(i-1).P(), d->path.at(i).P(), d->path.at(i-1).Angle2(), d->path.at(i).Angle1(), - d->path.at(i-1).KAsm2(), d->path.at(i).KAsm1(), d->kCurve); + const VSplinePoint &p1 = d->path.at(i-1); + const VSplinePoint &p2 = d->path.at(i); + VSpline spl(p1.P(), p2.P(), p1.Angle2(), p2.Angle1(), p1.KAsm2(), p2.KAsm1(), d->kCurve); pathPoints += spl.GetPoints(); } return pathPoints; @@ -129,8 +132,10 @@ qreal VSplinePath::GetLength() const qreal length = 0; for (qint32 i = 1; i <= Count(); ++i) { - VSpline spl(d->path.at(i-1).P(), d->path.at(i).P(), d->path.at(i-1).Angle2(), d->path.at(i).Angle1(), - d->path.at(i-1).KAsm2(), d->path.at(i).KAsm1(), d->kCurve); + const VSplinePoint &p1 = d->path.at(i-1); + const VSplinePoint &p2 = d->path.at(i); + VSpline spl(p1.P(), p2.P(), p1.Angle2(), p2.Angle1(), + p1.KAsm2(), p2.KAsm1(), d->kCurve); length += spl.GetLength(); } return length; @@ -217,8 +222,10 @@ QPointF VSplinePath::CutSplinePath(qreal length, qint32 &p1, qint32 &p2, QPointF fullLength = 0; for (qint32 i = 1; i <= Count(); ++i) { - VSpline spl = VSpline(d->path.at(i-1).P(), d->path.at(i).P(), d->path.at(i-1).Angle2(), d->path.at(i).Angle1(), - d->path.at(i-1).KAsm2(), d->path.at(i).KAsm1(), d->kCurve); + const VSplinePoint &point1 = d->path.at(i-1); + const VSplinePoint &point2 = d->path.at(i); + VSpline spl = VSpline(point1.P(), point2.P(), point1.Angle2(), point2.Angle1(), point1.KAsm2(), + point2.KAsm1(), d->kCurve); fullLength += spl.GetLength(); if (fullLength > length) { @@ -236,8 +243,9 @@ int VSplinePath::Segment(const QPointF &p) const int index = -1; for (qint32 i = 1; i <= Count(); ++i) { - VSpline spl = VSpline(d->path.at(i-1).P(), d->path.at(i).P(), d->path.at(i-1).Angle2(), d->path.at(i).Angle1(), - d->path.at(i-1).KAsm2(), d->path.at(i).KAsm1(), d->kCurve); + const VSplinePoint &p1 = d->path.at(i-1); + const VSplinePoint &p2 = d->path.at(i); + VSpline spl = VSpline(p1.P(), p2.P(), p1.Angle2(), p2.Angle1(), p1.KAsm2(), p2.KAsm1(), d->kCurve); const qreal t = spl.ParamT(p); diff --git a/src/libs/vlayout/vcontour.cpp b/src/libs/vlayout/vcontour.cpp index 5aa02211c..9ed94520f 100644 --- a/src/libs/vlayout/vcontour.cpp +++ b/src/libs/vlayout/vcontour.cpp @@ -127,7 +127,7 @@ QSizeF VContour::GetSize() const QVector VContour::UniteWithContour(const VLayoutDetail &detail, int globalI, int detJ, BestFrom type) const { QVector newContour; - if (d->globalContour.isEmpty()) + if (d->globalContour.isEmpty()) //-V807 { AppendWhole(newContour, detail, detJ); } @@ -233,7 +233,7 @@ int VContour::EdgesCount() const //--------------------------------------------------------------------------------------------------------------------- QLineF VContour::GlobalEdge(int i) const { - if (d->globalContour.isEmpty()) + if (d->globalContour.isEmpty()) //-V807 { // Because sheet is blank we have one global edge for all cases - Ox axis. const QLineF axis = EmptySheetEdge(); diff --git a/src/libs/vlayout/vlayoutdetail.cpp b/src/libs/vlayout/vlayoutdetail.cpp index 12a83846f..077ae41bc 100644 --- a/src/libs/vlayout/vlayoutdetail.cpp +++ b/src/libs/vlayout/vlayoutdetail.cpp @@ -164,22 +164,23 @@ void VLayoutDetail::Mirror(const QLineF &edge) const QLineF axis = QLineF(edge.x2(), edge.y2(), edge.x2() + 100, edge.y2()); // Ox axis const qreal angle = edge.angleTo(axis); + const QPointF p2 = edge.p2(); QTransform m; - m.translate(edge.p2().x(), edge.p2().y()); + m.translate(p2.x(), p2.y()); m.rotate(-angle); - m.translate(-edge.p2().x(), -edge.p2().y()); + m.translate(-p2.x(), -p2.y()); d->matrix *= m; m.reset(); - m.translate(edge.p2().x(), edge.p2().y()); + m.translate(p2.x(), p2.y()); m.scale(m.m11(), m.m22()*-1); - m.translate(-edge.p2().x(), -edge.p2().y()); + m.translate(-p2.x(), -p2.y()); d->matrix *= m; m.reset(); - m.translate(edge.p2().x(), edge.p2().y()); + m.translate(p2.x(), p2.y()); m.rotate(-(360-angle)); - m.translate(-edge.p2().x(), -edge.p2().y()); + m.translate(-p2.x(), -p2.y()); d->matrix *= m; d->mirror = !d->mirror; @@ -214,8 +215,9 @@ QLineF VLayoutDetail::Edge(int i) const if (d->mirror) { const int oldI1 = i1; - i1 = (d->layoutAllowence.size()-1) - i2; - i2 = (d->layoutAllowence.size()-1) - oldI1; + const int size = d->layoutAllowence.size()-1; //-V807 + i1 = size - i2; + i2 = size - oldI1; return QLineF(d->matrix.map(d->layoutAllowence.at(i2)), d->matrix.map(d->layoutAllowence.at(i1))); } else @@ -280,7 +282,7 @@ bool VLayoutDetail::isNull() const //--------------------------------------------------------------------------------------------------------------------- qint64 VLayoutDetail::Square() const { - if (d->layoutAllowence.isEmpty()) + if (d->layoutAllowence.isEmpty()) //-V807 { return 0; } diff --git a/src/libs/vlayout/vlayoutpaper.cpp b/src/libs/vlayout/vlayoutpaper.cpp index 12d0d453f..1d7c417fe 100644 --- a/src/libs/vlayout/vlayoutpaper.cpp +++ b/src/libs/vlayout/vlayoutpaper.cpp @@ -288,7 +288,7 @@ QGraphicsRectItem *VLayoutPaper::GetPaperItem(bool autoCrop) const } const int height = scene->itemsBoundingRect().toRect().height() + static_cast(d->layoutWidth)*2; delete scene; - if (d->globalContour.GetHeight() > height) + if (d->globalContour.GetHeight() > height) //-V807 { paper = new QGraphicsRectItem(QRectF(0, 0, d->globalContour.GetWidth(), height)); } diff --git a/src/libs/vlayout/vposition.cpp b/src/libs/vlayout/vposition.cpp index 12ac7b6e2..a4b216b93 100644 --- a/src/libs/vlayout/vposition.cpp +++ b/src/libs/vlayout/vposition.cpp @@ -497,8 +497,8 @@ VPosition::InsideType VPosition::InsideContour(const VLayoutDetail &detail, cons for (int i=0; i= p.at(n).y()) || (yj < p.at(n).y() && yi >= p.at(n).y()))) + const QPointF &pn = p.at(n); + if (((yi < pn.y() && yj >= pn.y()) || (yj < pn.y() && yi >= pn.y()))) { - oddNodes ^= (p.at(n).y() * multiple.at(i) + constant.at(i) < p.at(n).x()); + oddNodes ^= (pn.y() * multiple.at(i) + constant.at(i) < pn.x()); } j=i; diff --git a/src/libs/vlayout/vposter.cpp b/src/libs/vlayout/vposter.cpp index 111bcc48d..6cb3510c0 100644 --- a/src/libs/vlayout/vposter.cpp +++ b/src/libs/vlayout/vposter.cpp @@ -109,7 +109,7 @@ int VPoster::CountRows(int height) const // Calculate how many pages will be after using allowence. // We know start pages count. This number not enought because // each n-1 pages add (n-1)*allowence length to page (1). - const qreal addionalLength = (pCount-1)*static_cast(allowence); + const qreal addionalLength = (pCount-1)*static_cast(allowence); //-V636 // Calculate additional length form pages that will cover this length (2). // In the end add page length (3). @@ -139,7 +139,7 @@ int VPoster::CountColomns(int width) const // Calculate how many pages will be after using allowence. // We know start pages count. This number not enought because // each n-1 pages add (n-1)*allowence length to page (1). - const qreal addionalLength = (pCount-1)*static_cast(allowence); + const qreal addionalLength = (pCount-1)*static_cast(allowence); //-V636 // Calculate additional length form pages that will cover this length (2). // In the end add page length (3). @@ -190,35 +190,36 @@ QImage VPoster::Borders(int rows, int colomns, int i, int j, QImage &image, int pen.setColor(Qt::black); painter.setPen(pen); + const QRect rec = image.rect(); if (j != 0 && PageRect().x() > 0) {// Left border - painter.drawLine(QLine(0, 0, 0, image.rect().height())); - painter.drawImage(QPoint(0, image.rect().height()-static_cast(allowence)), + painter.drawLine(QLine(0, 0, 0, rec.height())); + painter.drawImage(QPoint(0, rec.height()-static_cast(allowence)), QImage("://scissors_vertical.png")); } if (j != colomns-1) {// Right border - painter.drawLine(QLine(image.rect().width()-static_cast(allowence), 0, - image.rect().width()-static_cast(allowence), image.rect().height())); + painter.drawLine(QLine(rec.width()-static_cast(allowence), 0, + rec.width()-static_cast(allowence), rec.height())); } if (i != 0 && PageRect().y() > 0) {// Top border - painter.drawLine(QLine(0, 0, image.rect().width(), 0)); - painter.drawImage(QPoint(image.rect().width()-static_cast(allowence), 0), + painter.drawLine(QLine(0, 0, rec.width(), 0)); + painter.drawImage(QPoint(rec.width()-static_cast(allowence), 0), QImage("://scissors_horizontal.png")); } if (rows*colomns > 1) { // Don't show bottom border if only one page need // Bottom border (mandatory) - painter.drawLine(QLine(0, image.rect().height()-static_cast(allowence), - image.rect().width(), image.rect().height()-static_cast(allowence))); + painter.drawLine(QLine(0, rec.height()-static_cast(allowence), + rec.width(), rec.height()-static_cast(allowence))); if (i == rows-1) { - painter.drawImage(QPoint(image.rect().width()-static_cast(allowence), - image.rect().height()-static_cast(allowence)), + painter.drawImage(QPoint(rec.width()-static_cast(allowence), + rec.height()-static_cast(allowence)), QImage("://scissors_horizontal.png")); } } @@ -226,8 +227,8 @@ QImage VPoster::Borders(int rows, int colomns, int i, int j, QImage &image, int // Labels const int layoutX = 15; const int layoutY = 5; - QRect labels(layoutX, image.rect().height()-static_cast(allowence)+layoutY, - image.rect().width()-(static_cast(allowence)+layoutX), static_cast(allowence)-layoutY); + QRect labels(layoutX, rec.height()-static_cast(allowence)+layoutY, + rec.width()-(static_cast(allowence)+layoutX), static_cast(allowence)-layoutY); painter.drawText(labels, Qt::AlignLeft, tr("Grid ( %1 , %2 )").arg(i+1).arg(j+1)); painter.drawText(labels, Qt::AlignHCenter, tr("Page %1 of %2").arg(i*(colomns)+j+1).arg(rows*colomns)); if (sheets > 1) diff --git a/src/libs/vmisc/projectversion.cpp b/src/libs/vmisc/projectversion.cpp index aea71936b..ed47f880c 100644 --- a/src/libs/vmisc/projectversion.cpp +++ b/src/libs/vmisc/projectversion.cpp @@ -59,9 +59,8 @@ QString compilerString() { return QLatin1String("MSVC ") + QString::number(2008 + 2 * ((_MSC_VER / 100) - 15)); } -#else - return QLatin1String(""); #endif + return QLatin1String(""); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vobj/vobjengine.cpp b/src/libs/vobj/vobjengine.cpp index e4acb7379..3a84984b7 100644 --- a/src/libs/vobj/vobjengine.cpp +++ b/src/libs/vobj/vobjengine.cpp @@ -37,6 +37,10 @@ # include #endif +#ifdef Q_CC_MSVC + #include +#endif /* Q_CC_MSVC */ + //--------------------------------------------------------------------------------------------------------------------- static inline QPaintEngine::PaintEngineFeatures svgEngineFeatures() { @@ -278,7 +282,7 @@ QSize VObjEngine::getSize() const //--------------------------------------------------------------------------------------------------------------------- void VObjEngine::setSize(const QSize &value) { - Q_ASSERT(!isActive()); + Q_ASSERT(not isActive()); size = value; } @@ -291,7 +295,7 @@ QIODevice *VObjEngine::getOutputDevice() const //--------------------------------------------------------------------------------------------------------------------- void VObjEngine::setOutputDevice(QIODevice *value) { - Q_ASSERT(!isActive()); + Q_ASSERT(not isActive()); outputDevice.reset(value); } @@ -304,7 +308,7 @@ int VObjEngine::getResolution() const //--------------------------------------------------------------------------------------------------------------------- void VObjEngine::setResolution(int value) { - Q_ASSERT(!isActive()); + Q_ASSERT(not isActive()); resolution = value; } diff --git a/src/libs/vobj/vobjpaintdevice.cpp b/src/libs/vobj/vobjpaintdevice.cpp index c5a3cb915..1a0b62862 100644 --- a/src/libs/vobj/vobjpaintdevice.cpp +++ b/src/libs/vobj/vobjpaintdevice.cpp @@ -35,7 +35,7 @@ VObjPaintDevice::VObjPaintDevice() :QPaintDevice(), engine(new VObjEngine()), fileName(), owns_iodevice(1) { - owns_iodevice = false; + owns_iodevice = static_cast(false); } //--------------------------------------------------------------------------------------------------------------------- @@ -75,7 +75,7 @@ void VObjPaintDevice::setFileName(const QString &value) delete engine->getOutputDevice(); } - owns_iodevice = true; + owns_iodevice = static_cast(true); fileName = value; QFile *file = new QFile(fileName); @@ -113,7 +113,7 @@ void VObjPaintDevice::setOutputDevice(QIODevice *outputDevice) qWarning("VObjPaintDevice::setOutputDevice(), cannot set output device while OBJ is being generated"); return; } - owns_iodevice = false; + owns_iodevice = static_cast(false); engine->setOutputDevice(outputDevice); fileName = QString(); } diff --git a/src/libs/vpatterndb/vcontainer.cpp b/src/libs/vpatterndb/vcontainer.cpp index de50374e1..c626fe3b9 100644 --- a/src/libs/vpatterndb/vcontainer.cpp +++ b/src/libs/vpatterndb/vcontainer.cpp @@ -177,7 +177,7 @@ quint32 VContainer::AddGObject(VGObject *obj) * @param detail new detail * @return return id of new detail in container */ -quint32 VContainer::AddDetail(VDetail detail) +quint32 VContainer::AddDetail(const VDetail &detail) { quint32 id = getNextId(); d->details[id] = detail; @@ -224,7 +224,7 @@ void VContainer::UpdateId(quint32 newId) template void VContainer::UpdateObject(QHash &obj, const quint32 &id, val point) { - Q_ASSERT_X(id > NULL_ID, Q_FUNC_INFO, "id = 0"); + Q_ASSERT_X(id != NULL_ID, Q_FUNC_INFO, "id == 0"); //-V654 //-V712 SCASSERT(point.isNull() == false); point->setId(id); if (d->gObjects.contains(id)) @@ -276,7 +276,7 @@ void VContainer::ClearForFullParse() void VContainer::ClearGObjects() { QHash >::iterator i; - for (i = d->gObjects.begin(); i != d->gObjects.end(); ++i) + for (i = d->gObjects.begin(); i != d->gObjects.end(); ++i) //-V807 { i.value().clear(); } @@ -286,7 +286,7 @@ void VContainer::ClearGObjects() //--------------------------------------------------------------------------------------------------------------------- void VContainer::ClearCalculationGObjects() { - if (not d->gObjects.isEmpty()) + if (not d->gObjects.isEmpty()) //-V807 { QVector keys; QHash >::iterator i; @@ -312,7 +312,7 @@ void VContainer::ClearCalculationGObjects() //--------------------------------------------------------------------------------------------------------------------- void VContainer::ClearVariables(const VarType &type) { - if (d->variables.size()>0) + if (d->variables.size()>0) //-V807 { if (type == VarType::Unknown) { @@ -421,7 +421,7 @@ void VContainer::UpdateGObject(quint32 id, VGObject* obj) */ void VContainer::UpdateDetail(quint32 id, const VDetail &detail) { - Q_ASSERT_X(id > NULL_ID, Q_FUNC_INFO, "id = 0"); + Q_ASSERT_X(id != NULL_ID, Q_FUNC_INFO, "id == 0"); //-V654 //-V712 d->details[id] = detail; UpdateId(id); } diff --git a/src/libs/vpatterndb/vcontainer.h b/src/libs/vpatterndb/vcontainer.h index 21becd502..29cac76c4 100644 --- a/src/libs/vpatterndb/vcontainer.h +++ b/src/libs/vpatterndb/vcontainer.h @@ -49,7 +49,7 @@ #pragma GCC diagnostic ignored "-Weffc++" #endif -class VContainerData : public QSharedData +class VContainerData : public QSharedData //-V690 { public: @@ -117,7 +117,7 @@ public: static void UpdateId(quint32 newId); quint32 AddGObject(VGObject *obj); - quint32 AddDetail(VDetail detail); + quint32 AddDetail(const VDetail &detail); void AddLine(const quint32 &firstPointId, const quint32 &secondPointId); void AddArc(const quint32 &arcId, const quint32 &parentId = 0); diff --git a/src/libs/vpatterndb/vdetail.cpp b/src/libs/vpatterndb/vdetail.cpp index e5370d4ce..732c85593 100644 --- a/src/libs/vpatterndb/vdetail.cpp +++ b/src/libs/vpatterndb/vdetail.cpp @@ -329,7 +329,7 @@ VDetail VDetail::RemoveEdge(const quint32 &index) const */ QList VDetail::Missing(const VDetail &det) const { - if (d->nodes.size() == det.CountNode()) + if (d->nodes.size() == det.CountNode()) //-V807 { return QList(); } @@ -483,7 +483,7 @@ QPainterPath VDetail::ContourPath(const VContainer *data) const QVector VDetail::listNodePoint() const { QVector list; - for (int i = 0; i < d->nodes.size(); ++i) + for (int i = 0; i < d->nodes.size(); ++i) //-V807 { if (d->nodes.at(i).getTypeTool() == Tool::NodePoint) { diff --git a/src/libs/vpatterndb/vtranslatevars.cpp b/src/libs/vpatterndb/vtranslatevars.cpp index 923e3ee48..9f4a2d268 100644 --- a/src/libs/vpatterndb/vtranslatevars.cpp +++ b/src/libs/vpatterndb/vtranslatevars.cpp @@ -498,11 +498,12 @@ bool VTranslateVars::VariablesFromUser(QString &newFormula, int position, const QMap::const_iterator i = variables.constBegin(); while (i != variables.constEnd()) { - if (token.indexOf( i.value().translate() ) == 0) + const QmuTranslation &var = i.value(); + if (token.indexOf( var.translate() ) == 0) { - newFormula.replace(position, i.value().translate().length(), i.key()); + newFormula.replace(position, var.translate().length(), i.key()); QString newToken = token; - newToken.replace(0, i.value().translate().length(), i.key()); + newToken.replace(0, var.translate().length(), i.key()); bias = token.length() - newToken.length(); return true; } diff --git a/src/libs/vpropertyexplorer/plugins/Vector3d/vvector3dproperty.h b/src/libs/vpropertyexplorer/plugins/Vector3d/vvector3dproperty.h index c2ea067aa..0da181c86 100644 --- a/src/libs/vpropertyexplorer/plugins/Vector3d/vvector3dproperty.h +++ b/src/libs/vpropertyexplorer/plugins/Vector3d/vvector3dproperty.h @@ -27,7 +27,7 @@ namespace VPE { -struct VPROPERTYEXPLORERSHARED_EXPORT Vector3D +struct VPROPERTYEXPLORERSHARED_EXPORT Vector3D //-V690 { public: Vector3D() diff --git a/src/libs/vpropertyexplorer/vpropertyformview.cpp b/src/libs/vpropertyexplorer/vpropertyformview.cpp index c76ebcfe1..c87dd5bde 100644 --- a/src/libs/vpropertyexplorer/vpropertyformview.cpp +++ b/src/libs/vpropertyexplorer/vpropertyformview.cpp @@ -114,7 +114,7 @@ void VPropertyFormView::rowsRemoved(const QModelIndex &parent, int start, int en updatePropertyList(); } -void VPropertyFormView::rowsInserted(const QModelIndex &parent, int start, int end) +void VPropertyFormView::rowsInserted(const QModelIndex &parent, int start, int end) //-V524 { // todo: Only rebuild the neccessary parts Q_UNUSED(parent) diff --git a/src/libs/vtools/dialogs/support/dialogeditwrongformula.cpp b/src/libs/vtools/dialogs/support/dialogeditwrongformula.cpp index cebeb2a75..64be72df9 100644 --- a/src/libs/vtools/dialogs/support/dialogeditwrongformula.cpp +++ b/src/libs/vtools/dialogs/support/dialogeditwrongformula.cpp @@ -423,7 +423,7 @@ void DialogEditWrongFormula::SetDescription(const QString &name, qreal value, co * @param var container with variables */ template -void DialogEditWrongFormula::ShowVariable(const QMap var) +void DialogEditWrongFormula::ShowVariable(const QMap &var) { ui->listWidget->blockSignals(true); ui->listWidget->clear(); diff --git a/src/libs/vtools/dialogs/support/dialogeditwrongformula.h b/src/libs/vtools/dialogs/support/dialogeditwrongformula.h index 488d8d06a..4c670e63c 100644 --- a/src/libs/vtools/dialogs/support/dialogeditwrongformula.h +++ b/src/libs/vtools/dialogs/support/dialogeditwrongformula.h @@ -97,7 +97,7 @@ private: void InitVariables(); template - void ShowVariable(const QMap var); + void ShowVariable(const QMap &var); void SetDescription(const QString &name, qreal value, const QString &unit, const QString &description); }; diff --git a/src/libs/vtools/dialogs/tools/dialogdetail.cpp b/src/libs/vtools/dialogs/tools/dialogdetail.cpp index a2592508e..3de799e58 100644 --- a/src/libs/vtools/dialogs/tools/dialogdetail.cpp +++ b/src/libs/vtools/dialogs/tools/dialogdetail.cpp @@ -256,8 +256,9 @@ void DialogDetail::setDetail(const VDetail &value) ui.listWidget->clear(); for (int i = 0; i < detail.CountNode(); ++i) { - NewItem(detail.at(i).getId(), detail.at(i).getTypeTool(), detail.at(i).getTypeNode(), detail.at(i).getMx(), - detail.at(i).getMy(), detail.at(i).getReverse()); + const VNodeDetail &node = detail.at(i); + NewItem(node.getId(), node.getTypeTool(), node.getTypeNode(), node.getMx(), + node.getMy(), node.getReverse()); } ui.lineEditNameDetail->setText(detail.getName()); ui.checkBoxSeams->setChecked(detail.getSeamAllowance()); diff --git a/src/libs/vtools/dialogs/tools/dialogpointfromarcandtangent.cpp b/src/libs/vtools/dialogs/tools/dialogpointfromarcandtangent.cpp index b5f912bb1..5cfbc2340 100644 --- a/src/libs/vtools/dialogs/tools/dialogpointfromarcandtangent.cpp +++ b/src/libs/vtools/dialogs/tools/dialogpointfromarcandtangent.cpp @@ -111,7 +111,7 @@ CrossCirclesPoint DialogPointFromArcAndTangent::GetCrossCirclesPoint() const } //--------------------------------------------------------------------------------------------------------------------- -void DialogPointFromArcAndTangent::SetCrossCirclesPoint(CrossCirclesPoint &p) +void DialogPointFromArcAndTangent::SetCrossCirclesPoint(const CrossCirclesPoint &p) { const qint32 index = ui->comboBoxResult->findData(static_cast(p)); if (index != -1) diff --git a/src/libs/vtools/dialogs/tools/dialogpointfromarcandtangent.h b/src/libs/vtools/dialogs/tools/dialogpointfromarcandtangent.h index 67d141946..c62ba7bf6 100644 --- a/src/libs/vtools/dialogs/tools/dialogpointfromarcandtangent.h +++ b/src/libs/vtools/dialogs/tools/dialogpointfromarcandtangent.h @@ -54,7 +54,7 @@ public: void SetTangentPointId(const quint32 &value); CrossCirclesPoint GetCrossCirclesPoint() const; - void SetCrossCirclesPoint(CrossCirclesPoint &p); + void SetCrossCirclesPoint(const CrossCirclesPoint &p); public slots: virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE; diff --git a/src/libs/vtools/dialogs/tools/dialogpointfromcircleandtangent.cpp b/src/libs/vtools/dialogs/tools/dialogpointfromcircleandtangent.cpp index 78f43914f..563310ed8 100644 --- a/src/libs/vtools/dialogs/tools/dialogpointfromcircleandtangent.cpp +++ b/src/libs/vtools/dialogs/tools/dialogpointfromcircleandtangent.cpp @@ -161,7 +161,7 @@ CrossCirclesPoint DialogPointFromCircleAndTangent::GetCrossCirclesPoint() const } //--------------------------------------------------------------------------------------------------------------------- -void DialogPointFromCircleAndTangent::SetCrossCirclesPoint(CrossCirclesPoint &p) +void DialogPointFromCircleAndTangent::SetCrossCirclesPoint(const CrossCirclesPoint &p) { const qint32 index = ui->comboBoxResult->findData(static_cast(p)); if (index != -1) diff --git a/src/libs/vtools/dialogs/tools/dialogpointfromcircleandtangent.h b/src/libs/vtools/dialogs/tools/dialogpointfromcircleandtangent.h index 49169099b..0d96b463d 100644 --- a/src/libs/vtools/dialogs/tools/dialogpointfromcircleandtangent.h +++ b/src/libs/vtools/dialogs/tools/dialogpointfromcircleandtangent.h @@ -56,7 +56,7 @@ public: void SetTangentPointId(const quint32 &value); CrossCirclesPoint GetCrossCirclesPoint() const; - void SetCrossCirclesPoint(CrossCirclesPoint &p); + void SetCrossCirclesPoint(const CrossCirclesPoint &p); public slots: virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE; diff --git a/src/libs/vtools/dialogs/tools/dialogpointofintersectionarcs.cpp b/src/libs/vtools/dialogs/tools/dialogpointofintersectionarcs.cpp index faacacf58..77683239e 100644 --- a/src/libs/vtools/dialogs/tools/dialogpointofintersectionarcs.cpp +++ b/src/libs/vtools/dialogs/tools/dialogpointofintersectionarcs.cpp @@ -114,7 +114,7 @@ CrossCirclesPoint DialogPointOfIntersectionArcs::GetCrossArcPoint() const } //--------------------------------------------------------------------------------------------------------------------- -void DialogPointOfIntersectionArcs::SetCrossArcPoint(CrossCirclesPoint &p) +void DialogPointOfIntersectionArcs::SetCrossArcPoint(const CrossCirclesPoint &p) { const qint32 index = ui->comboBoxResult->findData(static_cast(p)); if (index != -1) diff --git a/src/libs/vtools/dialogs/tools/dialogpointofintersectionarcs.h b/src/libs/vtools/dialogs/tools/dialogpointofintersectionarcs.h index eb277c672..7e067e126 100644 --- a/src/libs/vtools/dialogs/tools/dialogpointofintersectionarcs.h +++ b/src/libs/vtools/dialogs/tools/dialogpointofintersectionarcs.h @@ -53,7 +53,7 @@ public: void SetSecondArcId(const quint32 &value); CrossCirclesPoint GetCrossArcPoint() const; - void SetCrossArcPoint(CrossCirclesPoint &p); + void SetCrossArcPoint(const CrossCirclesPoint &p); public slots: virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE; diff --git a/src/libs/vtools/dialogs/tools/dialogpointofintersectioncircles.cpp b/src/libs/vtools/dialogs/tools/dialogpointofintersectioncircles.cpp index fd62d9f5d..9a54b956b 100644 --- a/src/libs/vtools/dialogs/tools/dialogpointofintersectioncircles.cpp +++ b/src/libs/vtools/dialogs/tools/dialogpointofintersectioncircles.cpp @@ -202,7 +202,7 @@ CrossCirclesPoint DialogPointOfIntersectionCircles::GetCrossCirclesPoint() const } //--------------------------------------------------------------------------------------------------------------------- -void DialogPointOfIntersectionCircles::SetCrossCirclesPoint(CrossCirclesPoint &p) +void DialogPointOfIntersectionCircles::SetCrossCirclesPoint(const CrossCirclesPoint &p) { const qint32 index = ui->comboBoxResult->findData(static_cast(p)); if (index != -1) diff --git a/src/libs/vtools/dialogs/tools/dialogpointofintersectioncircles.h b/src/libs/vtools/dialogs/tools/dialogpointofintersectioncircles.h index 7b122b9a9..4a5b11772 100644 --- a/src/libs/vtools/dialogs/tools/dialogpointofintersectioncircles.h +++ b/src/libs/vtools/dialogs/tools/dialogpointofintersectioncircles.h @@ -59,7 +59,7 @@ public: void SetSecondCircleRadius(const QString &value); CrossCirclesPoint GetCrossCirclesPoint() const; - void SetCrossCirclesPoint(CrossCirclesPoint &p); + void SetCrossCirclesPoint(const CrossCirclesPoint &p); public slots: virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE; diff --git a/src/libs/vtools/dialogs/tools/dialogsplinepath.cpp b/src/libs/vtools/dialogs/tools/dialogsplinepath.cpp index 25362f9d2..f8f360ef9 100644 --- a/src/libs/vtools/dialogs/tools/dialogsplinepath.cpp +++ b/src/libs/vtools/dialogs/tools/dialogsplinepath.cpp @@ -84,7 +84,8 @@ void DialogSplinePath::SetPath(const VSplinePath &value) ui->listWidget->clear(); for (qint32 i = 0; i < path.CountPoint(); ++i) { - NewItem(path.at(i).P().id(), path.at(i).KAsm1(), path.at(i).Angle1(), path.at(i).KAsm2(), path.at(i).Angle2()); + const VSplinePoint &point = path.at(i); + NewItem(point.P().id(), point.KAsm1(), point.Angle1(), point.KAsm2(), point.Angle2()); } ui->listWidget->setFocus(Qt::OtherFocusReason); ui->doubleSpinBoxKcurve->setValue(path.GetKCurve()); diff --git a/src/libs/vtools/dialogs/tools/dialogtool.cpp b/src/libs/vtools/dialogs/tools/dialogtool.cpp index 206ec395e..6074269ef 100644 --- a/src/libs/vtools/dialogs/tools/dialogtool.cpp +++ b/src/libs/vtools/dialogs/tools/dialogtool.cpp @@ -684,7 +684,7 @@ void DialogTool::FormulaChanged() } } //--------------------------------------------------------------------------------------------------------------------- -void DialogTool::FormulaChangedPlainText() +void DialogTool::FormulaChangedPlainText() //-V524 { QPlainTextEdit* edit = qobject_cast(sender()); if (edit) diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolarc.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolarc.cpp index 9d6a0498c..f38e65e5c 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolarc.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolarc.cpp @@ -100,8 +100,8 @@ VToolArc* VToolArc::Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstr QString f1 = dialogTool->GetF1(); QString f2 = dialogTool->GetF2(); const QString color = dialogTool->GetColor(); - VToolArc* point = nullptr; - point=Create(0, center, radius, f1, f2, color, scene, doc, data, Document::FullParse, Source::FromGui); + VToolArc* point = Create(0, center, radius, f1, f2, color, scene, doc, data, Document::FullParse, + Source::FromGui); if (point != nullptr) { point->dialog=dialogTool; @@ -344,12 +344,13 @@ void VToolArc::SetVisualization() { const QSharedPointer arc = VAbstractTool::data.GeometricObject(id); VisToolArc *visual = qobject_cast(vis); - SCASSERT(visual != nullptr) + SCASSERT(visual != nullptr); + const VTranslateVars *trVars = qApp->TrVars(); visual->setPoint1Id(arc->GetCenter().id()); - visual->setRadius(qApp->TrVars()->FormulaToUser(arc->GetFormulaRadius())); - visual->setF1(qApp->TrVars()->FormulaToUser(arc->GetFormulaF1())); - visual->setF2(qApp->TrVars()->FormulaToUser(arc->GetFormulaF2())); + visual->setRadius(trVars->FormulaToUser(arc->GetFormulaRadius())); + visual->setF1(trVars->FormulaToUser(arc->GetFormulaF1())); + visual->setF2(trVars->FormulaToUser(arc->GetFormulaF2())); visual->RefreshGeometry(); } } diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolarcwithlength.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolarcwithlength.cpp index f2a0ad436..7788640e2 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolarcwithlength.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolarcwithlength.cpp @@ -82,8 +82,8 @@ VToolArcWithLength *VToolArcWithLength::Create(DialogTool *dialog, VMainGraphics QString f1 = dialogTool->GetF1(); QString length = dialogTool->GetLength(); const QString color = dialogTool->GetColor(); - VToolArcWithLength* point = nullptr; - point=Create(0, center, radius, f1, length, color, scene, doc, data, Document::FullParse, Source::FromGui); + VToolArcWithLength* point = Create(0, center, radius, f1, length, color, scene, doc, data, Document::FullParse, + Source::FromGui); if (point != nullptr) { point->dialog=dialogTool; @@ -300,12 +300,13 @@ void VToolArcWithLength::SetVisualization() { const QSharedPointer arc = VAbstractTool::data.GeometricObject(id); VisToolArcWithLength *visual = qobject_cast(vis); - SCASSERT(visual != nullptr) + SCASSERT(visual != nullptr); + const VTranslateVars *trVars = qApp->TrVars(); visual->setPoint1Id(arc->GetCenter().id()); - visual->setRadius(qApp->TrVars()->FormulaToUser(arc->GetFormulaRadius())); - visual->setF1(qApp->TrVars()->FormulaToUser(arc->GetFormulaF1())); - visual->setLength(qApp->TrVars()->FormulaToUser(arc->GetFormulaLength())); + visual->setRadius(trVars->FormulaToUser(arc->GetFormulaRadius())); + visual->setF1(trVars->FormulaToUser(arc->GetFormulaF1())); + visual->setLength(trVars->FormulaToUser(arc->GetFormulaLength())); visual->RefreshGeometry(); } } diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolspline.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolspline.cpp index 330aacc8b..7c44d7ec6 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolspline.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolspline.cpp @@ -139,9 +139,8 @@ VToolSpline* VToolSpline::Create(DialogTool *dialog, VMainGraphicsScene *scene, const qreal angle2 = dialogTool->GetAngle2(); const qreal kCurve = dialogTool->GetKCurve(); const QString color = dialogTool->GetColor(); - VToolSpline *spl = nullptr; - spl = Create(0, p1, p4, kAsm1, kAsm2, angle1, angle2, kCurve, color, scene, doc, data, Document::FullParse, - Source::FromGui); + VToolSpline *spl = Create(0, p1, p4, kAsm1, kAsm2, angle1, angle2, kCurve, color, scene, doc, data, + Document::FullParse, Source::FromGui); if (spl != nullptr) { spl->dialog=dialogTool; diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolsplinepath.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolsplinepath.cpp index 4cc9cc98b..e2a21186c 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolsplinepath.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolsplinepath.cpp @@ -132,8 +132,7 @@ VToolSplinePath* VToolSplinePath::Create(DialogTool *dialog, VMainGraphicsScene { doc->IncrementReferens((*path)[i].P().id()); } - VToolSplinePath* spl = nullptr; - spl = Create(0, path, color, scene, doc, data, Document::FullParse, Source::FromGui); + VToolSplinePath* spl = Create(0, path, color, scene, doc, data, Document::FullParse, Source::FromGui); if (spl != nullptr) { spl->dialog=dialogTool; diff --git a/src/libs/vtools/tools/drawTools/toolpoint/tooldoublepoint/vtooltruedarts.cpp b/src/libs/vtools/tools/drawTools/toolpoint/tooldoublepoint/vtooltruedarts.cpp index 737f71fa5..ae9689b29 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/tooldoublepoint/vtooltruedarts.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/tooldoublepoint/vtooltruedarts.cpp @@ -120,9 +120,9 @@ VToolTrueDarts *VToolTrueDarts::Create(DialogTool *dialog, VMainGraphicsScene *s const quint32 dartP2Id = dialogTool->GetSecondDartPointId(); const quint32 dartP3Id = dialogTool->GetThirdDartPointId(); - VToolTrueDarts *point = nullptr; - point=Create(0, 0, 0, baseLineP1Id, baseLineP2Id, dartP1Id, dartP2Id, dartP3Id, point1Name, 5, 10, point2Name, 5, - 10, scene, doc, data, Document::FullParse, Source::FromGui); + VToolTrueDarts *point = Create(0, 0, 0, baseLineP1Id, baseLineP2Id, dartP1Id, dartP2Id, dartP3Id, + point1Name, 5, 10, point2Name, 5, 10, scene, doc, data, Document::FullParse, + Source::FromGui); if (point != nullptr) { point->dialog = dialogTool; diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcut.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcut.cpp index 30d34336d..e5a4ee6a6 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcut.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcut.cpp @@ -37,9 +37,9 @@ VToolCut::VToolCut(VAbstractPattern *doc, VContainer *data, const quint32 &id, c :VToolSinglePoint(doc, data, id, parent), formula(formula), firstCurve(nullptr), secondCurve(nullptr), curveCutId(curveCutId), curve1id(curve1id), curve2id(curve2id), detailsMode(false) { - Q_ASSERT_X(curveCutId > 0, Q_FUNC_INFO, "curveCutId <= 0"); - Q_ASSERT_X(curve1id > 0, Q_FUNC_INFO, "curve1id <= 0"); - Q_ASSERT_X(curve2id > 0, Q_FUNC_INFO, "curve2id <= 0"); + Q_ASSERT_X(curveCutId != 0, Q_FUNC_INFO, "curveCutId == 0"); //-V654 //-V712 + Q_ASSERT_X(curve1id != 0, Q_FUNC_INFO, "curve1id == 0"); //-V654 //-V712 + Q_ASSERT_X(curve2id != 0, Q_FUNC_INFO, "curve2id == 0"); //-V654 //-V712 lineColor = color; @@ -159,7 +159,7 @@ void VToolCut::RemoveReferens() // cppcheck-suppress unusedFunction void VToolCut::FullUpdateCurveFromFile(const QString &attrCurve) { - Q_ASSERT_X(attrCurve.isEmpty() == false, Q_FUNC_INFO, "attribute name is empty"); + Q_ASSERT_X(not attrCurve.isEmpty(), Q_FUNC_INFO, "attribute name is empty"); QDomElement domElement = doc->elementById(id); if (domElement.isElement()) diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.cpp index f74a444f4..2db29bbd3 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.cpp @@ -94,8 +94,8 @@ VToolCutArc* VToolCutArc::Create(DialogTool *dialog, VMainGraphicsScene *scene, QString formula = dialogTool->GetFormula(); const quint32 arcId = dialogTool->getArcId(); const QString color = dialogTool->GetColor(); - VToolCutArc* point = nullptr; - point=Create(0, pointName, formula, arcId, 5, 10, color, scene, doc, data, Document::FullParse, Source::FromGui); + VToolCutArc* point = Create(0, pointName, formula, arcId, 5, 10, color, scene, doc, data, Document::FullParse, + Source::FromGui); if (point != nullptr) { point->dialog=dialogTool; diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.cpp index 753fefba9..01433d0d9 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.cpp @@ -94,9 +94,8 @@ VToolCutSpline* VToolCutSpline::Create(DialogTool *dialog, VMainGraphicsScene *s QString formula = dialogTool->GetFormula(); const quint32 splineId = dialogTool->getSplineId(); const QString color = dialogTool->GetColor(); - VToolCutSpline* point = nullptr; - point = Create(0, pointName, formula, splineId, 5, 10, color, scene, doc, data, Document::FullParse, - Source::FromGui); + VToolCutSpline* point = Create(0, pointName, formula, splineId, 5, 10, color, scene, doc, data, Document::FullParse, + Source::FromGui); if (point != nullptr) { point->dialog=dialogTool; diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.cpp index 37a43ea9a..c1714566d 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.cpp @@ -97,9 +97,8 @@ VToolCutSplinePath* VToolCutSplinePath::Create(DialogTool *dialog, VMainGraphics QString formula = dialogTool->GetFormula(); const quint32 splinePathId = dialogTool->getSplinePathId(); const QString color = dialogTool->GetColor(); - VToolCutSplinePath* point = nullptr; - point = Create(0, pointName, formula, splinePathId, 5, 10, color, scene, doc, data, Document::FullParse, - Source::FromGui); + VToolCutSplinePath* point = Create(0, pointName, formula, splinePathId, 5, 10, color, scene, doc, data, Document::FullParse, + Source::FromGui); if (point != nullptr) { point->dialog=dialogTool; diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolalongline.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolalongline.cpp index 6ca72a68c..12f6a7d46 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolalongline.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolalongline.cpp @@ -205,9 +205,8 @@ VToolAlongLine* VToolAlongLine::Create(DialogTool *dialog, VMainGraphicsScene *s const QString typeLine = dialogTool->GetTypeLine(); const QString lineColor = dialogTool->GetLineColor(); const QString pointName = dialogTool->getPointName(); - VToolAlongLine *point=nullptr; - point = Create(0, pointName, typeLine, lineColor, formula, firstPointId, secondPointId, 5, 10, scene, doc, data, - Document::FullParse, Source::FromGui); + VToolAlongLine *point = Create(0, pointName, typeLine, lineColor, formula, firstPointId, secondPointId, + 5, 10, scene, doc, data, Document::FullParse, Source::FromGui); if (point != nullptr) { point->dialog=dialogTool; diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolbisector.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolbisector.cpp index 80815531c..9a15f911b 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolbisector.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolbisector.cpp @@ -137,9 +137,8 @@ VToolBisector* VToolBisector::Create(DialogTool *dialog, VMainGraphicsScene *sce const QString typeLine = dialogTool->GetTypeLine(); const QString lineColor = dialogTool->GetLineColor(); const QString pointName = dialogTool->getPointName(); - VToolBisector *point = nullptr; - point=Create(0, formula, firstPointId, secondPointId, thirdPointId, typeLine, lineColor, pointName, 5, 10, scene, - doc, data, Document::FullParse, Source::FromGui); + VToolBisector *point = Create(0, formula, firstPointId, secondPointId, thirdPointId, typeLine, lineColor, + pointName, 5, 10, scene, doc, data, Document::FullParse, Source::FromGui); if (point != nullptr) { point->dialog=dialogTool; diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolcurveintersectaxis.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolcurveintersectaxis.cpp index 03478cf1e..5489e4714 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolcurveintersectaxis.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolcurveintersectaxis.cpp @@ -84,9 +84,9 @@ VToolCurveIntersectAxis *VToolCurveIntersectAxis::Create(DialogTool *dialog, VMa const quint32 basePointId = dialogTool->GetBasePointId(); const quint32 curveId = dialogTool->getCurveId(); - VToolCurveIntersectAxis *point = nullptr; - point=Create(0, pointName, typeLine, lineColor, formulaAngle, basePointId, curveId, 5, 10, scene, doc, data, - Document::FullParse, Source::FromGui); + VToolCurveIntersectAxis *point = Create(0, pointName, typeLine, lineColor, formulaAngle, basePointId, + curveId, 5, 10, scene, doc, data, Document::FullParse, + Source::FromGui); if (point != nullptr) { point->dialog=dialogTool; diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolendline.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolendline.cpp index dd3bf8d3a..17276a196 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolendline.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolendline.cpp @@ -104,9 +104,8 @@ VToolEndLine* VToolEndLine::Create(DialogTool *dialog, VMainGraphicsScene *scene QString formulaAngle = dialogTool->GetAngle(); const quint32 basePointId = dialogTool->GetBasePointId(); - VToolEndLine *point = nullptr; - point=Create(0, pointName, typeLine, lineColor, formulaLength, formulaAngle, basePointId, 5, 10, scene, doc, data, - Document::FullParse, Source::FromGui); + VToolEndLine *point = Create(0, pointName, typeLine, lineColor, formulaLength, formulaAngle, + basePointId, 5, 10, scene, doc, data, Document::FullParse, Source::FromGui); if (point != nullptr) { point->dialog=dialogTool; diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolheight.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolheight.cpp index 8796bb1d1..fc4785ecf 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolheight.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolheight.cpp @@ -94,9 +94,8 @@ VToolHeight* VToolHeight::Create(DialogTool *dialog, VMainGraphicsScene *scene, const quint32 p1LineId = dialogTool->GetP1LineId(); const quint32 p2LineId = dialogTool->GetP2LineId(); - VToolHeight *point = nullptr; - point = Create(0, pointName, typeLine, lineColor, basePointId, p1LineId, p2LineId, 5, 10, scene, doc, data, - Document::FullParse, Source::FromGui); + VToolHeight *point = Create(0, pointName, typeLine, lineColor, basePointId, p1LineId, p2LineId, 5, 10, scene, doc, + data, Document::FullParse, Source::FromGui); if (point != nullptr) { point->dialog=dialogTool; diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.cpp index 996c31e82..bbe5c1e0a 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.cpp @@ -86,9 +86,9 @@ VToolLineIntersectAxis *VToolLineIntersectAxis::Create(DialogTool *dialog, VMain const quint32 firstPointId = dialogTool->GetFirstPointId(); const quint32 secondPointId = dialogTool->GetSecondPointId(); - VToolLineIntersectAxis *point = nullptr; - point=Create(0, pointName, typeLine, lineColor, formulaAngle, basePointId, firstPointId, secondPointId, 5, 10, - scene, doc, data, Document::FullParse, Source::FromGui); + VToolLineIntersectAxis *point = Create(0, pointName, typeLine, lineColor, formulaAngle, + basePointId, firstPointId, secondPointId, 5, 10, + scene, doc, data, Document::FullParse, Source::FromGui); if (point != nullptr) { point->dialog=dialogTool; diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollinepoint.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollinepoint.cpp index 77d315320..c612dc5f9 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollinepoint.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollinepoint.cpp @@ -50,7 +50,7 @@ VToolLinePoint::VToolLinePoint(VAbstractPattern *doc, VContainer *data, const qu { this->typeLine = typeLine; this->lineColor = lineColor; - Q_ASSERT_X(basePointId > 0, Q_FUNC_INFO, "basePointId <= 0"); + Q_ASSERT_X(basePointId != 0, Q_FUNC_INFO, "basePointId == 0"); //-V654 //-V712 QPointF point1 = data->GeometricObject(basePointId)->toQPointF(); QPointF point2 = data->GeometricObject(id)->toQPointF(); mainLine = new QGraphicsLineItem(QLineF(point1 - point2, QPointF()), this); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolnormal.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolnormal.cpp index 5781d181f..683f4d7f3 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolnormal.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolnormal.cpp @@ -98,9 +98,8 @@ VToolNormal* VToolNormal::Create(DialogTool *dialog, VMainGraphicsScene *scene, const QString lineColor = dialogTool->GetLineColor(); const QString pointName = dialogTool->getPointName(); const qreal angle = dialogTool->GetAngle(); - VToolNormal *point = nullptr; - point=Create(0, formula, firstPointId, secondPointId, typeLine, lineColor, pointName, angle, 5, 10, scene, doc, - data, Document::FullParse, Source::FromGui); + VToolNormal *point = Create(0, formula, firstPointId, secondPointId, typeLine, lineColor, pointName, angle, 5, 10, + scene, doc, data, Document::FullParse, Source::FromGui); if (point != nullptr) { point->dialog=dialogTool; diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolshoulderpoint.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolshoulderpoint.cpp index ec05a8467..63c79b588 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolshoulderpoint.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolshoulderpoint.cpp @@ -138,9 +138,8 @@ VToolShoulderPoint* VToolShoulderPoint::Create(DialogTool *dialog, VMainGraphics const QString typeLine = dialogTool->GetTypeLine(); const QString lineColor = dialogTool->GetLineColor(); const QString pointName = dialogTool->getPointName(); - VToolShoulderPoint * point = nullptr; - point=Create(0, formula, p1Line, p2Line, pShoulder, typeLine, lineColor, pointName, 5, 10, scene, doc, data, - Document::FullParse, Source::FromGui); + VToolShoulderPoint * point = Create(0, formula, p1Line, p2Line, pShoulder, typeLine, lineColor, pointName, 5, + 10, scene, doc, data, Document::FullParse, Source::FromGui); if (point != nullptr) { point->dialog=dialogTool; diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolbasepoint.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolbasepoint.cpp index 0fa056734..81b086214 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolbasepoint.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolbasepoint.cpp @@ -92,7 +92,7 @@ void VToolBasePoint::ShowVisualization(bool show) */ void VToolBasePoint::AddToFile() { - Q_ASSERT_X(namePP.isEmpty() == false, "AddToFile", "name pattern piece is empty"); + Q_ASSERT_X(not namePP.isEmpty(), Q_FUNC_INFO, "name pattern piece is empty"); QDomElement sPoint = doc->createElement(TagName); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoollineintersect.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoollineintersect.cpp index ef2e8e83b..72afca3e3 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoollineintersect.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoollineintersect.cpp @@ -93,9 +93,8 @@ VToolLineIntersect* VToolLineIntersect::Create(DialogTool *dialog, VMainGraphics const quint32 p1Line2Id = dialogTool->GetP1Line2(); const quint32 p2Line2Id = dialogTool->GetP2Line2(); const QString pointName = dialogTool->getPointName(); - VToolLineIntersect* point = nullptr; - point = Create(0, p1Line1Id, p2Line1Id, p1Line2Id, p2Line2Id, pointName, 5, 10, scene, doc, data, - Document::FullParse, Source::FromGui); + VToolLineIntersect* point = Create(0, p1Line1Id, p2Line1Id, p1Line2Id, p2Line2Id, pointName, 5, 10, scene, doc, + data, Document::FullParse, Source::FromGui); if (point != nullptr) { point->dialog=dialogTool; diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.cpp index c1cae816f..464e43939 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.cpp @@ -68,9 +68,8 @@ VToolPointFromArcAndTangent *VToolPointFromArcAndTangent::Create(DialogTool *dia const quint32 tangentPointId = dialogTool->GetTangentPointId(); const CrossCirclesPoint pType = dialogTool->GetCrossCirclesPoint(); const QString pointName = dialogTool->getPointName(); - VToolPointFromArcAndTangent *point = nullptr; - point = Create(0, pointName, arcId, tangentPointId, pType, 5, 10, scene, doc, data, Document::FullParse, - Source::FromGui); + VToolPointFromArcAndTangent *point = Create(0, pointName, arcId, tangentPointId, pType, 5, 10, scene, doc, + data, Document::FullParse, Source::FromGui); if (point != nullptr) { point->dialog=dialogTool; @@ -244,7 +243,7 @@ CrossCirclesPoint VToolPointFromArcAndTangent::GetCrossCirclesPoint() const } //--------------------------------------------------------------------------------------------------------------------- -void VToolPointFromArcAndTangent::SetCrossCirclesPoint(CrossCirclesPoint &value) +void VToolPointFromArcAndTangent::SetCrossCirclesPoint(const CrossCirclesPoint &value) { crossPoint = value; diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.h b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.h index 858de956e..f128d7edc 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.h +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.h @@ -57,7 +57,7 @@ public: void SetArcId(const quint32 &value); CrossCirclesPoint GetCrossCirclesPoint() const; - void SetCrossCirclesPoint(CrossCirclesPoint &value); + void SetCrossCirclesPoint(const CrossCirclesPoint &value); virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE; protected: diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromcircleandtangent.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromcircleandtangent.cpp index 83c66ce54..ddabfb803 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromcircleandtangent.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromcircleandtangent.cpp @@ -73,9 +73,8 @@ VToolPointFromCircleAndTangent *VToolPointFromCircleAndTangent::Create(DialogToo const quint32 tangentPointId = dialogTool->GetTangentPointId(); const CrossCirclesPoint pType = dialogTool->GetCrossCirclesPoint(); const QString pointName = dialogTool->getPointName(); - VToolPointFromCircleAndTangent *point = nullptr; - point = Create(0, pointName, circleCenterId, circleRadius, tangentPointId, pType, 5, 10, scene, doc, data, - Document::FullParse, Source::FromGui); + VToolPointFromCircleAndTangent *point = Create(0, pointName, circleCenterId, circleRadius, tangentPointId, pType, + 5, 10, scene, doc, data, Document::FullParse, Source::FromGui); if (point != nullptr) { point->dialog=dialogTool; @@ -228,7 +227,7 @@ CrossCirclesPoint VToolPointFromCircleAndTangent::GetCrossCirclesPoint() const } //--------------------------------------------------------------------------------------------------------------------- -void VToolPointFromCircleAndTangent::SetCrossCirclesPoint(CrossCirclesPoint &value) +void VToolPointFromCircleAndTangent::SetCrossCirclesPoint(const CrossCirclesPoint &value) { crossPoint = value; diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromcircleandtangent.h b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromcircleandtangent.h index c00ca45c3..7b4bf670b 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromcircleandtangent.h +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromcircleandtangent.h @@ -63,7 +63,7 @@ public: void SetCircleRadius(const VFormula &value); CrossCirclesPoint GetCrossCirclesPoint() const; - void SetCrossCirclesPoint(CrossCirclesPoint &value); + void SetCrossCirclesPoint(const CrossCirclesPoint &value); virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE; protected: diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofcontact.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofcontact.cpp index 26e764605..cdc11205b 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofcontact.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofcontact.cpp @@ -155,9 +155,8 @@ VToolPointOfContact* VToolPointOfContact::Create(DialogTool *dialog, VMainGraphi const quint32 firstPointId = dialogTool->GetFirstPoint(); const quint32 secondPointId = dialogTool->GetSecondPoint(); const QString pointName = dialogTool->getPointName(); - VToolPointOfContact *point = nullptr; - point=Create(0, radius, center, firstPointId, secondPointId, pointName, 5, 10, scene, doc, data, - Document::FullParse, Source::FromGui); + VToolPointOfContact *point = Create(0, radius, center, firstPointId, secondPointId, pointName, 5, 10, scene, doc, + data, Document::FullParse, Source::FromGui); if (point != nullptr) { point->dialog=dialogTool; diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersection.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersection.cpp index c00445ee7..16b53c2db 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersection.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersection.cpp @@ -86,9 +86,8 @@ VToolPointOfIntersection *VToolPointOfIntersection::Create(DialogTool *dialog, V const quint32 firstPointId = dialogTool->GetFirstPointId(); const quint32 secondPointId = dialogTool->GetSecondPointId(); const QString pointName = dialogTool->getPointName(); - VToolPointOfIntersection *point = nullptr; - point = Create(0, pointName, firstPointId, secondPointId, 5, 10, scene, doc, data, Document::FullParse, - Source::FromGui); + VToolPointOfIntersection *point = Create(0, pointName, firstPointId, secondPointId, 5, 10, scene, doc, + data, Document::FullParse, Source::FromGui); if (point != nullptr) { point->dialog=dialogTool; diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectionarcs.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectionarcs.cpp index b93f9e3b8..9774aa718 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectionarcs.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectionarcs.cpp @@ -68,9 +68,8 @@ VToolPointOfIntersectionArcs *VToolPointOfIntersectionArcs::Create(DialogTool *d const quint32 secondArcId = dialogTool->GetSecondArcId(); const CrossCirclesPoint pType = dialogTool->GetCrossArcPoint(); const QString pointName = dialogTool->getPointName(); - VToolPointOfIntersectionArcs *point = nullptr; - point = Create(0, pointName, firstArcId, secondArcId, pType, 5, 10, scene, doc, data, Document::FullParse, - Source::FromGui); + VToolPointOfIntersectionArcs *point = Create(0, pointName, firstArcId, secondArcId, pType, 5, 10, scene, doc, + data, Document::FullParse, Source::FromGui); if (point != nullptr) { point->dialog=dialogTool; @@ -126,19 +125,20 @@ VToolPointOfIntersectionArcs *VToolPointOfIntersectionArcs::Create(const quint32 QPointF VToolPointOfIntersectionArcs::FindPoint(const VArc *arc1, const VArc *arc2, const CrossCirclesPoint pType) { QPointF p1, p2; - const int res = VGObject::IntersectionCircles(arc1->GetCenter().toQPointF(), arc1->GetRadius(), - arc2->GetCenter().toQPointF(), arc2->GetRadius(), p1, p2); + const QPointF centerArc1 = arc1->GetCenter().toQPointF(); + const QPointF centerArc2 = arc2->GetCenter().toQPointF(); + const int res = VGObject::IntersectionCircles(centerArc1, arc1->GetRadius(), centerArc2, arc2->GetRadius(), p1, p2); - QLineF r1Arc1(arc1->GetCenter().toQPointF(), p1); + QLineF r1Arc1(centerArc1, p1); r1Arc1.setLength(r1Arc1.length()+10); - QLineF r1Arc2(arc2->GetCenter().toQPointF(), p1); + QLineF r1Arc2(centerArc2, p1); r1Arc2.setLength(r1Arc2.length()+10); - QLineF r2Arc1(arc1->GetCenter().toQPointF(), p2); + QLineF r2Arc1(centerArc1, p2); r2Arc1.setLength(r2Arc1.length()+10); - QLineF r2Arc2(arc2->GetCenter().toQPointF(), p2); + QLineF r2Arc2(centerArc2, p2); r2Arc2.setLength(r2Arc2.length()+10); switch(res) @@ -250,7 +250,7 @@ CrossCirclesPoint VToolPointOfIntersectionArcs::GetCrossCirclesPoint() const } //--------------------------------------------------------------------------------------------------------------------- -void VToolPointOfIntersectionArcs::SetCrossCirclesPoint(CrossCirclesPoint &value) +void VToolPointOfIntersectionArcs::SetCrossCirclesPoint(const CrossCirclesPoint &value) { crossPoint = value; diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectionarcs.h b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectionarcs.h index 880f50798..11e5b70b6 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectionarcs.h +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectionarcs.h @@ -61,7 +61,7 @@ public: void SetSecondArcId(const quint32 &value); CrossCirclesPoint GetCrossCirclesPoint() const; - void SetCrossCirclesPoint(CrossCirclesPoint &value); + void SetCrossCirclesPoint(const CrossCirclesPoint &value); virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE; protected: diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncircles.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncircles.cpp index 0d11bf566..14ebea687 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncircles.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncircles.cpp @@ -79,9 +79,9 @@ VToolPointOfIntersectionCircles *VToolPointOfIntersectionCircles::Create(DialogT QString secondCircleRadius = dialogTool->GetSecondCircleRadius(); const CrossCirclesPoint pType = dialogTool->GetCrossCirclesPoint(); const QString pointName = dialogTool->getPointName(); - VToolPointOfIntersectionCircles *point = nullptr; - point = Create(0, pointName, firstCircleCenterId, secondCircleCenterId, firstCircleRadius, secondCircleRadius, - pType, 5, 10, scene, doc, data, Document::FullParse, Source::FromGui); + VToolPointOfIntersectionCircles *point = Create(0, pointName, firstCircleCenterId, secondCircleCenterId, + firstCircleRadius, secondCircleRadius, pType, 5, 10, scene, doc, + data, Document::FullParse, Source::FromGui); if (point != nullptr) { point->dialog=dialogTool; @@ -263,7 +263,7 @@ CrossCirclesPoint VToolPointOfIntersectionCircles::GetCrossCirclesPoint() const } //--------------------------------------------------------------------------------------------------------------------- -void VToolPointOfIntersectionCircles::SetCrossCirclesPoint(CrossCirclesPoint &value) +void VToolPointOfIntersectionCircles::SetCrossCirclesPoint(const CrossCirclesPoint &value) { crossPoint = value; diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncircles.h b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncircles.h index 3540605ed..4bee4764f 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncircles.h +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncircles.h @@ -72,7 +72,7 @@ public: void SetSecondCircleRadius(const VFormula &value); CrossCirclesPoint GetCrossCirclesPoint() const; - void SetCrossCirclesPoint(CrossCirclesPoint &value); + void SetCrossCirclesPoint(const CrossCirclesPoint &value); virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE; protected: diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtooltriangle.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtooltriangle.cpp index df203f994..70ab3f8c8 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtooltriangle.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtooltriangle.cpp @@ -93,9 +93,8 @@ VToolTriangle* VToolTriangle::Create(DialogTool *dialog, VMainGraphicsScene *sce const quint32 firstPointId = dialogTool->GetFirstPointId(); const quint32 secondPointId = dialogTool->GetSecondPointId(); const QString pointName = dialogTool->getPointName(); - VToolTriangle* point = nullptr; - point = Create(0, pointName, axisP1Id, axisP2Id, firstPointId, secondPointId, 5, 10, scene, doc, data, - Document::FullParse, Source::FromGui); + VToolTriangle* point = Create(0, pointName, axisP1Id, axisP2Id, firstPointId, secondPointId, 5, 10, + scene, doc, data, Document::FullParse, Source::FromGui); if (point != nullptr) { point->dialog=dialogTool; diff --git a/src/libs/vtools/tools/drawTools/vdrawtool.h b/src/libs/vtools/tools/drawTools/vdrawtool.h index 7cfa120cc..3b6967e30 100644 --- a/src/libs/vtools/tools/drawTools/vdrawtool.h +++ b/src/libs/vtools/tools/drawTools/vdrawtool.h @@ -128,8 +128,7 @@ void VDrawTool::ContextMenu(Tool *tool, QGraphicsSceneContextMenuEvent *event, b QMenu menu; QAction *actionOption = menu.addAction(QIcon::fromTheme("preferences-other"), tr("Options")); - QAction *actionRemove = nullptr; - actionRemove = menu.addAction(QIcon::fromTheme("edit-delete"), tr("Delete")); + QAction *actionRemove = menu.addAction(QIcon::fromTheme("edit-delete"), tr("Delete")); if (showRemove) { if (_referens > 1) diff --git a/src/libs/vtools/tools/drawTools/vtoolline.cpp b/src/libs/vtools/tools/drawTools/vtoolline.cpp index 8756c2c09..e81290868 100644 --- a/src/libs/vtools/tools/drawTools/vtoolline.cpp +++ b/src/libs/vtools/tools/drawTools/vtoolline.cpp @@ -101,9 +101,8 @@ VToolLine *VToolLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbs const QString typeLine = dialogTool->GetTypeLine(); const QString lineColor = dialogTool->GetLineColor(); - VToolLine *line = nullptr; - line = Create(0, firstPoint, secondPoint, typeLine, lineColor, scene, doc, data, Document::FullParse, - Source::FromGui); + VToolLine *line = Create(0, firstPoint, secondPoint, typeLine, lineColor, scene, doc, data, Document::FullParse, + Source::FromGui); if (line != nullptr) { line->dialog=dialogTool; diff --git a/src/libs/vtools/tools/vdatatool.cpp b/src/libs/vtools/tools/vdatatool.cpp index 1ac7544f9..3bfda5999 100644 --- a/src/libs/vtools/tools/vdatatool.cpp +++ b/src/libs/vtools/tools/vdatatool.cpp @@ -46,23 +46,6 @@ VDataTool::VDataTool(VContainer *data, QObject *parent) VDataTool::~VDataTool() {} -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief operator = assignment operator. - * @param tool tool - * @return tool - */ -VDataTool &VDataTool::operator =(const VDataTool &tool) -{ - if ( &tool == this ) - { - return *this; - } - data = tool.getData(); - _referens = tool.referens(); - return *this; -} - //--------------------------------------------------------------------------------------------------------------------- /** * @brief decrementReferens decrement referens. diff --git a/src/libs/vtools/tools/vdatatool.h b/src/libs/vtools/tools/vdatatool.h index a4d9f02aa..6ebd29b38 100644 --- a/src/libs/vtools/tools/vdatatool.h +++ b/src/libs/vtools/tools/vdatatool.h @@ -46,7 +46,6 @@ class VDataTool : public QObject public: explicit VDataTool(VContainer *data, QObject *parent = nullptr); virtual ~VDataTool() Q_DECL_OVERRIDE; - VDataTool &operator= (const VDataTool &tool); VContainer getData() const; void setData(const VContainer *value); virtual quint32 referens() const; @@ -58,6 +57,8 @@ protected: /** @brief _referens keep count tools what use this tool. If value more than 1 you can't delete tool. */ quint32 _referens; +private: + Q_DISABLE_COPY(VDataTool) }; //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/tools/vtooldetail.cpp b/src/libs/vtools/tools/vtooldetail.cpp index 42c44ec8b..793779ced 100644 --- a/src/libs/vtools/tools/vtooldetail.cpp +++ b/src/libs/vtools/tools/vtooldetail.cpp @@ -153,38 +153,38 @@ void VToolDetail::Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstrac for (int i = 0; i< detail.CountNode(); ++i) { quint32 id = 0; - switch (detail.at(i).getTypeTool()) + const VNodeDetail &nodeD = detail.at(i); + switch (nodeD.getTypeTool()) { case (Tool::NodePoint): { - id = CreateNode(data, detail.at(i).getId()); - VNodePoint::Create(doc, data, id, detail.at(i).getId(), Document::FullParse, Source::FromGui); + id = CreateNode(data, nodeD.getId()); + VNodePoint::Create(doc, data, id, nodeD.getId(), Document::FullParse, Source::FromGui); } break; case (Tool::NodeArc): { - id = CreateNode(data, detail.at(i).getId()); - VNodeArc::Create(doc, data, id, detail.at(i).getId(), Document::FullParse, Source::FromGui); + id = CreateNode(data, nodeD.getId()); + VNodeArc::Create(doc, data, id, nodeD.getId(), Document::FullParse, Source::FromGui); } break; case (Tool::NodeSpline): { - id = CreateNode(data, detail.at(i).getId()); - VNodeSpline::Create(doc, data, id, detail.at(i).getId(), Document::FullParse, Source::FromGui); + id = CreateNode(data, nodeD.getId()); + VNodeSpline::Create(doc, data, id, nodeD.getId(), Document::FullParse, Source::FromGui); } break; case (Tool::NodeSplinePath): { - id = CreateNode(data, detail.at(i).getId()); - VNodeSplinePath::Create(doc, data, id, detail.at(i).getId(), Document::FullParse, Source::FromGui); + id = CreateNode(data, nodeD.getId()); + VNodeSplinePath::Create(doc, data, id, nodeD.getId(), Document::FullParse, Source::FromGui); } break; default: qDebug()<<"May be wrong tool type!!! Ignoring."<GeometricObject(pRotate)->toQPointF(); const QSharedPointer arc = data->GeometricObject(det.at(i).getId()); VPointF p1 = VPointF(arc->GetP1(), "A", 0, 0); - BiasRotatePoint(&p1, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); + BiasRotatePoint(&p1, dx, dy, p, angle); VPointF p2 = VPointF(arc->GetP2(), "A", 0, 0); - BiasRotatePoint(&p2, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); + BiasRotatePoint(&p2, dx, dy, p, angle); VPointF *center = new VPointF(arc->GetCenter()); - BiasRotatePoint(center, dx, dy, data->GeometricObject(pRotate)->toQPointF(), - angle); + BiasRotatePoint(center, dx, dy, p, angle); QLineF l1(center->toQPointF(), p1.toQPointF()); QLineF l2(center->toQPointF(), p2.toQPointF()); @@ -155,17 +155,18 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VAbstractPattern *doc, VCo { const QSharedPointer spline = data->GeometricObject(det.at(i).getId()); + const QPointF p = data->GeometricObject(pRotate)->toQPointF(); VPointF *p1 = new VPointF(spline->GetP1()); - BiasRotatePoint(p1, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); + BiasRotatePoint(p1, dx, dy, p, angle); VPointF p2 = VPointF(spline->GetP2()); - BiasRotatePoint(&p2, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); + BiasRotatePoint(&p2, dx, dy, p, angle); VPointF p3 = VPointF(spline->GetP3()); - BiasRotatePoint(&p3, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); + BiasRotatePoint(&p3, dx, dy, p, angle); VPointF *p4 = new VPointF(spline->GetP4()); - BiasRotatePoint(p4, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); + BiasRotatePoint(p4, dx, dy, p, angle); VSpline *spl = new VSpline(*p1, p2.toQPointF(), p3.toQPointF(), *p4, spline->GetKcurve(), 0, Draw::Modeling); @@ -194,30 +195,33 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VAbstractPattern *doc, VCo const QSharedPointer splinePath = data->GeometricObject(det.at(i).getId()); for (qint32 i = 1; i <= splinePath->Count(); ++i) { - VSpline spline(splinePath->at(i-1).P(), splinePath->at(i).P(), - splinePath->at(i-1).Angle2(), splinePath->at(i).Angle1(), splinePath->at(i-1).KAsm2(), - splinePath->at(i).KAsm1(), splinePath->GetKCurve()); + const VSplinePoint &point1 = splinePath->at(i-1); + const VSplinePoint &point2 = splinePath->at(i); + VSpline spline(point1.P(), point2.P(), + point1.Angle2(), point2.Angle1(), point1.KAsm2(), + point2.KAsm1(), splinePath->GetKCurve()); + const QPointF p = data->GeometricObject(pRotate)->toQPointF(); VPointF *p1 = new VPointF(spline.GetP1()); - BiasRotatePoint(p1, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); + BiasRotatePoint(p1, dx, dy, p, angle); VPointF p2 = VPointF(spline.GetP2()); - BiasRotatePoint(&p2, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); + BiasRotatePoint(&p2, dx, dy, p, angle); VPointF p3 = VPointF(spline.GetP3()); - BiasRotatePoint(&p3, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); + BiasRotatePoint(&p3, dx, dy, p, angle); VPointF *p4 = new VPointF(spline.GetP4()); - BiasRotatePoint(p4, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); + BiasRotatePoint(p4, dx, dy, p, angle); VSpline spl = VSpline(*p1, p2.toQPointF(), p3.toQPointF(), *p4, spline.GetKcurve()); if (i==1) { - path->append(VSplinePoint(*p1, splinePath->at(i-1).KAsm1(), spl.GetStartAngle()+180, - splinePath->at(i-1).KAsm2(), spl.GetStartAngle())); + path->append(VSplinePoint(*p1, point1.KAsm1(), spl.GetStartAngle()+180, + point1.KAsm2(), spl.GetStartAngle())); } - path->append(VSplinePoint(*p4, splinePath->at(i).KAsm1(), spl.GetEndAngle(), - splinePath->at(i).KAsm2(), spl.GetEndAngle()+180)); + path->append(VSplinePoint(*p4, point2.KAsm1(), spl.GetEndAngle(), + point2.KAsm2(), spl.GetEndAngle()+180)); delete p4; delete p1; } @@ -274,16 +278,16 @@ void VToolUnionDetails::UpdatePoints(const quint32 &idDetail, VContainer *data, { if (qFuzzyCompare(dx+1, 1) == false || qFuzzyCompare(dy+1, 1) == false || pRotate != 0) { + const QPointF p = data->GeometricObject(pRotate)->toQPointF(); const QSharedPointer arc = data->GeometricObject(det.at(i).getId()); VPointF p1 = VPointF(arc->GetP1()); - BiasRotatePoint(&p1, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); + BiasRotatePoint(&p1, dx, dy, p, angle); VPointF p2 = VPointF(arc->GetP2()); - BiasRotatePoint(&p2, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); + BiasRotatePoint(&p2, dx, dy, p, angle); VPointF *center = new VPointF(arc->GetCenter()); - BiasRotatePoint(center, dx, dy, data->GeometricObject(pRotate)->toQPointF(), - angle); + BiasRotatePoint(center, dx, dy, p, angle); QLineF l1(center->toQPointF(), p1.toQPointF()); QLineF l2(center->toQPointF(), p2.toQPointF()); @@ -305,17 +309,18 @@ void VToolUnionDetails::UpdatePoints(const quint32 &idDetail, VContainer *data, { const QSharedPointer spline = data->GeometricObject(det.at(i).getId()); + const QPointF p = data->GeometricObject(pRotate)->toQPointF(); VPointF *p1 = new VPointF(spline->GetP1()); - BiasRotatePoint(p1, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); + BiasRotatePoint(p1, dx, dy, p, angle); VPointF p2 = VPointF(spline->GetP2()); - BiasRotatePoint(&p2, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); + BiasRotatePoint(&p2, dx, dy, p, angle); VPointF p3 = VPointF(spline->GetP3()); - BiasRotatePoint(&p3, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); + BiasRotatePoint(&p3, dx, dy, p, angle); VPointF *p4 = new VPointF(spline->GetP4()); - BiasRotatePoint(p4, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); + BiasRotatePoint(p4, dx, dy, p, angle); VSpline *spl = new VSpline(*p1, p2.toQPointF(), p3.toQPointF(), *p4, spline->GetKcurve(), 0, Draw::Modeling); @@ -339,34 +344,33 @@ void VToolUnionDetails::UpdatePoints(const quint32 &idDetail, VContainer *data, SCASSERT(splinePath != nullptr); for (qint32 i = 1; i <= splinePath->Count(); ++i) { - VSpline spline(splinePath->at(i-1).P(), splinePath->at(i).P(), - splinePath->at(i-1).Angle2(), splinePath->at(i).Angle1(), splinePath->at(i-1).KAsm2(), - splinePath->at(i).KAsm1(), splinePath->GetKCurve()); + const VSplinePoint &point1 = splinePath->at(i-1); + const VSplinePoint &point2 = splinePath->at(i); + VSpline spline(point1.P(), point2.P(), + point1.Angle2(), point2.Angle1(), point1.KAsm2(), + point2.KAsm1(), splinePath->GetKCurve()); + const QPointF p = data->GeometricObject(pRotate)->toQPointF(); VPointF *p1 = new VPointF(spline.GetP1()); - BiasRotatePoint(p1, dx, dy, data->GeometricObject(pRotate)->toQPointF(), - angle); + BiasRotatePoint(p1, dx, dy, p, angle); VPointF p2 = VPointF(spline.GetP2()); - BiasRotatePoint(&p2, dx, dy, data->GeometricObject(pRotate)->toQPointF(), - angle); + BiasRotatePoint(&p2, dx, dy, p, angle); VPointF p3 = VPointF(spline.GetP3()); - BiasRotatePoint(&p3, dx, dy, data->GeometricObject(pRotate)->toQPointF(), - angle); + BiasRotatePoint(&p3, dx, dy, p, angle); VPointF *p4 = new VPointF(spline.GetP4()); - BiasRotatePoint(p4, dx, dy, data->GeometricObject(pRotate)->toQPointF(), - angle); + BiasRotatePoint(p4, dx, dy, p, angle); VSpline spl = VSpline(*p1, p2.toQPointF(), p3.toQPointF(), *p4, spline.GetKcurve()); if (i==1) { - path->append(VSplinePoint(*p1, splinePath->at(i-1).KAsm1(), spl.GetStartAngle()+180, - splinePath->at(i-1).KAsm2(), spl.GetStartAngle())); + path->append(VSplinePoint(*p1, point1.KAsm1(), spl.GetStartAngle()+180, + point1.KAsm2(), spl.GetStartAngle())); } - path->append(VSplinePoint(*p4, splinePath->at(i).KAsm1(), spl.GetEndAngle(), - splinePath->at(i).KAsm2(), spl.GetEndAngle()+180)); + path->append(VSplinePoint(*p4, point2.KAsm1(), spl.GetEndAngle(), + point2.KAsm2(), spl.GetEndAngle()+180)); delete p1; delete p4; } @@ -434,9 +438,8 @@ VToolUnionDetails* VToolUnionDetails::Create(DialogTool *dialog, VMainGraphicsSc quint32 indexD1 = static_cast(dialogTool->getIndexD1()); quint32 indexD2 = static_cast(dialogTool->getIndexD2()); qApp->getUndoStack()->beginMacro("union details"); - VToolUnionDetails* tool = nullptr; - tool = Create(0, d1, d2, dialogTool->getD1(), dialogTool->getD2(), indexD1, indexD2, scene, doc, data, - Document::FullParse, Source::FromGui); + VToolUnionDetails* tool = Create(0, d1, d2, dialogTool->getD1(), dialogTool->getD2(), indexD1, indexD2, scene, + doc, data, Document::FullParse, Source::FromGui); qApp->getUndoStack()->endMacro(); return tool; } diff --git a/src/libs/vtools/visualization/visline.cpp b/src/libs/vtools/visualization/visline.cpp index c87778efc..1c20b5165 100644 --- a/src/libs/vtools/visualization/visline.cpp +++ b/src/libs/vtools/visualization/visline.cpp @@ -48,7 +48,7 @@ qreal VisLine::CorrectAngle(const qreal &angle) const qreal ang = angle; if (angle > 360) { - ang = angle - 360 * qFloor(angle/360); + ang = angle - 360.0 * qFloor(angle/360); } switch (qFloor((qAbs(ang)+22.5)/45)) diff --git a/src/libs/vtools/visualization/vistoolalongline.cpp b/src/libs/vtools/visualization/vistoolalongline.cpp index 3e8ae718b..2085bebb3 100644 --- a/src/libs/vtools/visualization/vistoolalongline.cpp +++ b/src/libs/vtools/visualization/vistoolalongline.cpp @@ -39,7 +39,7 @@ VisToolAlongLine::VisToolAlongLine(const VContainer *data, QGraphicsItem *parent this->setZValue(2);// Show on top real tool lineP1 = InitPoint(supportColor, this); - lineP2 = InitPoint(supportColor, this); + lineP2 = InitPoint(supportColor, this); //-V656 line = InitItem(supportColor, this); point = InitPoint(mainColor, this); } diff --git a/src/libs/vtools/visualization/vistoolbisector.cpp b/src/libs/vtools/visualization/vistoolbisector.cpp index a35072b34..09aecac6f 100644 --- a/src/libs/vtools/visualization/vistoolbisector.cpp +++ b/src/libs/vtools/visualization/vistoolbisector.cpp @@ -37,7 +37,7 @@ VisToolBisector::VisToolBisector(const VContainer *data, QGraphicsItem *parent) line1(nullptr), line2P2(nullptr), line2(nullptr), length(0) { line1P1 = InitPoint(supportColor, this); - line1P2 = InitPoint(supportColor, this); + line1P2 = InitPoint(supportColor, this); //-V656 line1 = InitItem(supportColor, this); line2P2 = InitPoint(supportColor, this); diff --git a/src/libs/vtools/visualization/vistoolcurveintersectaxis.cpp b/src/libs/vtools/visualization/vistoolcurveintersectaxis.cpp index ee135235c..a1ff39d48 100644 --- a/src/libs/vtools/visualization/vistoolcurveintersectaxis.cpp +++ b/src/libs/vtools/visualization/vistoolcurveintersectaxis.cpp @@ -41,7 +41,7 @@ VisToolCurveIntersectAxis::VisToolCurveIntersectAxis(const VContainer *data, QGr visCurve = InitItem(Qt::darkGreen, this); basePoint = InitPoint(supportColor, this); baseLine = InitItem(supportColor, this); - axisLine = InitItem(supportColor, this); + axisLine = InitItem(supportColor, this); //-V656 point = InitPoint(mainColor, this); } diff --git a/src/libs/vtools/visualization/vistoolheight.cpp b/src/libs/vtools/visualization/vistoolheight.cpp index f2faaea75..100a80beb 100644 --- a/src/libs/vtools/visualization/vistoolheight.cpp +++ b/src/libs/vtools/visualization/vistoolheight.cpp @@ -39,7 +39,7 @@ VisToolHeight::VisToolHeight(const VContainer *data, QGraphicsItem *parent) lineP1 = InitPoint(supportColor, this); lineP2 = InitPoint(supportColor, this); line = InitItem(supportColor, this); - line_intersection = InitItem(supportColor, this); + line_intersection = InitItem(supportColor, this); //-V656 point = InitPoint(mainColor, this); } diff --git a/src/libs/vtools/visualization/vistoolnormal.cpp b/src/libs/vtools/visualization/vistoolnormal.cpp index fbb5800d2..ed3acae8e 100644 --- a/src/libs/vtools/visualization/vistoolnormal.cpp +++ b/src/libs/vtools/visualization/vistoolnormal.cpp @@ -38,7 +38,7 @@ VisToolNormal::VisToolNormal(const VContainer *data, QGraphicsItem *parent) this->mainColor = Qt::red; lineP1 = InitPoint(supportColor, this); - lineP2 = InitPoint(supportColor, this); + lineP2 = InitPoint(supportColor, this); //-V656 line = InitItem(supportColor, this); point = InitPoint(mainColor, this); diff --git a/src/libs/vtools/visualization/vistoolpointfromcircleandtangent.cpp b/src/libs/vtools/visualization/vistoolpointfromcircleandtangent.cpp index eee6b1463..0206c67f8 100644 --- a/src/libs/vtools/visualization/vistoolpointfromcircleandtangent.cpp +++ b/src/libs/vtools/visualization/vistoolpointfromcircleandtangent.cpp @@ -39,7 +39,7 @@ VisToolPointFromCircleAndTangent::VisToolPointFromCircleAndTangent(const VContai cPath = InitItem(Qt::darkGreen, this); point = InitPoint(mainColor, this); tangent = InitPoint(supportColor, this); - cCenter = InitPoint(supportColor, this); + cCenter = InitPoint(supportColor, this); //-V656 tangent2 = InitItem(supportColor, this); } diff --git a/src/libs/vtools/visualization/vistoolpointofintersection.cpp b/src/libs/vtools/visualization/vistoolpointofintersection.cpp index be3a9b426..3c8b26f88 100644 --- a/src/libs/vtools/visualization/vistoolpointofintersection.cpp +++ b/src/libs/vtools/visualization/vistoolpointofintersection.cpp @@ -35,7 +35,7 @@ VisToolPointOfIntersection::VisToolPointOfIntersection(const VContainer *data, Q : VisLine(data, parent), point2Id(NULL_ID), point(nullptr), axisP1(nullptr), axisP2(nullptr), axis2(nullptr) { axisP1 = InitPoint(supportColor, this); - axisP2 = InitPoint(supportColor, this); + axisP2 = InitPoint(supportColor, this); //-V656 axis2 = InitItem(supportColor, this); point = InitPoint(mainColor, this); diff --git a/src/libs/vtools/visualization/vistoolpointofintersectioncircles.cpp b/src/libs/vtools/visualization/vistoolpointofintersectioncircles.cpp index 9c8142710..8c4857355 100644 --- a/src/libs/vtools/visualization/vistoolpointofintersectioncircles.cpp +++ b/src/libs/vtools/visualization/vistoolpointofintersectioncircles.cpp @@ -41,7 +41,7 @@ VisToolPointOfIntersectionCircles::VisToolPointOfIntersectionCircles(const VCont c2Path = InitItem(Qt::darkRed, this); point = InitPoint(mainColor, this); c1Center = InitPoint(supportColor, this); - c2Center = InitPoint(supportColor, this); + c2Center = InitPoint(supportColor, this); //-V656 } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/visualization/vistoolshoulderpoint.cpp b/src/libs/vtools/visualization/vistoolshoulderpoint.cpp index 61d89a676..2444c3ba0 100644 --- a/src/libs/vtools/visualization/vistoolshoulderpoint.cpp +++ b/src/libs/vtools/visualization/vistoolshoulderpoint.cpp @@ -36,12 +36,12 @@ VisToolShoulderPoint::VisToolShoulderPoint(const VContainer *data, QGraphicsItem line1(nullptr), line2P2(nullptr), line2(nullptr), line3(nullptr), length(0) { line1P1 = InitPoint(supportColor, this); - line1P2 = InitPoint(supportColor, this); + line1P2 = InitPoint(supportColor, this); //-V656 line1 = InitItem(supportColor, this); line2P2 = InitPoint(supportColor, this); line2 = InitItem(supportColor, this); - line3 = InitItem(supportColor, this); + line3 = InitItem(supportColor, this); //-V656 point = InitPoint(mainColor, this); } diff --git a/src/libs/vtools/visualization/vistoolspline.cpp b/src/libs/vtools/visualization/vistoolspline.cpp index f91ba51cb..5c80ffeaf 100644 --- a/src/libs/vtools/visualization/vistoolspline.cpp +++ b/src/libs/vtools/visualization/vistoolspline.cpp @@ -39,7 +39,7 @@ VisToolSpline::VisToolSpline(const VContainer *data, QGraphicsItem *parent) angle2(EMPTY_ANGLE), kAsm1(1), kAsm2(1), kCurve(1) { lineP1 = InitPoint(supportColor, this); - lineP4 = InitPoint(supportColor, this); + lineP4 = InitPoint(supportColor, this); //-V656 line = InitItem(mainColor, this); } diff --git a/src/libs/vtools/visualization/vistooltriangle.cpp b/src/libs/vtools/visualization/vistooltriangle.cpp index 48f7dcec8..7de51bd49 100644 --- a/src/libs/vtools/visualization/vistooltriangle.cpp +++ b/src/libs/vtools/visualization/vistooltriangle.cpp @@ -44,7 +44,7 @@ VisToolTriangle::VisToolTriangle(const VContainer *data, QGraphicsItem *parent) hypotenuseP1 = InitPoint(supportColor, this); hypotenuseP2 = InitPoint(supportColor, this); foot1 = InitItem(supportColor, this); - foot2 = InitItem(supportColor, this); + foot2 = InitItem(supportColor, this); //-V656 point = InitPoint(mainColor, this); } diff --git a/src/libs/vtools/visualization/vistooltruedarts.cpp b/src/libs/vtools/visualization/vistooltruedarts.cpp index dff39dc64..ea52dd767 100644 --- a/src/libs/vtools/visualization/vistooltruedarts.cpp +++ b/src/libs/vtools/visualization/vistooltruedarts.cpp @@ -62,7 +62,7 @@ VisToolTrueDarts::VisToolTrueDarts(const VContainer *data, QGraphicsItem *parent d2p2 = InitItem(supportColor, this); point1 = InitPoint(mainColor, this); - point2 = InitPoint(mainColor, this); + point2 = InitPoint(mainColor, this); //-V656 } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/test/ParserTest/main.cpp b/src/test/ParserTest/main.cpp index a10f78021..01bc56f2d 100644 --- a/src/test/ParserTest/main.cpp +++ b/src/test/ParserTest/main.cpp @@ -46,11 +46,11 @@ void testMessageOutput(QtMsgType type, const QMessageLogContext &context, const fprintf(stderr, "%s\n", localMsg.constData()); break; case QtCriticalMsg: - fprintf(stderr, "Critical: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, + fprintf(stderr, "Critical: %s (%s:%i, %s)\n", localMsg.constData(), context.file, context.line, context.function); break; case QtFatalMsg: - fprintf(stderr, "Fatal: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, + fprintf(stderr, "Fatal: %s (%s:%i, %s)\n", localMsg.constData(), context.file, context.line, context.function); abort(); default: diff --git a/src/test/ValentinaTest/tst_vlayoutdetail.cpp b/src/test/ValentinaTest/tst_vlayoutdetail.cpp index bd8d806b9..cf29172ef 100644 --- a/src/test/ValentinaTest/tst_vlayoutdetail.cpp +++ b/src/test/ValentinaTest/tst_vlayoutdetail.cpp @@ -90,7 +90,7 @@ QVector TST_VLayoutDetail::InputPointsCase1() const } //--------------------------------------------------------------------------------------------------------------------- -QVector TST_VLayoutDetail::OutputPointsCase1() const +QVector TST_VLayoutDetail::OutputPointsCase1() const //-V524 { QVector points; @@ -177,7 +177,7 @@ QVector TST_VLayoutDetail::InputPointsCase3() const } //--------------------------------------------------------------------------------------------------------------------- -QVector TST_VLayoutDetail::OutputPointsCase3() const +QVector TST_VLayoutDetail::OutputPointsCase3() const //-V524 { QVector points; diff --git a/src/test/ValentinaTest/tst_vlockguard.cpp b/src/test/ValentinaTest/tst_vlockguard.cpp index 7574eca9a..0c0c5ab29 100644 --- a/src/test/ValentinaTest/tst_vlockguard.cpp +++ b/src/test/ValentinaTest/tst_vlockguard.cpp @@ -31,6 +31,10 @@ #include +#ifdef Q_CC_MSVC + #include +#endif /* Q_CC_MSVC */ + //--------------------------------------------------------------------------------------------------------------------- TST_VLockGuard::TST_VLockGuard(QObject *parent) :QObject(parent)