From 8f186148badfe44ee6fade8d54ecf7eca63d0adc Mon Sep 17 00:00:00 2001 From: dismine Date: Tue, 20 Aug 2013 13:26:02 +0300 Subject: [PATCH] Fixed gcc warning in code. --- Valentina.pro | 8 +++-- container/calculator.cpp | 13 +++++--- container/calculator.h | 3 ++ container/vcontainer.cpp | 25 ++++++++++----- container/vcontainer.h | 3 +- container/vincrementtablerow.cpp | 15 ++------- container/vincrementtablerow.h | 3 ++ container/vstandarttablecell.cpp | 13 ++------ container/vstandarttablecell.h | 6 ++++ dialogs/dialogalongline.cpp | 8 +++-- dialogs/dialogalongline.h | 5 +++ dialogs/dialogarc.cpp | 7 ++--- dialogs/dialogarc.h | 2 ++ dialogs/dialogbisector.cpp | 5 ++- dialogs/dialogbisector.h | 2 ++ dialogs/dialogendline.cpp | 9 ++++-- dialogs/dialogendline.h | 5 +++ dialogs/dialoghistory.h | 2 ++ dialogs/dialogincrements.cpp | 12 ++++---- dialogs/dialogincrements.h | 11 +++++-- dialogs/dialogline.cpp | 9 ++++-- dialogs/dialogline.h | 11 ++++++- dialogs/dialoglineintersect.cpp | 5 ++- dialogs/dialoglineintersect.h | 2 ++ dialogs/dialognormal.cpp | 5 ++- dialogs/dialognormal.h | 2 ++ dialogs/dialogshoulderpoint.cpp | 4 +-- dialogs/dialogshoulderpoint.h | 2 ++ dialogs/dialogsinglepoint.cpp | 9 ++++-- dialogs/dialogsinglepoint.h | 2 ++ dialogs/dialogspline.cpp | 13 ++++---- dialogs/dialogspline.h | 2 ++ dialogs/dialogsplinepath.cpp | 13 +++++--- dialogs/dialogsplinepath.h | 8 +++++ dialogs/dialogtool.cpp | 28 +++++++---------- dialogs/dialogtool.h | 8 ++++- geometry/vspline.cpp | 47 +++++++++-------------------- geometry/vsplinepath.cpp | 13 ++++---- geometry/vsplinepath.h | 1 + geometry/vsplinepoint.cpp | 20 +++--------- main.cpp | 3 +- mainwindow.cpp | 21 +++++++++---- mainwindow.h | 10 ++++-- tools/vabstracttool.cpp | 10 +++++- tools/vabstracttool.h | 34 +++++++++++++++++++-- tools/vdatatool.cpp | 7 +++-- tools/vdatatool.h | 3 +- tools/vtoolalongline.cpp | 10 ++++-- tools/vtoolalongline.h | 3 ++ tools/vtoolarc.cpp | 10 +++++- tools/vtoolarc.h | 8 ++++- tools/vtoolbisector.cpp | 4 ++- tools/vtoolendline.cpp | 8 +++-- tools/vtoolendline.h | 4 ++- tools/vtoolline.cpp | 13 +++++--- tools/vtoolline.h | 6 ++++ tools/vtoollineintersect.cpp | 17 ++++++----- tools/vtoollineintersect.h | 6 ++++ tools/vtoollinepoint.cpp | 6 ++++ tools/vtoollinepoint.h | 6 +++- tools/vtoolnormal.cpp | 17 ++++++++--- tools/vtoolnormal.h | 13 +++++--- tools/vtoolpoint.cpp | 16 +++++++--- tools/vtoolpoint.h | 9 +++++- tools/vtoolshoulderpoint.cpp | 15 ++++++--- tools/vtoolshoulderpoint.h | 6 ++++ tools/vtoolsinglepoint.cpp | 14 ++++++--- tools/vtoolsinglepoint.h | 8 ++++- tools/vtoolspline.cpp | 13 ++++++-- tools/vtoolspline.h | 8 ++++- tools/vtoolsplinepath.cpp | 4 ++- tools/vtoolsplinepath.h | 8 ++++- widgets/delegate.cpp | 6 ++++ widgets/delegate.h | 6 ++++ widgets/doubledelegate.cpp | 7 ++++- widgets/doubledelegate.h | 6 ++++ widgets/vcontrolpointspline.cpp | 12 +++++--- widgets/vcontrolpointspline.h | 8 +++++ widgets/vgraphicssimpletextitem.cpp | 6 ++++ widgets/vgraphicssimpletextitem.h | 6 ++++ widgets/vmaingraphicsscene.cpp | 8 +++++ widgets/vmaingraphicsscene.h | 4 +++ widgets/vmaingraphicsview.cpp | 6 ++++ widgets/vmaingraphicsview.h | 6 ++++ xml/vdomdocument.cpp | 30 ++++++++++-------- xml/vdomdocument.h | 12 +++++++- xml/vtoolrecord.h | 4 +-- 87 files changed, 563 insertions(+), 245 deletions(-) diff --git a/Valentina.pro b/Valentina.pro index 24f758038..b83b64fba 100644 --- a/Valentina.pro +++ b/Valentina.pro @@ -130,9 +130,11 @@ RESOURCES += \ CONFIG(debug, debug|release){ # Debug - QMAKE_CXXFLAGS += -O0 -isystem "/usr/include/qt5" -Wall -Wextra -pedantic -Weffc++ -Woverloaded-virtual \ - -Wctor-dtor-privacy -Wnon-virtual-dtor -Wold-style-cast -Wconversion -Wsign-conversion \ - -Winit-self -Wunreachable-code -std=c++0x + QMAKE_CXXFLAGS += -isystem "/usr/include/qt5" -isystem "/usr/include/qt5/QtWidgets" \ + -isystem "/usr/include/qt5/QtXml" -isystem "/usr/include/qt5/QtGui" \ + -isystem "/usr/include/qt5/QtCore" -O0 -Wall -Wextra -pedantic -Weffc++ \ + -Woverloaded-virtual -Wctor-dtor-privacy -Wnon-virtual-dtor -Wold-style-cast \ + -Wconversion -Wsign-conversion -Winit-self -Wunreachable-code -std=c++0x }else{ # Release QMAKE_CXXFLAGS += -O1 -std=c++0x diff --git a/container/calculator.cpp b/container/calculator.cpp index 8141059fb..d24c70523 100644 --- a/container/calculator.cpp +++ b/container/calculator.cpp @@ -1,7 +1,12 @@ #include "calculator.h" #include - +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Weffc++" +#pragma GCC diagnostic ignored "-Wconversion" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wctor-dtor-privacy" #include +#pragma GCC diagnostic pop #define DELIMITER 1 #define VARIABLE 2 @@ -12,10 +17,8 @@ #define FINISHED 10 #define EOL 9 -Calculator::Calculator(const VContainer *data){ - index = 0; - this->data = data; - +Calculator::Calculator(const VContainer *data):errorMsg(0), token(QString()), tok(0), token_type(0), + prog(QString()), index(0), data(data), debugFormula(QString()){ } qreal Calculator::eval(QString prog, QString *errorMsg){ diff --git a/container/calculator.h b/container/calculator.h index fe0e024ad..45f8d0025 100644 --- a/container/calculator.h +++ b/container/calculator.h @@ -3,6 +3,7 @@ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Weffc++" +#pragma GCC diagnostic ignored "-Wconversion" #pragma GCC diagnostic ignored "-Wsign-conversion" #pragma GCC diagnostic ignored "-Wctor-dtor-privacy" #include @@ -32,6 +33,8 @@ public: */ qreal eval(QString prog, QString *errorMsg); private: + Calculator(const Calculator &calc); + const Calculator &operator=(const Calculator &calc); QString *errorMsg; /** * @brief token теперішня лексема. diff --git a/container/vcontainer.cpp b/container/vcontainer.cpp index ca5af747c..d2d79dd61 100644 --- a/container/vcontainer.cpp +++ b/container/vcontainer.cpp @@ -1,11 +1,20 @@ #include "vcontainer.h" +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Weffc++" +#pragma GCC diagnostic ignored "-Wconversion" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wctor-dtor-privacy" #include - +#pragma GCC diagnostic pop #include "../options.h" qint64 VContainer::_id = 0; -VContainer::VContainer(){ +VContainer::VContainer():base(QMap()), points(QMap()), + standartTable(QMap()), incrementTable(QMap()), + lengthLines(QMap()), lineArcs(QMap()), splines(QMap()), + lengthSplines(QMap()), arcs(QMap()), lengthArcs(QMap()), + splinePaths(QMap()){ SetSize(500); SetGrowth(1760); CreateManTableIGroup (); @@ -60,7 +69,7 @@ qreal VContainer::GetLine(const QString &name) const{ return GetObject(lengthLines, name); } -qint32 VContainer::GetLineArc(const QString &name) const{ +qreal VContainer::GetLineArc(const QString &name) const{ Q_ASSERT(!name.isEmpty()); return GetObject(lineArcs, name); } @@ -155,16 +164,16 @@ void VContainer::AddLineArc(const QString &name, const qint32 &value){ qreal VContainer::GetValueStandartTableCell(const QString& name) const{ VStandartTableCell cell = GetStandartTableCell(name); - qreal k_size = ( ( qreal ) (size()/10) - 50.0 ) / 2; - qreal k_growth = ( ( qreal ) (growth()/10) - 176.0 ) / 6; + qreal k_size = ( static_cast (size()/10.0) - 50.0 ) / 2.0; + qreal k_growth = ( static_cast (growth()/10.0) - 176.0 ) / 6.0; qreal value = cell.GetBase() + k_size*cell.GetKsize() + k_growth*cell.GetKgrowth(); return value; } qreal VContainer::GetValueIncrementTableRow(const QString& name) const{ VIncrementTableRow cell = GetIncrementTableRow(name); - qreal k_size = ( ( qreal ) (size()/10) - 50.0 ) / 2; - qreal k_growth = ( ( qreal ) (growth()/10) - 176.0 ) / 6; + qreal k_size = ( static_cast (size()/10.0) - 50.0 ) / 2.0; + qreal k_growth = ( static_cast (growth()/10.0) - 176.0 ) / 6.0; qreal value = cell.getBase() + k_size*cell.getKsize() + k_growth*cell.getKgrowth(); return value; } @@ -365,7 +374,7 @@ QString VContainer::GetNameSplinePath(const VSplinePath &path) const{ QString VContainer::GetNameArc(const qint64 ¢er, const qint64 &id) const{ VPointF centerPoint = GetPoint(center); - return QString ("Arc(%1)%2").arg(centerPoint.name(), id); + return QString ("Arc(%1)%2").arg(centerPoint.name()).arg(id); } void VContainer::AddLengthLine(const QString &name, const qreal &value){ diff --git a/container/vcontainer.h b/container/vcontainer.h index c0c85411e..15431cf77 100644 --- a/container/vcontainer.h +++ b/container/vcontainer.h @@ -3,6 +3,7 @@ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Weffc++" +#pragma GCC diagnostic ignored "-Wconversion" #pragma GCC diagnostic ignored "-Wsign-conversion" #pragma GCC diagnostic ignored "-Wctor-dtor-privacy" #include @@ -36,7 +37,7 @@ public: VStandartTableCell GetStandartTableCell(const QString& name) const; VIncrementTableRow GetIncrementTableRow(const QString& name) const; qreal GetLine(const QString &name) const; - qint32 GetLineArc(const QString &name) const; + qreal GetLineArc(const QString &name) const; VSpline GetSpline(qint64 id) const; VArc GetArc(qint64 id) const; VSplinePath GetSplinePath(qint64 id) const; diff --git a/container/vincrementtablerow.cpp b/container/vincrementtablerow.cpp index 4861eb942..ae8fe4d62 100644 --- a/container/vincrementtablerow.cpp +++ b/container/vincrementtablerow.cpp @@ -1,20 +1,11 @@ #include "vincrementtablerow.h" -VIncrementTableRow::VIncrementTableRow(){ - this->id = 0; - this->base = 0; - this->ksize = 0; - this->kgrowth = 0; - this->description = QString(); +VIncrementTableRow::VIncrementTableRow():id(0), base(0), ksize(0), kgrowth(0), description(QString()){ } VIncrementTableRow::VIncrementTableRow(qint64 id, qreal base, qreal ksize, qreal kgrowth, - QString description){ - this->id = id; - this->base = base; - this->ksize = ksize; - this->kgrowth = kgrowth; - this->description = description; + QString description):id(id), base(base), ksize(ksize), + kgrowth(kgrowth), description(description){ } QString VIncrementTableRow::getDescription() const{ diff --git a/container/vincrementtablerow.h b/container/vincrementtablerow.h index 10012024e..c189d2adf 100644 --- a/container/vincrementtablerow.h +++ b/container/vincrementtablerow.h @@ -1,7 +1,10 @@ #ifndef VINCREMENTTABLEROW_H #define VINCREMENTTABLEROW_H +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Weffc++" #include +#pragma GCC diagnostic pop class VIncrementTableRow { diff --git a/container/vstandarttablecell.cpp b/container/vstandarttablecell.cpp index 1b28ec002..62c5a3dcd 100644 --- a/container/vstandarttablecell.cpp +++ b/container/vstandarttablecell.cpp @@ -1,17 +1,10 @@ #include "vstandarttablecell.h" -VStandartTableCell::VStandartTableCell(){ - base = 0; - ksize = 0; - kgrowth = 0; - description = QString(); +VStandartTableCell::VStandartTableCell():base(0), ksize(0), kgrowth(0), description(QString()){ } -VStandartTableCell::VStandartTableCell(qint32 base, qreal ksize, qreal kgrowth, QString description){ - this->base = base; - this->ksize = ksize; - this->kgrowth = kgrowth; - this->description = description; +VStandartTableCell::VStandartTableCell(qint32 base, qreal ksize, qreal kgrowth, QString description):base(base), + ksize(ksize), kgrowth(kgrowth), description(description){ } qint32 VStandartTableCell::GetBase() const{ diff --git a/container/vstandarttablecell.h b/container/vstandarttablecell.h index 6243bfa0a..d5c8d61dd 100644 --- a/container/vstandarttablecell.h +++ b/container/vstandarttablecell.h @@ -1,7 +1,13 @@ #ifndef VSTANDARTTABLECELL_H #define VSTANDARTTABLECELL_H +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Weffc++" +#pragma GCC diagnostic ignored "-Wconversion" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wctor-dtor-privacy" #include +#pragma GCC diagnostic pop class VStandartTableCell { diff --git a/dialogs/dialogalongline.cpp b/dialogs/dialogalongline.cpp index d9246715e..7d2e4b003 100644 --- a/dialogs/dialogalongline.cpp +++ b/dialogs/dialogalongline.cpp @@ -1,11 +1,13 @@ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Weffc++" #include "dialogalongline.h" #include "ui_dialogalongline.h" +#pragma GCC diagnostic pop DialogAlongLine::DialogAlongLine(const VContainer *data, QWidget *parent) : - DialogTool(data, parent), ui(new Ui::DialogAlongLine) -{ + DialogTool(data, parent), ui(new Ui::DialogAlongLine), number(0), pointName(QString()), + typeLine(QString()), formula(QString()), firstPointId(0), secondPointId(0){ ui->setupUi(this); - number = 0; listWidget = ui->listWidget; labelResultCalculation = ui->labelResultCalculation; labelDescription = ui->labelDescription; diff --git a/dialogs/dialogalongline.h b/dialogs/dialogalongline.h index b948e5538..cf030da8e 100644 --- a/dialogs/dialogalongline.h +++ b/dialogs/dialogalongline.h @@ -1,7 +1,10 @@ #ifndef DIALOGALONGLINE_H #define DIALOGALONGLINE_H +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Weffc++" #include "dialogtool.h" +#pragma GCC diagnostic pop #include "../options.h" #include "../container/vcontainer.h" #include "../container/calculator.h" @@ -37,6 +40,8 @@ private: QString formula; qint64 firstPointId; qint64 secondPointId; + DialogAlongLine(const DialogAlongLine &dialog); + const DialogAlongLine &operator=(const DialogAlongLine& dialog); }; #endif // DIALOGALONGLINE_H diff --git a/dialogs/dialogarc.cpp b/dialogs/dialogarc.cpp index b7d3e9dd6..f2f4a0634 100644 --- a/dialogs/dialogarc.cpp +++ b/dialogs/dialogarc.cpp @@ -3,12 +3,9 @@ #include "../container/calculator.h" DialogArc::DialogArc(const VContainer *data, QWidget *parent) : - DialogTool(data, parent), ui(new Ui::DialogArc) -{ + DialogTool(data, parent), ui(new Ui::DialogArc), flagRadius(false), flagF1(false), flagF2(false), + timerRadius(0), timerF1(0), timerF2(0), center(0), radius(QString()), f1(QString()), f2(QString()){ ui->setupUi(this); - flagRadius = false; - flagF1 = false; - flagF2 = false; timerRadius = new QTimer(this); connect(timerRadius, &QTimer::timeout, this, &DialogArc::EvalRadius); diff --git a/dialogs/dialogarc.h b/dialogs/dialogarc.h index e7e2f7d08..e18c033f4 100644 --- a/dialogs/dialogarc.h +++ b/dialogs/dialogarc.h @@ -55,6 +55,8 @@ private: void EvalF1(); void EvalF2(); void ShowLineArcs(); + DialogArc(const DialogArc &dialog); + const DialogArc &operator=(const DialogArc& dialog); }; #endif // DIALOGARC_H diff --git a/dialogs/dialogbisector.cpp b/dialogs/dialogbisector.cpp index 849ceb3d9..f285a11fe 100644 --- a/dialogs/dialogbisector.cpp +++ b/dialogs/dialogbisector.cpp @@ -2,10 +2,9 @@ #include "ui_dialogbisector.h" DialogBisector::DialogBisector(const VContainer *data, QWidget *parent) : - DialogTool(data, parent), ui(new Ui::DialogBisector) -{ + DialogTool(data, parent), ui(new Ui::DialogBisector), number(0), pointName(QString()), + typeLine(QString()), formula(QString()), firstPointId(0), secondPointId(0), thirdPointId(0){ ui->setupUi(this); - number = 0; listWidget = ui->listWidget; labelResultCalculation = ui->labelResultCalculation; labelDescription = ui->labelDescription; diff --git a/dialogs/dialogbisector.h b/dialogs/dialogbisector.h index 3aa542946..36d358533 100644 --- a/dialogs/dialogbisector.h +++ b/dialogs/dialogbisector.h @@ -45,6 +45,8 @@ private: qint64 firstPointId; qint64 secondPointId; qint64 thirdPointId; + DialogBisector(const DialogBisector &dialog); + const DialogBisector &operator=(const DialogBisector& dialog); }; #endif // DIALOGBISECTOR_H diff --git a/dialogs/dialogendline.cpp b/dialogs/dialogendline.cpp index 228885df3..5b7a0156e 100644 --- a/dialogs/dialogendline.cpp +++ b/dialogs/dialogendline.cpp @@ -1,14 +1,17 @@ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Weffc++" +#pragma GCC diagnostic ignored "-Wconversion" #include "dialogendline.h" #include "ui_dialogendline.h" #include #include - +#pragma GCC diagnostic pop #include "../container/vpointf.h" #include "../container/calculator.h" DialogEndLine::DialogEndLine(const VContainer *data, QWidget *parent) : - DialogTool(data, parent), ui(new Ui::DialogEndLine) -{ + DialogTool(data, parent), ui(new Ui::DialogEndLine), pointName(QString()), typeLine(QString()), + formula(QString()), angle(0), basePointId(0){ ui->setupUi(this); spinBoxAngle = ui->spinBoxAngle; listWidget = ui->listWidget; diff --git a/dialogs/dialogendline.h b/dialogs/dialogendline.h index e27e04c53..053715dd5 100644 --- a/dialogs/dialogendline.h +++ b/dialogs/dialogendline.h @@ -1,10 +1,13 @@ #ifndef DIALOGENDLINE_H #define DIALOGENDLINE_H +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Weffc++" #include "dialogtool.h" #include #include #include +#pragma GCC diagnostic pop #include "../options.h" #include "../container/vcontainer.h" @@ -40,6 +43,8 @@ private: QString formula; qint32 angle; qint64 basePointId; + DialogEndLine(const DialogEndLine &dialog); + const DialogEndLine &operator=(const DialogEndLine& dialog); }; #endif // DIALOGENDLINE_H diff --git a/dialogs/dialoghistory.h b/dialogs/dialoghistory.h index a702889e3..47b9254c0 100644 --- a/dialogs/dialoghistory.h +++ b/dialogs/dialoghistory.h @@ -36,6 +36,8 @@ private: QString Record(const VToolRecord &tool); void InitialTable(); void ShowPoint(); + DialogHistory(const DialogHistory &dialog); + const DialogHistory &operator=(const DialogHistory& dialog); }; #endif // DIALOGHISTORY_H diff --git a/dialogs/dialogincrements.cpp b/dialogs/dialogincrements.cpp index c0dcc0ad5..2d748ef9a 100644 --- a/dialogs/dialogincrements.cpp +++ b/dialogs/dialogincrements.cpp @@ -1,17 +1,17 @@ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Weffc++" #include "dialogincrements.h" #include "ui_dialogincrements.h" #include #include - -#include "../container/vincrementtablerow.h" #include "../widgets/delegate.h" #include "../widgets/doubledelegate.h" +#pragma GCC diagnostic pop +#include "../container/vincrementtablerow.h" DialogIncrements::DialogIncrements(VContainer *data, VDomDocument *doc, QWidget *parent) : - DialogTool(data, parent), ui(new Ui::DialogIncrements){ + DialogTool(data, parent), ui(new Ui::DialogIncrements), data(data), doc(doc){ ui->setupUi(this); - this->doc = doc; - this->data = data; InitialStandartTable(); InitialIncrementTable(); InitialLinesTable(); @@ -305,7 +305,7 @@ void DialogIncrements::clickedToolButtonRemove(){ &DialogIncrements::cellChanged); } -void DialogIncrements::AddIncrementToFile(quint64 id, QString name, qint32 base, qreal ksize, +void DialogIncrements::AddIncrementToFile(qint64 id, QString name, qint32 base, qreal ksize, qreal kgrowth, QString description){ QDomNodeList list = doc->elementsByTagName("increments"); QDomElement element = doc->createElement("increment"); diff --git a/dialogs/dialogincrements.h b/dialogs/dialogincrements.h index 209edb791..ca7d59130 100644 --- a/dialogs/dialogincrements.h +++ b/dialogs/dialogincrements.h @@ -1,11 +1,14 @@ #ifndef DIALOGINCREMENTS_H #define DIALOGINCREMENTS_H +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Weffc++" #include "dialogtool.h" #include - -#include "../container/vcontainer.h" #include "../xml/vdomdocument.h" +#pragma GCC diagnostic pop +#include "../container/vcontainer.h" + namespace Ui { class DialogIncrements; @@ -40,8 +43,10 @@ private: void FillLengthLines(); void FillLengthSplines(); void FillLengthArcs(); - void AddIncrementToFile(quint64 id, QString name, qint32 base, qreal ksize, qreal kgrowth, + void AddIncrementToFile(qint64 id, QString name, qint32 base, qreal ksize, qreal kgrowth, QString description); + DialogIncrements(const DialogIncrements &dialog); + const DialogIncrements &operator=(const DialogIncrements& dialog); }; #endif // DIALOGINCREMENTS_H diff --git a/dialogs/dialogline.cpp b/dialogs/dialogline.cpp index a62fbfbcd..82e86b326 100644 --- a/dialogs/dialogline.cpp +++ b/dialogs/dialogline.cpp @@ -1,11 +1,16 @@ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Weffc++" +#pragma GCC diagnostic ignored "-Wconversion" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wctor-dtor-privacy" #include "dialogline.h" #include "ui_dialogline.h" #include #include +#pragma GCC diagnostic pop DialogLine::DialogLine(const VContainer *data, QWidget *parent) : - DialogTool(data, parent), ui(new Ui::DialogLine) -{ + DialogTool(data, parent), ui(new Ui::DialogLine), number(0), firstPoint(0), secondPoint(0){ ui->setupUi(this); bOk = ui->buttonBox->button(QDialogButtonBox::Ok); connect(bOk, &QPushButton::clicked, this, &DialogLine::DialogAccepted); diff --git a/dialogs/dialogline.h b/dialogs/dialogline.h index ce02c7f66..c66a76b48 100644 --- a/dialogs/dialogline.h +++ b/dialogs/dialogline.h @@ -1,10 +1,17 @@ #ifndef DIALOGLINE_H #define DIALOGLINE_H +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Weffc++" +#pragma GCC diagnostic ignored "-Wconversion" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wctor-dtor-privacy" #include "dialogtool.h" +#include +#pragma GCC diagnostic pop #include "../container/vcontainer.h" #include "../options.h" -#include + namespace Ui { class DialogLine; @@ -28,6 +35,8 @@ private: qint32 number; qint64 firstPoint; qint64 secondPoint; + DialogLine(const DialogLine &dialog); + const DialogLine &operator=(const DialogLine& dialog); }; #endif // DIALOGLINE_H diff --git a/dialogs/dialoglineintersect.cpp b/dialogs/dialoglineintersect.cpp index f5fdae2dc..24fdba4c0 100644 --- a/dialogs/dialoglineintersect.cpp +++ b/dialogs/dialoglineintersect.cpp @@ -2,14 +2,13 @@ #include "ui_dialoglineintersect.h" DialogLineIntersect::DialogLineIntersect(const VContainer *data, QWidget *parent) : - DialogTool(data, parent), ui(new Ui::DialogLineIntersect) -{ + DialogTool(data, parent), ui(new Ui::DialogLineIntersect), number(0), pointName(QString()), p1Line1(0), + p2Line1(0), p1Line2(0), p2Line2(0), flagPoint(true){ ui->setupUi(this); number = 0; bOk = ui->buttonBox->button(QDialogButtonBox::Ok); connect(bOk, &QPushButton::clicked, this, &DialogLineIntersect::DialogAccepted); flagName = false; - flagPoint = true; QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel); connect(bCansel, &QPushButton::clicked, this, &DialogLineIntersect::DialogRejected); FillComboBoxPoints(ui->comboBoxP1Line1); diff --git a/dialogs/dialoglineintersect.h b/dialogs/dialoglineintersect.h index 6074e71b9..8a0ee23c2 100644 --- a/dialogs/dialoglineintersect.h +++ b/dialogs/dialoglineintersect.h @@ -41,6 +41,8 @@ private: bool flagPoint; virtual void CheckState(); bool CheckIntersecion(); + DialogLineIntersect(const DialogLineIntersect &dialog); + const DialogLineIntersect &operator=(const DialogLineIntersect& dialog); }; #endif // DIALOGLINEINTERSECT_H diff --git a/dialogs/dialognormal.cpp b/dialogs/dialognormal.cpp index b2268c726..ccabc8007 100644 --- a/dialogs/dialognormal.cpp +++ b/dialogs/dialognormal.cpp @@ -3,10 +3,9 @@ #include DialogNormal::DialogNormal(const VContainer *data, QWidget *parent) : - DialogTool(data, parent), ui(new Ui::DialogNormal) -{ + DialogTool(data, parent), ui(new Ui::DialogNormal), number(0), pointName(QString()), typeLine(QString()), + formula(QString()), angle(0), firstPointId(0), secondPointId(0){ ui->setupUi(this); - number = 0; spinBoxAngle = ui->spinBoxAngle; listWidget = ui->listWidget; labelResultCalculation = ui->labelResultCalculation; diff --git a/dialogs/dialognormal.h b/dialogs/dialognormal.h index 840650dca..e98837705 100644 --- a/dialogs/dialognormal.h +++ b/dialogs/dialognormal.h @@ -44,6 +44,8 @@ private: qint32 angle; qint64 firstPointId; qint64 secondPointId; + DialogNormal(const DialogNormal &dialog); + const DialogNormal &operator=(const DialogNormal& dialog); }; #endif // DIALOGNORMAL_H diff --git a/dialogs/dialogshoulderpoint.cpp b/dialogs/dialogshoulderpoint.cpp index a522b3a72..3d40e65fa 100644 --- a/dialogs/dialogshoulderpoint.cpp +++ b/dialogs/dialogshoulderpoint.cpp @@ -2,8 +2,8 @@ #include "ui_dialogshoulderpoint.h" DialogShoulderPoint::DialogShoulderPoint(const VContainer *data, QWidget *parent) : - DialogTool(data, parent), ui(new Ui::DialogShoulderPoint) -{ + DialogTool(data, parent), ui(new Ui::DialogShoulderPoint), number(0), pointName(QString()), + typeLine(QString()), formula(QString()), p1Line(0), p2Line(0), pShoulder(0){ ui->setupUi(this); number = 0; listWidget = ui->listWidget; diff --git a/dialogs/dialogshoulderpoint.h b/dialogs/dialogshoulderpoint.h index b9408b994..2104dc17c 100644 --- a/dialogs/dialogshoulderpoint.h +++ b/dialogs/dialogshoulderpoint.h @@ -40,6 +40,8 @@ private: qint64 p1Line; qint64 p2Line; qint64 pShoulder; + DialogShoulderPoint(const DialogShoulderPoint &dialog); + const DialogShoulderPoint &operator=(const DialogShoulderPoint& dialog); }; #endif // DIALOGSHOULDERPOINT_H diff --git a/dialogs/dialogsinglepoint.cpp b/dialogs/dialogsinglepoint.cpp index 605f7bc14..46bb916ef 100644 --- a/dialogs/dialogsinglepoint.cpp +++ b/dialogs/dialogsinglepoint.cpp @@ -1,15 +1,18 @@ +#pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Weffc++" +#pragma GCC diagnostic ignored "-Wconversion" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wctor-dtor-privacy" #include "dialogsinglepoint.h" #include "ui_dialogsinglepoint.h" #include #include #include -#pragma GCC diagnostic warning "-Weffc++" +#pragma GCC diagnostic pop #include "../options.h" DialogSinglePoint::DialogSinglePoint(const VContainer *data, QWidget *parent) : - DialogTool(data, parent), ui(new Ui::DialogSinglePoint) -{ + DialogTool(data, parent), ui(new Ui::DialogSinglePoint), name(QString()), point(QPointF()){ ui->setupUi(this); ui->doubleSpinBoxX->setRange(0,PaperSize/PrintDPI*25.4); ui->doubleSpinBoxY->setRange(0,PaperSize/PrintDPI*25.4); diff --git a/dialogs/dialogsinglepoint.h b/dialogs/dialogsinglepoint.h index 9a2ea3478..ca43e3db2 100644 --- a/dialogs/dialogsinglepoint.h +++ b/dialogs/dialogsinglepoint.h @@ -26,6 +26,8 @@ private: Ui::DialogSinglePoint *ui; QString name; QPointF point; + DialogSinglePoint(const DialogSinglePoint &dialog); + const DialogSinglePoint &operator=(const DialogSinglePoint& dialog); }; #endif // DIALOGSINGLEPOINT_H diff --git a/dialogs/dialogspline.cpp b/dialogs/dialogspline.cpp index b9e58229f..d8b592017 100644 --- a/dialogs/dialogspline.cpp +++ b/dialogs/dialogspline.cpp @@ -2,10 +2,9 @@ #include "ui_dialogspline.h" DialogSpline::DialogSpline(const VContainer *data, QWidget *parent) : - DialogTool(data, parent), ui(new Ui::DialogSpline) -{ + DialogTool(data, parent), ui(new Ui::DialogSpline), number(0), p1(0), p4(0), angle1(0), angle2(0), + kAsm1(1), kAsm2(1), kCurve(1){ ui->setupUi(this); - number = 0; bOk = ui->buttonBox->button(QDialogButtonBox::Ok); connect(bOk, &QPushButton::clicked, this, &DialogSpline::DialogAccepted); @@ -40,8 +39,8 @@ void DialogSpline::ChoosedObject(qint64 id, Scene::Type type){ qint64 p1Id = qvariant_cast(ui->comboBoxP1->itemData(index)); QPointF p1 = data->GetPoint(p1Id).toQPointF(); QPointF p4 = data->GetPoint(id).toQPointF(); - ui->spinBoxAngle1->setValue(QLineF(p1, p4).angle()); - ui->spinBoxAngle2->setValue(QLineF(p4, p1).angle()); + ui->spinBoxAngle1->setValue(static_cast(QLineF(p1, p4).angle())); + ui->spinBoxAngle2->setValue(static_cast(QLineF(p4, p1).angle())); } if(!isInitialized){ this->show(); @@ -94,7 +93,7 @@ qreal DialogSpline::getAngle2() const{ void DialogSpline::setAngle2(const qreal &value){ angle2 = value; - ui->spinBoxAngle2->setValue(value); + ui->spinBoxAngle2->setValue(static_cast(value)); } qreal DialogSpline::getAngle1() const{ @@ -103,7 +102,7 @@ qreal DialogSpline::getAngle1() const{ void DialogSpline::setAngle1(const qreal &value){ angle1 = value; - ui->spinBoxAngle1->setValue(value); + ui->spinBoxAngle1->setValue(static_cast(value)); } qint64 DialogSpline::getP4() const{ diff --git a/dialogs/dialogspline.h b/dialogs/dialogspline.h index 10c4f4c61..08bf69f48 100644 --- a/dialogs/dialogspline.h +++ b/dialogs/dialogspline.h @@ -41,6 +41,8 @@ private: qreal kAsm1; qreal kAsm2; qreal kCurve; + DialogSpline(const DialogSpline &dialog); + const DialogSpline &operator=(const DialogSpline& dialog); }; #endif // DIALOGSPLINE_H diff --git a/dialogs/dialogsplinepath.cpp b/dialogs/dialogsplinepath.cpp index 88f55b999..e727d6001 100644 --- a/dialogs/dialogsplinepath.cpp +++ b/dialogs/dialogsplinepath.cpp @@ -1,10 +1,15 @@ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Weffc++" +#pragma GCC diagnostic ignored "-Wconversion" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wctor-dtor-privacy" #include "dialogsplinepath.h" #include "ui_dialogsplinepath.h" +#pragma GCC diagnostic pop #include "../geometry/vsplinepoint.h" DialogSplinePath::DialogSplinePath(const VContainer *data, QWidget *parent) : - DialogTool(data, parent), ui(new Ui::DialogSplinePath) -{ + DialogTool(data, parent), ui(new Ui::DialogSplinePath), path(VSplinePath()){ ui->setupUi(this); bOk = ui->buttonBox->button(QDialogButtonBox::Ok); connect(bOk, &QPushButton::clicked, this, &DialogSplinePath::DialogAccepted); @@ -136,8 +141,8 @@ void DialogSplinePath::DataPoint(qint64 id, qreal kAsm1, qreal angle1, qreal kAs ChangeCurrentData(ui->comboBoxPoint, id); ui->doubleSpinBoxKasm1->setValue(kAsm1); ui->doubleSpinBoxKasm2->setValue(kAsm2); - ui->spinBoxAngle2->setValue(angle2); - ui->spinBoxAngle1->setValue(angle1); + ui->spinBoxAngle2->setValue(static_cast(angle2)); + ui->spinBoxAngle1->setValue(static_cast(angle1)); connect(ui->comboBoxPoint, static_cast(&QComboBox::currentIndexChanged), this, &DialogSplinePath::currentPointChanged); diff --git a/dialogs/dialogsplinepath.h b/dialogs/dialogsplinepath.h index 607cbfe3e..dc25703df 100644 --- a/dialogs/dialogsplinepath.h +++ b/dialogs/dialogsplinepath.h @@ -1,7 +1,13 @@ #ifndef DIALOGSPLINEPATH_H #define DIALOGSPLINEPATH_H +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Weffc++" +#pragma GCC diagnostic ignored "-Wconversion" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wctor-dtor-privacy" #include "dialogtool.h" +#pragma GCC diagnostic pop #include "../container/vcontainer.h" #include "../geometry/vsplinepath.h" @@ -33,6 +39,8 @@ private: void DataPoint(qint64 id, qreal kAsm1, qreal angle1, qreal kAsm2, qreal angle2); void EnableFields(); void SetAngle(qint32 angle); + DialogSplinePath(const DialogSplinePath &dialog); + const DialogSplinePath &operator=(const DialogSplinePath& dialog); }; #endif // DIALOGSPLINEPATH_H diff --git a/dialogs/dialogtool.cpp b/dialogs/dialogtool.cpp index ade74c187..cef2855d5 100644 --- a/dialogs/dialogtool.cpp +++ b/dialogs/dialogtool.cpp @@ -1,27 +1,21 @@ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Weffc++" +#pragma GCC diagnostic ignored "-Wconversion" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wctor-dtor-privacy" #include "dialogtool.h" #include #include +#pragma GCC diagnostic pop #include "../container/calculator.h" -DialogTool::DialogTool(const VContainer *data, QWidget *parent):QDialog(parent){ +DialogTool::DialogTool(const VContainer *data, QWidget *parent):QDialog(parent), data(data), + isInitialized(false), flagName(true), flagFormula(true), timerFormula(0), bOk(0), spinBoxAngle(0), + lineEditFormula(0), listWidget(0), labelResultCalculation(0), labelDescription(0), radioButtonSizeGrowth(0), + radioButtonStandartTable(0), radioButtonIncrements(0), radioButtonLengthLine(0){ Q_CHECK_PTR(data); - this->data = data; - flagName = true; - flagFormula = true; timerFormula = new QTimer(this); connect(timerFormula, &QTimer::timeout, this, &DialogTool::EvalFormula); - isInitialized = false; - - bOk = 0; - spinBoxAngle = 0; - lineEditFormula = 0; - listWidget = 0; - labelResultCalculation = 0; - labelDescription = 0; - radioButtonSizeGrowth = 0; - radioButtonStandartTable = 0; - radioButtonIncrements = 0; - radioButtonLengthLine = 0; } DialogTool::~DialogTool(){ @@ -329,7 +323,7 @@ void DialogTool::UpdateList(){ } } -export template +template void DialogTool::ShowVariable(const QMap *var){ Q_CHECK_PTR(listWidget); disconnect(listWidget, &QListWidget::currentRowChanged, this, &DialogTool::ValChenged); diff --git a/dialogs/dialogtool.h b/dialogs/dialogtool.h index 1e57cb6fe..9fab4f33b 100644 --- a/dialogs/dialogtool.h +++ b/dialogs/dialogtool.h @@ -1,7 +1,11 @@ #ifndef DIALOGTOOL_H #define DIALOGTOOL_H +#pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Weffc++" +#pragma GCC diagnostic ignored "-Wconversion" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wctor-dtor-privacy" #include #include #include @@ -11,7 +15,7 @@ #include #include #include -#pragma GCC diagnostic warning "-Weffc++" +#pragma GCC diagnostic pop #include "../container/vcontainer.h" #include "../options.h" @@ -77,6 +81,8 @@ protected: void Eval(QLineEdit *edit, bool &flag, QTimer *timer, QLabel *label); void setCurrentPointId(QComboBox *box, qint64 &pointId, const qint64 &value, const qint64 &id) const; qint64 getCurrentPointId(QComboBox *box) const; + DialogTool(const DialogTool &dialog); + const DialogTool &operator=(const DialogTool &dialog); }; #endif // DIALOGTOOL_H diff --git a/geometry/vspline.cpp b/geometry/vspline.cpp index 4baa420b9..eb6866e0d 100644 --- a/geometry/vspline.cpp +++ b/geometry/vspline.cpp @@ -3,41 +3,24 @@ #include "vspline.h" #include -VSpline::VSpline(){ - p1 = 0; - p2 = QPointF(); - p3 = QPointF(); - p4 = 0; - angle1 = 0; - angle2 = 0; - points = 0; - kAsm1 = 1; - kAsm2 = 1; - kCurve = 1; +VSpline::VSpline():p1(0), p2(QPointF()), p3(QPointF()), p4(0), angle1(0), angle2(0), kAsm1(1), kAsm2(1), + kCurve(1), points(0){ } -VSpline::VSpline ( const VSpline & spline ){ - p1 = spline.GetP1 (); - p2 = spline.GetP2 (); - p3 = spline.GetP3 (); - p4 = spline.GetP4 (); - angle1 = spline.GetAngle1 (); - angle2 = spline.GetAngle2 (); - points = spline.GetDataPoints(); - kAsm1 = spline.GetKasm1(); - kAsm2 = spline.GetKasm2(); - kCurve = spline.GetKcurve(); +VSpline::VSpline ( const VSpline & spline ):p1(spline.GetP1 ()), p2(spline.GetP2 ()), p3(spline.GetP3 ()), + p4(spline.GetP4 ()), angle1(spline.GetAngle1 ()), angle2(spline.GetAngle2 ()), kAsm1(spline.GetKasm1()), + kAsm2(spline.GetKasm2()), kCurve(spline.GetKcurve()), points(spline.GetDataPoints()){ } VSpline::VSpline (const QMap *points, qint64 p1, qint64 p4, qreal angle1, qreal angle2, - qreal kAsm1, qreal kAsm2 , qreal kCurve){ - this->points = points; + qreal kAsm1, qreal kAsm2 , qreal kCurve):p1(p1), p2(QPointF()), p3(QPointF()), + p4(p4), angle1(angle1), angle2(angle2), kAsm1(kAsm1), kAsm2(kAsm2), kCurve(kCurve), points(points){ ModifiSpl ( p1, p4, angle1, angle2, kAsm1, kAsm2, kCurve ); } VSpline::VSpline (const QMap *points, qint64 p1, QPointF p2, QPointF p3, qint64 p4, - qreal kCurve){ - this->points = points; + qreal kCurve):p1(p1), p2(p2), p3(p3), p4(p4), angle1(0), angle2(0), kAsm1(1), kAsm2(1), + kCurve(1), points(points){ ModifiSpl ( p1, p2, p3, p4, kCurve); } @@ -308,7 +291,7 @@ qreal VSpline::LengthBezier ( QPointF p1, QPointF p2, QPointF p3, QPointF p4 ) c py.append ( p4.y () ); qint32 i = 0; qreal length = 0.0; - /* + * * Наприклад маємо 10 точок. Від 0 до 9 і останню точку не опрацьовуємо. * Тому від 0 до 8(<10-1). * @@ -368,8 +351,8 @@ void VSpline::PointBezier_r ( qreal x1, qreal y1, qreal x2, qreal y2, double d3 = fabs(((x3 - x4) * dy - (y3 - y4) * dx)); double da1, da2, k; - switch(((int)(d2 > curve_collinearity_epsilon) << 1) + - (int)(d3 > curve_collinearity_epsilon)) + switch((static_cast(d2 > curve_collinearity_epsilon) << 1) + + static_cast(d3 > curve_collinearity_epsilon)) { case 0: // All collinear OR p1==p4 @@ -583,8 +566,8 @@ void VSpline::PointBezier_r ( qreal x1, qreal y1, qreal x2, qreal y2, // Continue subdivision //---------------------- - PointBezier_r(x1, y1, x12, y12, x123, y123, x1234, y1234, level + 1, px, py); - PointBezier_r(x1234, y1234, x234, y234, x34, y34, x4, y4, level + 1, px, py); + PointBezier_r(x1, y1, x12, y12, x123, y123, x1234, y1234, static_cast(level + 1), px, py); + PointBezier_r(x1234, y1234, x234, y234, x34, y34, x4, y4, static_cast(level + 1), px, py); } qreal VSpline::CalcSqDistance (qreal x1, qreal y1, qreal x2, qreal y2) const{ @@ -662,7 +645,7 @@ qreal VSpline::calc_t (qreal curve_coord1, qreal curve_coord2, qreal curve_coord qreal P1, P2, P3, P4, Bt; qreal a, b, c, d, ret_t; - qreal *t = (qreal *)malloc(3*sizeof(qreal)); + qreal *t = static_cast(malloc(3*sizeof(qreal))); P1 = curve_coord1; P2 = curve_coord2; P3 = curve_coord3; diff --git a/geometry/vsplinepath.cpp b/geometry/vsplinepath.cpp index 195b7b7a5..6d5fcc03c 100644 --- a/geometry/vsplinepath.cpp +++ b/geometry/vsplinepath.cpp @@ -1,13 +1,14 @@ #include "vsplinepath.h" -VSplinePath::VSplinePath(){ - points = 0; - kCurve = 1; +VSplinePath::VSplinePath(): path(QVector()), kCurve(1), points(0){ } -VSplinePath::VSplinePath(const QMap *points, qreal kCurve){ - this->points = points; - this->kCurve = kCurve; +VSplinePath::VSplinePath(const QMap *points, qreal kCurve): path(QVector()), + kCurve(kCurve), points(points){ +} + +VSplinePath::VSplinePath(const VSplinePath &splPath): path(*splPath.GetPoint()), + kCurve(splPath.getKCurve()), points( splPath.GetDataPoints()){ } void VSplinePath::append(VSplinePoint point){ diff --git a/geometry/vsplinepath.h b/geometry/vsplinepath.h index b3402eb82..71e77d188 100644 --- a/geometry/vsplinepath.h +++ b/geometry/vsplinepath.h @@ -28,6 +28,7 @@ public: * @brief VSplinePath конструктор по замовчуванню. */ VSplinePath(const QMap *points, qreal kCurve = 1); + VSplinePath(const VSplinePath& splPath); /** * @brief append додає точку сплайну до шляху. * @param point точка. diff --git a/geometry/vsplinepoint.cpp b/geometry/vsplinepoint.cpp index 26560f096..fb1b5e476 100644 --- a/geometry/vsplinepoint.cpp +++ b/geometry/vsplinepoint.cpp @@ -1,24 +1,14 @@ #include "vsplinepoint.h" -VSplinePoint::VSplinePoint(){ - this->pSpline = 0; - this->angle = 0; - this->kAsm1 = 1; - this->kAsm2 = 1; +VSplinePoint::VSplinePoint():pSpline(0), angle(0), kAsm1(1), kAsm2(1){ } -VSplinePoint::VSplinePoint(qint64 pSpline, qreal kAsm1, qreal angle , qreal kAsm2){ - this->pSpline = pSpline; - this->angle = angle; - this->kAsm1 = kAsm1; - this->kAsm2 = kAsm2; +VSplinePoint::VSplinePoint(qint64 pSpline, qreal kAsm1, qreal angle , qreal kAsm2):pSpline(pSpline), + angle(angle), kAsm1(kAsm1), kAsm2(kAsm2){ } -VSplinePoint::VSplinePoint(const VSplinePoint &point){ - this->pSpline = point.P(); - this->angle = point.Angle2(); - this->kAsm1 = point.KAsm1(); - this->kAsm2 = point.KAsm2(); +VSplinePoint::VSplinePoint(const VSplinePoint &point):pSpline(point.P()), angle(point.Angle2()), + kAsm1(point.KAsm1()), kAsm2(point.KAsm2()){ } VSplinePoint::~VSplinePoint(){ diff --git a/main.cpp b/main.cpp index c51badbb9..bca09f559 100644 --- a/main.cpp +++ b/main.cpp @@ -1,8 +1,9 @@ +#pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Weffc++" #include "mainwindow.h" #include #include -#pragma GCC diagnostic warning "-Weffc++" +#pragma GCC diagnostic pop void myMessageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg){ QByteArray localMsg = msg.toLocal8Bit(); diff --git a/mainwindow.cpp b/mainwindow.cpp index 1144ce2cb..3d00cf6d4 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -1,4 +1,8 @@ +#pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Weffc++" +#pragma GCC diagnostic ignored "-Wconversion" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wctor-dtor-privacy" #include "mainwindow.h" #include "ui_mainwindow.h" #include @@ -9,7 +13,6 @@ #include #include #include - #include "tools/vtoolendline.h" #include "tools/vtoolline.h" #include "tools/vtoolalongline.h" @@ -20,15 +23,21 @@ #include "tools/vtoolspline.h" #include "tools/vtoolarc.h" #include "tools/vtoolsplinepath.h" -#pragma GCC diagnostic warning "-Weffc++" +#pragma GCC diagnostic pop #include "geometry/vspline.h" MainWindow::MainWindow(QWidget *parent) : - QMainWindow(parent), ui(new Ui::MainWindow) -{ + QMainWindow(parent), ui(new Ui::MainWindow), tool(Tools::ArrowTool), scene(0), mouseCoordinate(0), + helpLabel(0), view(0), isInitialized(false), dialogTable(0), + dialogEndLine(QSharedPointer()), dialogLine(QSharedPointer()), + dialogAlongLine(QSharedPointer()), + dialogShoulderPoint(QSharedPointer()), dialogNormal(QSharedPointer()), + dialogBisector(QSharedPointer()), + dialogLineIntersect(QSharedPointer()), + dialogSpline(QSharedPointer()), + dialogArc(QSharedPointer()), dialogSplinePath(QSharedPointer()), + dialogHistory(0), doc(0), data(0), comboBoxDraws(0), fileName(QString()), changeInFile(false){ ui->setupUi(this); - tool = Tools::ArrowTool; - isInitialized = false; ToolBarOption(); ToolBarDraws(); QRectF sceneRect = QRectF(0, 0, PaperSize, PaperSize); diff --git a/mainwindow.h b/mainwindow.h index e504ea8bd..5a205eb48 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -1,7 +1,12 @@ #ifndef MAINWINDOW_H #define MAINWINDOW_H +#pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Weffc++" +#pragma GCC diagnostic ignored "-Wold-style-cast" +#pragma GCC diagnostic ignored "-Wconversion" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wctor-dtor-privacy" #include #include #include @@ -9,7 +14,6 @@ #include #include #include - #include "widgets/vmaingraphicsscene.h" #include "widgets/vmaingraphicsview.h" #include "dialogs/dialogincrements.h" @@ -26,7 +30,7 @@ #include "dialogs/dialoghistory.h" #include "tools/vtoolsinglepoint.h" #include "xml/vdomdocument.h" -#pragma GCC diagnostic warning "-Weffc++" +#pragma GCC diagnostic pop #include "container/vcontainer.h" #include "options.h" @@ -107,6 +111,8 @@ private: QComboBox *comboBoxDraws; QString fileName; bool changeInFile; + MainWindow(const MainWindow &window); + const MainWindow &operator=(const MainWindow &window); void ToolBarOption(); void ToolBarDraws(); void CanselTool(); diff --git a/tools/vabstracttool.cpp b/tools/vabstracttool.cpp index c3841774a..143c0a522 100644 --- a/tools/vabstracttool.cpp +++ b/tools/vabstracttool.cpp @@ -1,10 +1,15 @@ +#pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Weffc++" +#pragma GCC diagnostic ignored "-Wconversion" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wctor-dtor-privacy" #include "vabstracttool.h" #include #pragma GCC diagnostic pop VAbstractTool::VAbstractTool(VDomDocument *doc, VContainer *data, qint64 id, QObject *parent): - VDataTool(data, parent), baseColor(Qt::black), currentColor(Qt::black){ + VDataTool(data, parent), doc(doc), id(id), ignoreContextMenuEvent(false), nameActivDraw(QString()), + baseColor(Qt::black), currentColor(Qt::black){ this->doc = doc; this->id = id; nameActivDraw = doc->GetNameActivDraw(); @@ -95,6 +100,9 @@ void VAbstractTool::setData(const VContainer &value){ data = value; } +void VAbstractTool::RemoveDataTool(){ +} + void VAbstractTool::setDialog(){ } diff --git a/tools/vabstracttool.h b/tools/vabstracttool.h index 43c4f49bc..1020dc15b 100644 --- a/tools/vabstracttool.h +++ b/tools/vabstracttool.h @@ -1,11 +1,15 @@ #ifndef VABSTRACTTOOL_H #define VABSTRACTTOOL_H +#pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Weffc++" +#pragma GCC diagnostic ignored "-Wconversion" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wctor-dtor-privacy" #include #include "../xml/vdomdocument.h" #include "vdatatool.h" -#pragma GCC diagnostic warning "-Weffc++" +#pragma GCC diagnostic pop #include "../container/vcontainer.h" namespace Tool{ @@ -34,6 +38,7 @@ signals: void toolhaveChange(); void ChoosedTool(qint64 id, Scene::Type type); void FullUpdateTree(); + void RemoveTool(QGraphicsItem *tool); protected: VDomDocument *doc; qint64 id; @@ -49,11 +54,17 @@ protected: void AddToCalculation(const QDomElement &domElement); const VContainer *getData() const; void setData(const VContainer &value); + virtual void RemoveDataTool(); template - void ContextMenu(QSharedPointer &dialog, Tool *tool, QGraphicsSceneContextMenuEvent *event){ + void ContextMenu(QSharedPointer &dialog, Tool *tool, QGraphicsSceneContextMenuEvent *event, + bool showRemove = true){ if(!ignoreContextMenuEvent){ QMenu menu; QAction *actionOption = menu.addAction("Властивості"); + QAction *actionRemove; + if(showRemove){ + actionRemove = menu.addAction("Видалити"); + } QAction *selectedAction = menu.exec(event->screenPos()); if(selectedAction == actionOption){ dialog = QSharedPointer(new Dialog(getData())); @@ -68,7 +79,26 @@ protected: dialog->show(); } + if(selectedAction == actionRemove){ + RemoveDataTool();//remove form data + //remove form xml file + QDomElement domElement = doc->elementById(QString().setNum(id)); + if(domElement.isElement()){ + QDomElement calcElement; + bool ok = doc->GetActivCalculationElement(calcElement); + if(ok){ + calcElement.removeChild(domElement); + //update xml file + emit FullUpdateTree(); + //remove form scene + emit RemoveTool(tool); + } + } + } } } +private: + VAbstractTool(const VAbstractTool &tool); + const VAbstractTool &operator=(const VAbstractTool &tool); }; #endif // VABSTRACTTOOL_H diff --git a/tools/vdatatool.cpp b/tools/vdatatool.cpp index 9484d9b60..ed9de74e9 100644 --- a/tools/vdatatool.cpp +++ b/tools/vdatatool.cpp @@ -1,10 +1,10 @@ +#pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Weffc++" #include "vdatatool.h" -#pragma GCC diagnostic warning "-Weffc++" +#pragma GCC diagnostic pop VDataTool::VDataTool(VContainer *data, QObject *parent) : - QObject(parent){ - this->data = *data; + QObject(parent), data(*data){ } VDataTool::~VDataTool(){ @@ -12,6 +12,7 @@ VDataTool::~VDataTool(){ const VDataTool &VDataTool::operator =(const VDataTool &tool){ data = tool.getData(); + return *this; } VContainer VDataTool::getData() const{ diff --git a/tools/vdatatool.h b/tools/vdatatool.h index 25a867b3d..22ef9cdf9 100644 --- a/tools/vdatatool.h +++ b/tools/vdatatool.h @@ -1,9 +1,10 @@ #ifndef VDATATOOL_H #define VDATATOOL_H +#pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Weffc++" #include -#pragma GCC diagnostic warning "-Weffc++" +#pragma GCC diagnostic pop #include "../container/vcontainer.h" class VDataTool : public QObject diff --git a/tools/vtoolalongline.cpp b/tools/vtoolalongline.cpp index 09651c8d6..ba7dcc96f 100644 --- a/tools/vtoolalongline.cpp +++ b/tools/vtoolalongline.cpp @@ -1,15 +1,18 @@ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Weffc++" #include "vtoolalongline.h" -#include "../container/calculator.h" #include #include #include +#pragma GCC diagnostic pop +#include "../container/calculator.h" VToolAlongLine::VToolAlongLine(VDomDocument *doc, VContainer *data, qint64 id, const QString &formula, const qint64 &firstPointId, const qint64 &secondPointId, const QString &typeLine, Tool::Enum typeCreation, QGraphicsItem *parent): - VToolLinePoint(doc, data, id, typeLine, formula, firstPointId, 0, parent){ - this->secondPointId = secondPointId; + VToolLinePoint(doc, data, id, typeLine, formula, firstPointId, 0, parent), secondPointId(secondPointId), + dialogAlongLine(QSharedPointer()){ if(typeCreation == Tool::FromGui){ AddToFile(); @@ -120,6 +123,7 @@ void VToolAlongLine::Create(const qint64 _id, const QString &pointName, const QS secondPointId, typeLine, typeCreation); scene->addItem(point); connect(point, &VToolAlongLine::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); + connect(point, &VToolAlongLine::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); QMap* tools = doc->getTools(); tools->insert(id,point); diff --git a/tools/vtoolalongline.h b/tools/vtoolalongline.h index b920ef242..561642101 100644 --- a/tools/vtoolalongline.h +++ b/tools/vtoolalongline.h @@ -1,8 +1,11 @@ #ifndef VTOOLALONGLINE_H #define VTOOLALONGLINE_H +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Weffc++" #include "vtoollinepoint.h" #include "../dialogs/dialogalongline.h" +#pragma GCC diagnostic pop class VToolAlongLine : public VToolLinePoint { diff --git a/tools/vtoolarc.cpp b/tools/vtoolarc.cpp index f064ee67c..9ac71bbaf 100644 --- a/tools/vtoolarc.cpp +++ b/tools/vtoolarc.cpp @@ -1,9 +1,16 @@ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Weffc++" +#pragma GCC diagnostic ignored "-Wconversion" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wctor-dtor-privacy" #include "vtoolarc.h" #include +#pragma GCC diagnostic pop #include "../container/calculator.h" VToolArc::VToolArc(VDomDocument *doc, VContainer *data, qint64 id, Tool::Enum typeCreation, - QGraphicsItem *parent):VAbstractTool(doc, data, id), QGraphicsPathItem(parent){ + QGraphicsItem *parent):VAbstractTool(doc, data, id), QGraphicsPathItem(parent), + dialogArc(QSharedPointer()){ VArc arc = data->GetArc(id); QPainterPath path; path.addPath(arc.GetPath()); @@ -81,6 +88,7 @@ void VToolArc::Create(const qint64 _id, const qint64 ¢er, const QString &rad VToolArc *toolArc = new VToolArc(doc, data, id, typeCreation); scene->addItem(toolArc); connect(toolArc, &VToolArc::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); + connect(toolArc, &VToolArc::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); QMap* tools = doc->getTools(); tools->insert(id,toolArc); } diff --git a/tools/vtoolarc.h b/tools/vtoolarc.h index a9509f464..3528f8c5d 100644 --- a/tools/vtoolarc.h +++ b/tools/vtoolarc.h @@ -1,12 +1,18 @@ #ifndef VTOOLARC_H #define VTOOLARC_H +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Weffc++" +#pragma GCC diagnostic ignored "-Wconversion" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wctor-dtor-privacy" #include "vabstracttool.h" -#include "../container/vcontainer.h" #include "../xml/vdomdocument.h" #include #include "../dialogs/dialogarc.h" #include "../widgets/vcontrolpointspline.h" +#pragma GCC diagnostic pop +#include "../container/vcontainer.h" class VToolArc :public VAbstractTool, public QGraphicsPathItem { diff --git a/tools/vtoolbisector.cpp b/tools/vtoolbisector.cpp index 220c32582..568789d37 100644 --- a/tools/vtoolbisector.cpp +++ b/tools/vtoolbisector.cpp @@ -6,7 +6,8 @@ VToolBisector::VToolBisector(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, const QString &formula, const qint64 &firstPointId, const qint64 &secondPointId, const qint64 &thirdPointId, Tool::Enum typeCreation, QGraphicsItem *parent): - VToolLinePoint(doc, data, id, typeLine, formula, secondPointId, 0, parent){ + VToolLinePoint(doc, data, id, typeLine, formula, secondPointId, 0, parent), firstPointId(0), + thirdPointId(0), dialogBisector(QSharedPointer()){ this->firstPointId = firstPointId; this->thirdPointId = thirdPointId; @@ -88,6 +89,7 @@ void VToolBisector::Create(const qint64 _id, const QString &formula, const qint6 typeCreation); scene->addItem(point); connect(point, &VToolBisector::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); + connect(point, &VToolBisector::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); QMap* tools = doc->getTools(); tools->insert(id,point); } diff --git a/tools/vtoolendline.cpp b/tools/vtoolendline.cpp index 6a0e0c723..174cd0404 100644 --- a/tools/vtoolendline.cpp +++ b/tools/vtoolendline.cpp @@ -1,13 +1,16 @@ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Weffc++" #include "vtoolendline.h" #include #include - #include "../widgets/vmaingraphicsscene.h" +#pragma GCC diagnostic pop VToolEndLine::VToolEndLine(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, const QString &formula, const qint32 &angle, const qint64 &basePointId, Tool::Enum typeCreation, QGraphicsItem *parent): - VToolLinePoint(doc, data, id, typeLine, formula, basePointId, angle, parent){ + VToolLinePoint(doc, data, id, typeLine, formula, basePointId, angle, parent), + dialogEndLine(QSharedPointer()){ if(typeCreation == Tool::FromGui){ AddToFile(); @@ -69,6 +72,7 @@ void VToolEndLine::Create(const qint64 _id, const QString &pointName, const QStr basePointId, typeCreation); scene->addItem(point); connect(point, &VToolPoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); + connect(point, &VToolPoint::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); QMap* tools = doc->getTools(); tools->insert(id,point); } diff --git a/tools/vtoolendline.h b/tools/vtoolendline.h index 785a32139..ea71fd3f5 100644 --- a/tools/vtoolendline.h +++ b/tools/vtoolendline.h @@ -1,10 +1,12 @@ #ifndef VTOOLENDLINE_H #define VTOOLENDLINE_H +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Weffc++" #include - #include "vtoollinepoint.h" #include "../dialogs/dialogendline.h" +#pragma GCC diagnostic pop class VToolEndLine : public VToolLinePoint { diff --git a/tools/vtoolline.cpp b/tools/vtoolline.cpp index 5abe6f6cf..0d3468496 100644 --- a/tools/vtoolline.cpp +++ b/tools/vtoolline.cpp @@ -1,13 +1,17 @@ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Weffc++" +#pragma GCC diagnostic ignored "-Wconversion" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wctor-dtor-privacy" #include "vtoolline.h" #include #include +#pragma GCC diagnostic pop VToolLine::VToolLine(VDomDocument *doc, VContainer *data, qint64 id, qint64 firstPoint, qint64 secondPoint, Tool::Enum typeCreation, QGraphicsItem *parent):VAbstractTool(doc, data, id), - QGraphicsLineItem(parent){ - this->firstPoint = firstPoint; - this->secondPoint = secondPoint; - + QGraphicsLineItem(parent), firstPoint(firstPoint), secondPoint(secondPoint), + dialogLine(QSharedPointer()){ //Лінія VPointF first = data->GetPoint(firstPoint); VPointF second = data->GetPoint(secondPoint); @@ -49,6 +53,7 @@ void VToolLine::Create(const qint64 &id, const qint64 &firstPoint, const qint64 VToolLine *line = new VToolLine(doc, data, id, firstPoint, secondPoint, typeCreation); scene->addItem(line); connect(line, &VToolLine::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); + connect(line, &VToolLine::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); QMap* tools = doc->getTools(); tools->insert(id,line); } diff --git a/tools/vtoolline.h b/tools/vtoolline.h index 3c147ffa6..fcecbe744 100644 --- a/tools/vtoolline.h +++ b/tools/vtoolline.h @@ -1,9 +1,15 @@ #ifndef VTOOLLINE_H #define VTOOLLINE_H +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Weffc++" +#pragma GCC diagnostic ignored "-Wconversion" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wctor-dtor-privacy" #include "vabstracttool.h" #include "QGraphicsLineItem" #include "../dialogs/dialogline.h" +#pragma GCC diagnostic pop class VToolLine: public VAbstractTool, public QGraphicsLineItem { diff --git a/tools/vtoollineintersect.cpp b/tools/vtoollineintersect.cpp index ed3066193..60853f75f 100644 --- a/tools/vtoollineintersect.cpp +++ b/tools/vtoollineintersect.cpp @@ -1,14 +1,17 @@ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Weffc++" +#pragma GCC diagnostic ignored "-Wconversion" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wctor-dtor-privacy" #include "vtoollineintersect.h" #include +#pragma GCC diagnostic pop VToolLineIntersect::VToolLineIntersect(VDomDocument *doc, VContainer *data, const qint64 &id, const qint64 &p1Line1, const qint64 &p2Line1, const qint64 &p1Line2, const qint64 &p2Line2, Tool::Enum typeCreation, QGraphicsItem *parent): - VToolPoint(doc, data, id, parent){ - this->p1Line1 = p1Line1; - this->p2Line1 = p2Line1; - this->p1Line2 = p1Line2; - this->p2Line2 = p2Line2; + VToolPoint(doc, data, id, parent), p1Line1(p1Line1), p2Line1(p2Line1), p1Line2(p1Line2), p2Line2(p2Line2), + dialogLineIntersect(QSharedPointer()){ if(typeCreation == Tool::FromGui){ AddToFile(); } @@ -73,8 +76,8 @@ void VToolLineIntersect::Create(const qint64 _id, const qint64 &p1Line1Id, const p2Line1Id, p1Line2Id, p2Line2Id, typeCreation); scene->addItem(point); - connect(point, &VToolLineIntersect::ChoosedTool, scene, - &VMainGraphicsScene::ChoosedItem); + connect(point, &VToolLineIntersect::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); + connect(point, &VToolLineIntersect::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); QMap* tools = doc->getTools(); tools->insert(id,point); } diff --git a/tools/vtoollineintersect.h b/tools/vtoollineintersect.h index 6eb1773b1..4d33a3859 100644 --- a/tools/vtoollineintersect.h +++ b/tools/vtoollineintersect.h @@ -1,8 +1,14 @@ #ifndef VTOOLLINEINTERSECT_H #define VTOOLLINEINTERSECT_H +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Weffc++" +#pragma GCC diagnostic ignored "-Wconversion" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wctor-dtor-privacy" #include "vtoolpoint.h" #include "../dialogs/dialoglineintersect.h" +#pragma GCC diagnostic pop class VToolLineIntersect:public VToolPoint { diff --git a/tools/vtoollinepoint.cpp b/tools/vtoollinepoint.cpp index 03f31cba4..0790483da 100644 --- a/tools/vtoollinepoint.cpp +++ b/tools/vtoollinepoint.cpp @@ -1,4 +1,10 @@ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Weffc++" +#pragma GCC diagnostic ignored "-Wconversion" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wctor-dtor-privacy" #include "vtoollinepoint.h" +#pragma GCC diagnostic pop VToolLinePoint::VToolLinePoint(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, const QString &formula, const qint64 &basePointId, const qint32 &angle, diff --git a/tools/vtoollinepoint.h b/tools/vtoollinepoint.h index b988f6de6..aff7e7686 100644 --- a/tools/vtoollinepoint.h +++ b/tools/vtoollinepoint.h @@ -1,9 +1,10 @@ #ifndef VTOOLLINEPOINT_H #define VTOOLLINEPOINT_H +#pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Weffc++" #include "vtoolpoint.h" -#pragma GCC diagnostic warning "-Weffc++" +#pragma GCC diagnostic pop class VToolLinePoint : public VToolPoint { @@ -20,6 +21,9 @@ protected: qint32 angle; qint64 basePointId; QGraphicsLineItem *mainLine; +private: + VToolLinePoint(const VToolLinePoint &tool); + const VToolLinePoint &operator=(const VToolLinePoint &tool); }; #endif // VTOOLLINEPOINT_H diff --git a/tools/vtoolnormal.cpp b/tools/vtoolnormal.cpp index 3c9ff921b..3cc844f5c 100644 --- a/tools/vtoolnormal.cpp +++ b/tools/vtoolnormal.cpp @@ -1,11 +1,17 @@ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Weffc++" +#pragma GCC diagnostic ignored "-Wconversion" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wctor-dtor-privacy" #include "vtoolnormal.h" #include +#pragma GCC diagnostic pop VToolNormal::VToolNormal(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, - const QString &formula, const qint32 &angle, const qint64 &firstPointId, + const QString &formula, const qreal &angle, const qint64 &firstPointId, const qint64 &secondPointId, Tool::Enum typeCreation, QGraphicsItem *parent): - VToolLinePoint(doc, data, id, typeLine, formula, firstPointId, angle, parent){ - this->secondPointId = secondPointId; + VToolLinePoint(doc, data, id, typeLine, formula, firstPointId, angle, parent), + secondPointId(secondPointId), dialogNormal(QSharedPointer()){ if(typeCreation == Tool::FromGui){ AddToFile(); @@ -40,7 +46,7 @@ void VToolNormal::Create(QSharedPointer &dialog, VMainGraphicsScen void VToolNormal::Create(const qint64 _id, const QString &formula, const qint64 &firstPointId, const qint64 &secondPointId, const QString typeLine, const QString pointName, - const qint32 angle, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, + const qreal angle, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, Document::Enum parse, Tool::Enum typeCreation){ VPointF firstPoint = data->GetPoint(firstPointId); VPointF secondPoint = data->GetPoint(secondPointId); @@ -69,6 +75,7 @@ void VToolNormal::Create(const qint64 _id, const QString &formula, const qint64 firstPointId, secondPointId, typeCreation); scene->addItem(point); connect(point, &VToolNormal::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); + connect(point, &VToolNormal::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); QMap* tools = doc->getTools(); tools->insert(id,point); } @@ -76,7 +83,7 @@ void VToolNormal::Create(const qint64 _id, const QString &formula, const qint64 } QPointF VToolNormal::FindPoint(const QPointF &firstPoint, const QPointF &secondPoint, const qreal &length, - const qint32 &angle){ + const qreal &angle){ QLineF line(firstPoint, secondPoint); QLineF normal = line.normalVector(); normal.setAngle(normal.angle()+angle); diff --git a/tools/vtoolnormal.h b/tools/vtoolnormal.h index b8c9fe625..a56f541db 100644 --- a/tools/vtoolnormal.h +++ b/tools/vtoolnormal.h @@ -1,17 +1,22 @@ #ifndef VTOOLNORMAL_H #define VTOOLNORMAL_H +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Weffc++" +#pragma GCC diagnostic ignored "-Wconversion" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wctor-dtor-privacy" #include - #include "vtoollinepoint.h" #include "../dialogs/dialognormal.h" +#pragma GCC diagnostic pop class VToolNormal : public VToolLinePoint { public: VToolNormal(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, const QString &formula, - const qint32 &angle, const qint64 &firstPointId, + const qreal &angle, const qint64 &firstPointId, const qint64 &secondPointId, Tool::Enum typeCreation, QGraphicsItem * parent = 0); virtual void setDialog(); @@ -19,10 +24,10 @@ public: VContainer *data); static void Create(const qint64 _id, const QString &formula, const qint64 &firstPointId, const qint64 &secondPointId, const QString typeLine, const QString pointName, - const qint32 angle, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, + const qreal angle, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, Document::Enum parse, Tool::Enum typeCreation); static QPointF FindPoint(const QPointF &firstPoint, const QPointF &secondPoint, - const qreal &length, const qint32 &angle = 0); + const qreal &length, const qreal &angle = 0); public slots: virtual void FullUpdateFromFile(); virtual void FullUpdateFromGui(int result); diff --git a/tools/vtoolpoint.cpp b/tools/vtoolpoint.cpp index 5d2e684fb..0b2921737 100644 --- a/tools/vtoolpoint.cpp +++ b/tools/vtoolpoint.cpp @@ -1,16 +1,22 @@ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Weffc++" +#pragma GCC diagnostic ignored "-Wconversion" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wctor-dtor-privacy" #include "vtoolpoint.h" #include #include #include #include -#include - -#include "../container/vpointf.h" #include "../widgets/vmaingraphicsscene.h" +#pragma GCC diagnostic pop +#include +#include "../container/vpointf.h" + VToolPoint::VToolPoint(VDomDocument *doc, VContainer *data, qint64 id, - QGraphicsItem *parent):VAbstractTool(doc, data, id), QGraphicsEllipseItem(parent){ - radius = 1.5*PrintDPI/25.4; + QGraphicsItem *parent):VAbstractTool(doc, data, id), QGraphicsEllipseItem(parent), + radius(1.5*PrintDPI/25.4), namePoint(0), lineName(0){ //create circle VPointF point = data->GetPoint(id); QRectF rec = QRectF(0, 0, radius*2, radius*2); diff --git a/tools/vtoolpoint.h b/tools/vtoolpoint.h index 1d3d510ae..24ebf06ab 100644 --- a/tools/vtoolpoint.h +++ b/tools/vtoolpoint.h @@ -1,12 +1,16 @@ #ifndef VTOOLPOINT_H #define VTOOLPOINT_H +#pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Weffc++" +#pragma GCC diagnostic ignored "-Wconversion" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wctor-dtor-privacy" #include #include #include "../widgets/vgraphicssimpletextitem.h" #include "vabstracttool.h" -#pragma GCC diagnostic warning "-Weffc++" +#pragma GCC diagnostic pop #include "../options.h" class VToolPoint: public VAbstractTool, public QGraphicsEllipseItem @@ -29,6 +33,8 @@ protected: virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); private: + VToolPoint(const VToolPoint &tool); + const VToolPoint &operator=(const VToolPoint &tool); QPointF LineIntersectRect(QRectF rec, QLineF line) const; void LiteUpdateFromGui(qreal mx, qreal my); void RefreshLine(); @@ -36,6 +42,7 @@ private: QPointF &p2) const; QPointF ClosestPoint(QLineF line, QPointF p) const; QPointF addVector (QPointF p, QPointF p1, QPointF p2, qreal k) const; + }; #endif // VTOOLPOINT_H diff --git a/tools/vtoolshoulderpoint.cpp b/tools/vtoolshoulderpoint.cpp index 3c1aa57c9..f8f6a16eb 100644 --- a/tools/vtoolshoulderpoint.cpp +++ b/tools/vtoolshoulderpoint.cpp @@ -1,14 +1,19 @@ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Weffc++" +#pragma GCC diagnostic ignored "-Wconversion" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wctor-dtor-privacy" #include "vtoolshoulderpoint.h" #include #include +#pragma GCC diagnostic pop VToolShoulderPoint::VToolShoulderPoint(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, const QString &formula, const qint64 &p1Line, const qint64 &p2Line, const qint64 &pShoulder, Tool::Enum typeCreation, QGraphicsItem * parent): - VToolLinePoint(doc, data, id, typeLine, formula, p1Line, 0, parent){ - this->p2Line = p2Line; - this->pShoulder = pShoulder; + VToolLinePoint(doc, data, id, typeLine, formula, p1Line, 0, parent), p2Line(p2Line), pShoulder(pShoulder), + dialogShoulderPoint(QSharedPointer()){ if(typeCreation == Tool::FromGui){ AddToFile(); @@ -97,8 +102,8 @@ void VToolShoulderPoint::Create(const qint64 _id, const QString &formula, const p1Line, p2Line, pShoulder, typeCreation); scene->addItem(point); - connect(point, &VToolShoulderPoint::ChoosedTool, scene, - &VMainGraphicsScene::ChoosedItem); + connect(point, &VToolShoulderPoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); + connect(point, &VToolShoulderPoint::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); QMap* tools = doc->getTools(); tools->insert(id,point); } diff --git a/tools/vtoolshoulderpoint.h b/tools/vtoolshoulderpoint.h index d76ca2e43..d43a54dfd 100644 --- a/tools/vtoolshoulderpoint.h +++ b/tools/vtoolshoulderpoint.h @@ -1,8 +1,14 @@ #ifndef VTOOLSHOULDERPOINT_H #define VTOOLSHOULDERPOINT_H +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Weffc++" +#pragma GCC diagnostic ignored "-Wconversion" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wctor-dtor-privacy" #include "vtoollinepoint.h" #include "../dialogs/dialogshoulderpoint.h" +#pragma GCC diagnostic pop class VToolShoulderPoint : public VToolLinePoint { diff --git a/tools/vtoolsinglepoint.cpp b/tools/vtoolsinglepoint.cpp index 4cd95f4a8..352669eb2 100644 --- a/tools/vtoolsinglepoint.cpp +++ b/tools/vtoolsinglepoint.cpp @@ -1,17 +1,23 @@ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Weffc++" +#pragma GCC diagnostic ignored "-Wconversion" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wctor-dtor-privacy" #include "vtoolsinglepoint.h" #include #include #include #include -#include #include #include - +#pragma GCC diagnostic pop +#include #include "../options.h" #include "../container/vpointf.h" VToolSinglePoint::VToolSinglePoint (VDomDocument *doc, VContainer *data, qint64 id, Tool::Enum typeCreation, - QGraphicsItem * parent ):VToolPoint(doc, data, id, parent){ + QGraphicsItem * parent ):VToolPoint(doc, data, id, parent), + dialogSinglePoint(QSharedPointer()){ this->setFlag(QGraphicsItem::ItemIsMovable, true); this->setFlag(QGraphicsItem::ItemSendsGeometryChanges, true); if(typeCreation == Tool::FromGui){ @@ -69,7 +75,7 @@ QVariant VToolSinglePoint::itemChange(QGraphicsItem::GraphicsItemChange change, } void VToolSinglePoint::contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ){ - ContextMenu(dialogSinglePoint, this, event); + ContextMenu(dialogSinglePoint, this, event, false); } void VToolSinglePoint::FullUpdateFromFile(){ diff --git a/tools/vtoolsinglepoint.h b/tools/vtoolsinglepoint.h index d3262296c..ad2f8d480 100644 --- a/tools/vtoolsinglepoint.h +++ b/tools/vtoolsinglepoint.h @@ -1,10 +1,16 @@ #ifndef VTOOLSINGLEPOINT_H #define VTOOLSINGLEPOINT_H +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Weffc++" +#pragma GCC diagnostic ignored "-Wconversion" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wctor-dtor-privacy" #include "../container/vcontainer.h" #include "../xml/vdomdocument.h" -#include "vtoolpoint.h" #include "../dialogs/dialogsinglepoint.h" +#include "vtoolpoint.h" +#pragma GCC diagnostic pop class VToolSinglePoint : public VToolPoint { diff --git a/tools/vtoolspline.cpp b/tools/vtoolspline.cpp index e52d9a4d8..d9c803a2b 100644 --- a/tools/vtoolspline.cpp +++ b/tools/vtoolspline.cpp @@ -1,10 +1,18 @@ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Weffc++" +#pragma GCC diagnostic ignored "-Wconversion" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wctor-dtor-privacy" #include "vtoolspline.h" -#include "../geometry/vspline.h" #include #include +#pragma GCC diagnostic pop +#include "../geometry/vspline.h" + VToolSpline::VToolSpline(VDomDocument *doc, VContainer *data, qint64 id, Tool::Enum typeCreation, - QGraphicsItem *parent):VAbstractTool(doc, data, id), QGraphicsPathItem(parent){ + QGraphicsItem *parent):VAbstractTool(doc, data, id), QGraphicsPathItem(parent), + dialogSpline(QSharedPointer()), controlPoints(QVector()){ VSpline spl = data->GetSpline(id); QPainterPath path; @@ -86,6 +94,7 @@ void VToolSpline::Create(const qint64 _id, const qint64 &p1, const qint64 &p4, c VToolSpline *spl = new VToolSpline(doc, data, id, typeCreation); scene->addItem(spl); connect(spl, &VToolSpline::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); + connect(spl, &VToolSpline::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); QMap* tools = doc->getTools(); tools->insert(id,spl); } diff --git a/tools/vtoolspline.h b/tools/vtoolspline.h index 6717ba75a..171e8ca71 100644 --- a/tools/vtoolspline.h +++ b/tools/vtoolspline.h @@ -1,12 +1,18 @@ #ifndef VTOOLSPLINE_H #define VTOOLSPLINE_H +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Weffc++" +#pragma GCC diagnostic ignored "-Wconversion" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wctor-dtor-privacy" #include "vabstracttool.h" -#include "../container/vcontainer.h" #include "../xml/vdomdocument.h" #include #include "../dialogs/dialogspline.h" #include "../widgets/vcontrolpointspline.h" +#include "../container/vcontainer.h" +#pragma GCC diagnostic pop #include "../geometry/vsplinepath.h" class VToolSpline:public VAbstractTool, public QGraphicsPathItem diff --git a/tools/vtoolsplinepath.cpp b/tools/vtoolsplinepath.cpp index ef7248f25..b4af95a76 100644 --- a/tools/vtoolsplinepath.cpp +++ b/tools/vtoolsplinepath.cpp @@ -3,7 +3,8 @@ VToolSplinePath::VToolSplinePath(VDomDocument *doc, VContainer *data, qint64 id, Tool::Enum typeCreation, QGraphicsItem *parent):VAbstractTool(doc, data, id), - QGraphicsPathItem(parent){ + QGraphicsPathItem(parent), dialogSplinePath(QSharedPointer()), + controlPoints(QVector()){ VSplinePath splPath = data->GetSplinePath(id); QPainterPath path; path.addPath(splPath.GetPath()); @@ -72,6 +73,7 @@ void VToolSplinePath::Create(const qint64 _id, const VSplinePath &path, VMainGra VToolSplinePath *spl = new VToolSplinePath(doc, data, id, typeCreation); scene->addItem(spl); connect(spl, &VToolSplinePath::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); + connect(spl, &VToolSplinePath::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); QMap* tools = doc->getTools(); tools->insert(id,spl); } diff --git a/tools/vtoolsplinepath.h b/tools/vtoolsplinepath.h index 6f77f3cc0..e3daa5edc 100644 --- a/tools/vtoolsplinepath.h +++ b/tools/vtoolsplinepath.h @@ -1,12 +1,18 @@ #ifndef VTOOLSPLINEPATH_H #define VTOOLSPLINEPATH_H +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Weffc++" +#pragma GCC diagnostic ignored "-Wconversion" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wctor-dtor-privacy" #include "vabstracttool.h" -#include "../container/vcontainer.h" #include "../xml/vdomdocument.h" #include #include "../dialogs/dialogsplinepath.h" #include "../widgets/vcontrolpointspline.h" +#pragma GCC diagnostic pop +#include "../container/vcontainer.h" class VToolSplinePath:public VAbstractTool, public QGraphicsPathItem { diff --git a/widgets/delegate.cpp b/widgets/delegate.cpp index 64b25dbb2..d07798e08 100644 --- a/widgets/delegate.cpp +++ b/widgets/delegate.cpp @@ -45,8 +45,14 @@ using a spin box widget. */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Weffc++" +#pragma GCC diagnostic ignored "-Wconversion" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wctor-dtor-privacy" #include #include "delegate.h" +#pragma GCC diagnostic pop SpinBoxDelegate::SpinBoxDelegate(QObject *parent) : QItemDelegate(parent) diff --git a/widgets/delegate.h b/widgets/delegate.h index 94152ef34..663e41414 100644 --- a/widgets/delegate.h +++ b/widgets/delegate.h @@ -41,11 +41,17 @@ #ifndef DELEGATE_H #define DELEGATE_H +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Weffc++" +#pragma GCC diagnostic ignored "-Wconversion" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wctor-dtor-privacy" #include #include #include #include #include +#pragma GCC diagnostic pop class SpinBoxDelegate : public QItemDelegate { diff --git a/widgets/doubledelegate.cpp b/widgets/doubledelegate.cpp index 178a80d4c..149d44b0f 100644 --- a/widgets/doubledelegate.cpp +++ b/widgets/doubledelegate.cpp @@ -45,9 +45,14 @@ using a spin box widget. */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Weffc++" +#pragma GCC diagnostic ignored "-Wconversion" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wctor-dtor-privacy" #include - #include "doubledelegate.h" +#pragma GCC diagnostic pop DoubleSpinBoxDelegate::DoubleSpinBoxDelegate(QObject *parent) : QItemDelegate(parent) diff --git a/widgets/doubledelegate.h b/widgets/doubledelegate.h index ce1d89052..807d8273f 100644 --- a/widgets/doubledelegate.h +++ b/widgets/doubledelegate.h @@ -41,11 +41,17 @@ #ifndef DOUBLEDELEGATE_H #define DOUBLEDELEGATE_H +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Weffc++" +#pragma GCC diagnostic ignored "-Wconversion" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wctor-dtor-privacy" #include #include #include #include #include +#pragma GCC diagnostic pop class DoubleSpinBoxDelegate : public QItemDelegate { diff --git a/widgets/vcontrolpointspline.cpp b/widgets/vcontrolpointspline.cpp index e242a51ba..914516c28 100644 --- a/widgets/vcontrolpointspline.cpp +++ b/widgets/vcontrolpointspline.cpp @@ -1,15 +1,19 @@ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Weffc++" +#pragma GCC diagnostic ignored "-Wconversion" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wctor-dtor-privacy" #include "vcontrolpointspline.h" #include #include #include #include +#pragma GCC diagnostic pop VControlPointSpline::VControlPointSpline(const qint32 &indexSpline, SplinePoint::Position position, const QPointF &controlPoint, const QPointF &splinePoint, - QGraphicsItem *parent):QGraphicsEllipseItem(parent){ - radius = 1.5*PrintDPI/25.4; - this->indexSpline = indexSpline; - this->position = position; + QGraphicsItem *parent):QGraphicsEllipseItem(parent), + radius(1.5*PrintDPI/25.4), controlLine(0), indexSpline(indexSpline), position(position){ //create circle QRectF rec = QRectF(0, 0, radius*2, radius*2); rec.translate(-rec.center().x(), -rec.center().y()); diff --git a/widgets/vcontrolpointspline.h b/widgets/vcontrolpointspline.h index 019a7f21d..0ffebb222 100644 --- a/widgets/vcontrolpointspline.h +++ b/widgets/vcontrolpointspline.h @@ -1,9 +1,15 @@ #ifndef VCONTROLPOINTSPLINE_H #define VCONTROLPOINTSPLINE_H +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Weffc++" +#pragma GCC diagnostic ignored "-Wconversion" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wctor-dtor-privacy" #include #include #include +#pragma GCC diagnostic pop #include "../options.h" #include "../geometry/vsplinepath.h" @@ -28,6 +34,8 @@ protected: virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); QVariant itemChange ( GraphicsItemChange change, const QVariant &value ); private: + VControlPointSpline(const VControlPointSpline &pSpl); + const VControlPointSpline &operator=(const VControlPointSpline &pSpl); qint32 indexSpline; SplinePoint::Position position; qint32 LineIntersectCircle(QPointF center, qreal radius, QLineF line, QPointF &p1, diff --git a/widgets/vgraphicssimpletextitem.cpp b/widgets/vgraphicssimpletextitem.cpp index fba4ba35c..bf1b9d38d 100644 --- a/widgets/vgraphicssimpletextitem.cpp +++ b/widgets/vgraphicssimpletextitem.cpp @@ -1,5 +1,11 @@ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Weffc++" +#pragma GCC diagnostic ignored "-Wconversion" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wctor-dtor-privacy" #include "vgraphicssimpletextitem.h" #include +#pragma GCC diagnostic pop VGraphicsSimpleTextItem::VGraphicsSimpleTextItem(QGraphicsItem * parent):QGraphicsSimpleTextItem(parent){ } diff --git a/widgets/vgraphicssimpletextitem.h b/widgets/vgraphicssimpletextitem.h index ef8073d78..80f7a303f 100644 --- a/widgets/vgraphicssimpletextitem.h +++ b/widgets/vgraphicssimpletextitem.h @@ -1,7 +1,13 @@ #ifndef VGRAPHICSSIMPLETEXTITEM_H #define VGRAPHICSSIMPLETEXTITEM_H +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Weffc++" +#pragma GCC diagnostic ignored "-Wconversion" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wctor-dtor-privacy" #include +#pragma GCC diagnostic pop class VGraphicsSimpleTextItem : public QObject, public QGraphicsSimpleTextItem { diff --git a/widgets/vmaingraphicsscene.cpp b/widgets/vmaingraphicsscene.cpp index 9f49bc531..ce5019d04 100644 --- a/widgets/vmaingraphicsscene.cpp +++ b/widgets/vmaingraphicsscene.cpp @@ -1,7 +1,11 @@ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Weffc++" #include "vmaingraphicsscene.h" #include #include #include +#include +#pragma GCC diagnostic pop VMainGraphicsScene::VMainGraphicsScene():QGraphicsScene(){ } @@ -23,3 +27,7 @@ void VMainGraphicsScene::mousePressEvent(QGraphicsSceneMouseEvent *event){ void VMainGraphicsScene::ChoosedItem(qint64 id, Scene::Type type){ emit ChoosedObject(id, type); } + +void VMainGraphicsScene::RemoveTool(QGraphicsItem *tool){ + this->removeItem(tool); +} diff --git a/widgets/vmaingraphicsscene.h b/widgets/vmaingraphicsscene.h index 0b99c8cd3..3e8532e24 100644 --- a/widgets/vmaingraphicsscene.h +++ b/widgets/vmaingraphicsscene.h @@ -1,9 +1,12 @@ #ifndef VMAINGRAPHICSSCENE_H #define VMAINGRAPHICSSCENE_H +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Weffc++" #include #include #include +#pragma GCC diagnostic pop #include "../options.h" @@ -15,6 +18,7 @@ public: VMainGraphicsScene(const QRectF & sceneRect, QObject * parent = 0); public slots: void ChoosedItem(qint64 id, Scene::Type type); + void RemoveTool(QGraphicsItem *tool); protected: void mouseMoveEvent(QGraphicsSceneMouseEvent* event); void mousePressEvent(QGraphicsSceneMouseEvent *event); diff --git a/widgets/vmaingraphicsview.cpp b/widgets/vmaingraphicsview.cpp index 987252e70..7ea0f4c69 100644 --- a/widgets/vmaingraphicsview.cpp +++ b/widgets/vmaingraphicsview.cpp @@ -1,7 +1,13 @@ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Weffc++" +#pragma GCC diagnostic ignored "-Wconversion" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wctor-dtor-privacy" #include "vmaingraphicsview.h" #include #include #include +#pragma GCC diagnostic pop VMainGraphicsView::VMainGraphicsView(QWidget *parent) : QGraphicsView(parent){ diff --git a/widgets/vmaingraphicsview.h b/widgets/vmaingraphicsview.h index cac90f23f..61da9dde3 100644 --- a/widgets/vmaingraphicsview.h +++ b/widgets/vmaingraphicsview.h @@ -1,7 +1,13 @@ #ifndef VMAINGRAPHICSVIEW_H #define VMAINGRAPHICSVIEW_H +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Weffc++" +#pragma GCC diagnostic ignored "-Wconversion" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wctor-dtor-privacy" #include +#pragma GCC diagnostic pop class VMainGraphicsView : public QGraphicsView { diff --git a/xml/vdomdocument.cpp b/xml/vdomdocument.cpp index 64cdcdfe1..34a8a2e4a 100644 --- a/xml/vdomdocument.cpp +++ b/xml/vdomdocument.cpp @@ -1,4 +1,8 @@ +#pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Weffc++" +#pragma GCC diagnostic ignored "-Wconversion" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wctor-dtor-privacy" #include "vdomdocument.h" #include #include "../tools/vtoolsinglepoint.h" @@ -12,27 +16,29 @@ #include "../tools/vtoolspline.h" #include "../tools/vtoolarc.h" #include "../tools/vtoolsplinepath.h" -#pragma GCC diagnostic warning "-Weffc++" +#pragma GCC diagnostic pop #include "../options.h" #include "../container/calculator.h" #include "../geometry/vsplinepoint.h" -VDomDocument::VDomDocument(VContainer *data, QComboBox *comboBoxDraws) : QDomDocument(), cursor(0){ - this->data = data; - this->comboBoxDraws = comboBoxDraws; +VDomDocument::VDomDocument(VContainer *data, QComboBox *comboBoxDraws) : QDomDocument(), + map(QMap()), nameActivDraw(QString()), data(data), + tools(QMap()), history(QVector()), cursor(0), + comboBoxDraws(comboBoxDraws){ } -VDomDocument::VDomDocument(const QString& name, VContainer *data, QComboBox *comboBoxDraws) : QDomDocument(name), cursor(0) { - this->data = data; - this->comboBoxDraws = comboBoxDraws; +VDomDocument::VDomDocument(const QString& name, VContainer *data, QComboBox *comboBoxDraws) : + QDomDocument(name), map(QMap()), nameActivDraw(QString()), data(data), + tools(QMap()), history(QVector()), cursor(0), + comboBoxDraws(comboBoxDraws){ } -VDomDocument::VDomDocument(const QDomDocumentType& doctype, VContainer *data, QComboBox *comboBoxDraws) : QDomDocument(doctype), - cursor(0){ - this->data = data; - this->comboBoxDraws = comboBoxDraws; +VDomDocument::VDomDocument(const QDomDocumentType& doctype, VContainer *data, QComboBox *comboBoxDraws) : + QDomDocument(doctype), map(QMap()), nameActivDraw(QString()), data(data), + tools(QMap()), history(QVector()), cursor(0), + comboBoxDraws(comboBoxDraws){ } VDomDocument::~VDomDocument(){ @@ -434,7 +440,7 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen QString formula = domElement.attribute("length", ""); qint64 firstPointId = domElement.attribute("firstPoint", "").toLongLong(); qint64 secondPointId = domElement.attribute("secondPoint", "").toLongLong(); - qreal angle = domElement.attribute("angle", "").toInt(); + qreal angle = domElement.attribute("angle", "").toDouble(); VToolNormal::Create(id, formula, firstPointId, secondPointId, typeLine, name, angle, mx, my, scene, this, data, parse, Tool::FromFile); } diff --git a/xml/vdomdocument.h b/xml/vdomdocument.h index 1ffd955d5..dd7b00394 100644 --- a/xml/vdomdocument.h +++ b/xml/vdomdocument.h @@ -1,7 +1,11 @@ #ifndef VDOMDOCUMENT_H #define VDOMDOCUMENT_H +#pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Weffc++" +#pragma GCC diagnostic ignored "-Wconversion" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wctor-dtor-privacy" #include #include #include @@ -9,7 +13,7 @@ #include "../container/vcontainer.h" #include "../widgets/vmaingraphicsscene.h" #include "../tools/vdatatool.h" -#pragma GCC diagnostic warning "-Weffc++" +#pragma GCC diagnostic pop #include "vtoolrecord.h" namespace Document{ @@ -20,6 +24,8 @@ namespace Document{ }; } +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Weffc++" class VDomDocument : public QObject, public QDomDocument { Q_OBJECT @@ -63,6 +69,8 @@ private: QVector history; qint64 cursor; QComboBox *comboBoxDraws; + VDomDocument(const VDomDocument & doc); + const VDomDocument &operator=(const VDomDocument& doc); bool find(QDomElement node, const QString& id); bool CheckNameDraw(const QString& name) const; void SetActivDraw(const QString& name); @@ -82,4 +90,6 @@ private: void ParseIncrementsElement(const QDomNode& node); }; +#pragma GCC diagnostic pop + #endif // VDOMDOCUMENT_H diff --git a/xml/vtoolrecord.h b/xml/vtoolrecord.h index 4b7826be3..46634e535 100644 --- a/xml/vtoolrecord.h +++ b/xml/vtoolrecord.h @@ -1,12 +1,12 @@ #ifndef VTOOLRECORD_H #define VTOOLRECORD_H +#pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Weffc++" #pragma GCC diagnostic ignored "-Wsign-conversion" #include #include -#pragma GCC diagnostic warning "-Wsign-conversion" -#pragma GCC diagnostic warning "-Weffc++" +#pragma GCC diagnostic pop #include "../options.h" class VToolRecord