Fixed gcc warning in code.

This commit is contained in:
dismine 2013-08-20 13:26:02 +03:00
parent ece5024156
commit 8f186148ba
87 changed files with 563 additions and 245 deletions

View File

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

View File

@ -1,7 +1,12 @@
#include "calculator.h"
#include <cmath>
#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 <QDebug>
#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){

View File

@ -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 <QtGlobal>
@ -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 теперішня лексема.

View File

@ -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 <QDebug>
#pragma GCC diagnostic pop
#include "../options.h"
qint64 VContainer::_id = 0;
VContainer::VContainer(){
VContainer::VContainer():base(QMap<QString, qint32>()), points(QMap<qint64, VPointF>()),
standartTable(QMap<QString, VStandartTableCell>()), incrementTable(QMap<QString, VIncrementTableRow>()),
lengthLines(QMap<QString, qreal>()), lineArcs(QMap<QString, qreal>()), splines(QMap<qint64, VSpline>()),
lengthSplines(QMap<QString, qreal>()), arcs(QMap<qint64, VArc>()), lengthArcs(QMap<QString, qreal>()),
splinePaths(QMap<qint64, VSplinePath>()){
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<qreal> (size()/10.0) - 50.0 ) / 2.0;
qreal k_growth = ( static_cast<qreal> (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<qreal> (size()/10.0) - 50.0 ) / 2.0;
qreal k_growth = ( static_cast<qreal> (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 &center, 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){

View File

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

View File

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

View File

@ -1,7 +1,10 @@
#ifndef VINCREMENTTABLEROW_H
#define VINCREMENTTABLEROW_H
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
#include <QString>
#pragma GCC diagnostic pop
class VIncrementTableRow
{

View File

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

View File

@ -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 <QString>
#pragma GCC diagnostic pop
class VStandartTableCell
{

View File

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

View File

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

View File

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

View File

@ -55,6 +55,8 @@ private:
void EvalF1();
void EvalF2();
void ShowLineArcs();
DialogArc(const DialogArc &dialog);
const DialogArc &operator=(const DialogArc& dialog);
};
#endif // DIALOGARC_H

View File

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

View File

@ -45,6 +45,8 @@ private:
qint64 firstPointId;
qint64 secondPointId;
qint64 thirdPointId;
DialogBisector(const DialogBisector &dialog);
const DialogBisector &operator=(const DialogBisector& dialog);
};
#endif // DIALOGBISECTOR_H

View File

@ -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 <QCloseEvent>
#include <QString>
#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;

View File

@ -1,10 +1,13 @@
#ifndef DIALOGENDLINE_H
#define DIALOGENDLINE_H
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
#include "dialogtool.h"
#include <QPushButton>
#include <QListWidgetItem>
#include <QTimer>
#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

View File

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

View File

@ -1,17 +1,17 @@
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
#include "dialogincrements.h"
#include "ui_dialogincrements.h"
#include <QHeaderView>
#include <QCloseEvent>
#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");

View File

@ -1,11 +1,14 @@
#ifndef DIALOGINCREMENTS_H
#define DIALOGINCREMENTS_H
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
#include "dialogtool.h"
#include <QPushButton>
#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

View File

@ -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 <QPushButton>
#include <QCloseEvent>
#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);

View File

@ -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 <QComboBox>
#pragma GCC diagnostic pop
#include "../container/vcontainer.h"
#include "../options.h"
#include <QComboBox>
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

View File

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

View File

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

View File

@ -3,10 +3,9 @@
#include <QMenu>
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;

View File

@ -44,6 +44,8 @@ private:
qint32 angle;
qint64 firstPointId;
qint64 secondPointId;
DialogNormal(const DialogNormal &dialog);
const DialogNormal &operator=(const DialogNormal& dialog);
};
#endif // DIALOGNORMAL_H

View File

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

View File

@ -40,6 +40,8 @@ private:
qint64 p1Line;
qint64 p2Line;
qint64 pShoulder;
DialogShoulderPoint(const DialogShoulderPoint &dialog);
const DialogShoulderPoint &operator=(const DialogShoulderPoint& dialog);
};
#endif // DIALOGSHOULDERPOINT_H

View File

@ -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 <QShowEvent>
#include <QPushButton>
#include <QDebug>
#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);

View File

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

View File

@ -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<qint64>(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<qint32>(QLineF(p1, p4).angle()));
ui->spinBoxAngle2->setValue(static_cast<qint32>(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<qint32>(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<qint32>(value));
}
qint64 DialogSpline::getP4() const{

View File

@ -41,6 +41,8 @@ private:
qreal kAsm1;
qreal kAsm2;
qreal kCurve;
DialogSpline(const DialogSpline &dialog);
const DialogSpline &operator=(const DialogSpline& dialog);
};
#endif // DIALOGSPLINE_H

View File

@ -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<qint32>(angle2));
ui->spinBoxAngle1->setValue(static_cast<qint32>(angle1));
connect(ui->comboBoxPoint, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
this, &DialogSplinePath::currentPointChanged);

View File

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

View File

@ -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 <QListWidgetItem>
#include <QCloseEvent>
#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 <class key, class val>
template <class key, class val>
void DialogTool::ShowVariable(const QMap<key, val> *var){
Q_CHECK_PTR(listWidget);
disconnect(listWidget, &QListWidget::currentRowChanged, this, &DialogTool::ValChenged);

View File

@ -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 <QDialog>
#include <QComboBox>
#include <QSpinBox>
@ -11,7 +15,7 @@
#include <QLabel>
#include <QRadioButton>
#include <QTimer>
#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

View File

@ -3,41 +3,24 @@
#include "vspline.h"
#include <QDebug>
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<qint64, VPointF> *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<qint64, VPointF> *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<int>(d2 > curve_collinearity_epsilon) << 1) +
static_cast<int>(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<qint16>(level + 1), px, py);
PointBezier_r(x1234, y1234, x234, y234, x34, y34, x4, y4, static_cast<qint16>(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<qreal *>(malloc(3*sizeof(qreal)));
P1 = curve_coord1;
P2 = curve_coord2;
P3 = curve_coord3;

View File

@ -1,13 +1,14 @@
#include "vsplinepath.h"
VSplinePath::VSplinePath(){
points = 0;
kCurve = 1;
VSplinePath::VSplinePath(): path(QVector<VSplinePoint>()), kCurve(1), points(0){
}
VSplinePath::VSplinePath(const QMap<qint64, VPointF> *points, qreal kCurve){
this->points = points;
this->kCurve = kCurve;
VSplinePath::VSplinePath(const QMap<qint64, VPointF> *points, qreal kCurve): path(QVector<VSplinePoint>()),
kCurve(kCurve), points(points){
}
VSplinePath::VSplinePath(const VSplinePath &splPath): path(*splPath.GetPoint()),
kCurve(splPath.getKCurve()), points( splPath.GetDataPoints()){
}
void VSplinePath::append(VSplinePoint point){

View File

@ -28,6 +28,7 @@ public:
* @brief VSplinePath конструктор по замовчуванню.
*/
VSplinePath(const QMap<qint64, VPointF> *points, qreal kCurve = 1);
VSplinePath(const VSplinePath& splPath);
/**
* @brief append додає точку сплайну до шляху.
* @param point точка.

View File

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

View File

@ -1,8 +1,9 @@
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
#include "mainwindow.h"
#include <QApplication>
#include <QTextCodec>
#pragma GCC diagnostic warning "-Weffc++"
#pragma GCC diagnostic pop
void myMessageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg){
QByteArray localMsg = msg.toLocal8Bit();

View File

@ -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 <QLabel>
@ -9,7 +13,6 @@
#include <QInputDialog>
#include <QFileDialog>
#include <QDebug>
#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<DialogEndLine>()), dialogLine(QSharedPointer<DialogLine>()),
dialogAlongLine(QSharedPointer<DialogAlongLine>()),
dialogShoulderPoint(QSharedPointer<DialogShoulderPoint>()), dialogNormal(QSharedPointer<DialogNormal>()),
dialogBisector(QSharedPointer<DialogBisector>()),
dialogLineIntersect(QSharedPointer<DialogLineIntersect>()),
dialogSpline(QSharedPointer<DialogSpline>()),
dialogArc(QSharedPointer<DialogArc>()), dialogSplinePath(QSharedPointer<DialogSplinePath>()),
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);

View File

@ -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 <QMainWindow>
#include <QLabel>
#include <QtXml>
@ -9,7 +14,6 @@
#include <QSharedPointer>
#include <QToolButton>
#include <QSharedPointer>
#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();

View File

@ -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 <QDebug>
#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(){
}

View File

@ -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 <QMenu>
#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 <typename Dialog, typename Tool>
void ContextMenu(QSharedPointer<Dialog> &dialog, Tool *tool, QGraphicsSceneContextMenuEvent *event){
void ContextMenu(QSharedPointer<Dialog> &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<Dialog>(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

View File

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

View File

@ -1,9 +1,10 @@
#ifndef VDATATOOL_H
#define VDATATOOL_H
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
#include <QObject>
#pragma GCC diagnostic warning "-Weffc++"
#pragma GCC diagnostic pop
#include "../container/vcontainer.h"
class VDataTool : public QObject

View File

@ -1,15 +1,18 @@
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
#include "vtoolalongline.h"
#include "../container/calculator.h"
#include <QDialog>
#include <QMenu>
#include <QDebug>
#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<DialogAlongLine>()){
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<qint64, VDataTool*>* tools = doc->getTools();
tools->insert(id,point);

View File

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

View File

@ -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 <QMenu>
#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<DialogArc>()){
VArc arc = data->GetArc(id);
QPainterPath path;
path.addPath(arc.GetPath());
@ -81,6 +88,7 @@ void VToolArc::Create(const qint64 _id, const qint64 &center, 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<qint64, VDataTool*>* tools = doc->getTools();
tools->insert(id,toolArc);
}

View File

@ -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 <QGraphicsPathItem>
#include "../dialogs/dialogarc.h"
#include "../widgets/vcontrolpointspline.h"
#pragma GCC diagnostic pop
#include "../container/vcontainer.h"
class VToolArc :public VAbstractTool, public QGraphicsPathItem
{

View File

@ -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<DialogBisector>()){
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<qint64, VDataTool*>* tools = doc->getTools();
tools->insert(id,point);
}

View File

@ -1,13 +1,16 @@
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
#include "vtoolendline.h"
#include <QDebug>
#include <QMenu>
#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<DialogEndLine>()){
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<qint64, VDataTool*>* tools = doc->getTools();
tools->insert(id,point);
}

View File

@ -1,10 +1,12 @@
#ifndef VTOOLENDLINE_H
#define VTOOLENDLINE_H
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
#include <QSharedPointer>
#include "vtoollinepoint.h"
#include "../dialogs/dialogendline.h"
#pragma GCC diagnostic pop
class VToolEndLine : public VToolLinePoint
{

View File

@ -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 <QMenu>
#include <QDebug>
#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<DialogLine>()){
//Лінія
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<qint64, VDataTool*>* tools = doc->getTools();
tools->insert(id,line);
}

View File

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

View File

@ -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 <QMenu>
#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<DialogLineIntersect>()){
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<qint64, VDataTool*>* tools = doc->getTools();
tools->insert(id,point);
}

View File

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

View File

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

View File

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

View File

@ -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 <QMenu>
#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<DialogNormal>()){
if(typeCreation == Tool::FromGui){
AddToFile();
@ -40,7 +46,7 @@ void VToolNormal::Create(QSharedPointer<DialogNormal> &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<qint64, VDataTool*>* 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);

View File

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

View File

@ -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 <QPen>
#include <QBrush>
#include <QDebug>
#include <QGraphicsItem>
#include <cmath>
#include "../container/vpointf.h"
#include "../widgets/vmaingraphicsscene.h"
#pragma GCC diagnostic pop
#include <cmath>
#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);

View File

@ -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 <QGraphicsLineItem>
#include <QGraphicsEllipseItem>
#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

View File

@ -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 <QDebug>
#include <QMenu>
#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<DialogShoulderPoint>()){
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<qint64, VDataTool*>* tools = doc->getTools();
tools->insert(id,point);
}

View File

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

View File

@ -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 <QPen>
#include <QBrush>
#include <QDebug>
#include <QGraphicsItem>
#include <cmath>
#include <QMenu>
#include <QGraphicsSceneContextMenuEvent>
#pragma GCC diagnostic pop
#include <cmath>
#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<DialogSinglePoint>()){
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(){

View File

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

View File

@ -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 <QMenu>
#include <QDebug>
#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<DialogSpline>()), controlPoints(QVector<VControlPointSpline *>()){
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<qint64, VDataTool*>* tools = doc->getTools();
tools->insert(id,spl);
}

View File

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

View File

@ -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<DialogSplinePath>()),
controlPoints(QVector<VControlPointSpline *>()){
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<qint64, VDataTool*>* tools = doc->getTools();
tools->insert(id,spl);
}

View File

@ -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 <QGraphicsPathItem>
#include "../dialogs/dialogsplinepath.h"
#include "../widgets/vcontrolpointspline.h"
#pragma GCC diagnostic pop
#include "../container/vcontainer.h"
class VToolSplinePath:public VAbstractTool, public QGraphicsPathItem
{

View File

@ -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 <QtGui>
#include "delegate.h"
#pragma GCC diagnostic pop
SpinBoxDelegate::SpinBoxDelegate(QObject *parent)
: QItemDelegate(parent)

View File

@ -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 <QItemDelegate>
#include <QModelIndex>
#include <QObject>
#include <QSize>
#include <QSpinBox>
#pragma GCC diagnostic pop
class SpinBoxDelegate : public QItemDelegate
{

View File

@ -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 <QtGui>
#include "doubledelegate.h"
#pragma GCC diagnostic pop
DoubleSpinBoxDelegate::DoubleSpinBoxDelegate(QObject *parent)
: QItemDelegate(parent)

View File

@ -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 <QItemDelegate>
#include <QModelIndex>
#include <QObject>
#include <QSize>
#include <QSpinBox>
#pragma GCC diagnostic pop
class DoubleSpinBoxDelegate : public QItemDelegate
{

View File

@ -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 <QPen>
#include <QBrush>
#include <QGraphicsScene>
#include <QDebug>
#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());

View File

@ -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 <QGraphicsEllipseItem>
#include <QGraphicsLineItem>
#include <QObject>
#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,

View File

@ -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 <QGraphicsScene>
#pragma GCC diagnostic pop
VGraphicsSimpleTextItem::VGraphicsSimpleTextItem(QGraphicsItem * parent):QGraphicsSimpleTextItem(parent){
}

View File

@ -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 <QGraphicsSimpleTextItem>
#pragma GCC diagnostic pop
class VGraphicsSimpleTextItem : public QObject, public QGraphicsSimpleTextItem
{

View File

@ -1,7 +1,11 @@
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
#include "vmaingraphicsscene.h"
#include <QDebug>
#include <QApplication>
#include <QScrollBar>
#include <QGraphicsItem>
#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);
}

View File

@ -1,9 +1,12 @@
#ifndef VMAINGRAPHICSSCENE_H
#define VMAINGRAPHICSSCENE_H
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
#include <QGraphicsScene>
#include <QGraphicsView>
#include <QGraphicsSceneMouseEvent>
#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);

View File

@ -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 <QApplication>
#include <QWheelEvent>
#include <QScrollBar>
#pragma GCC diagnostic pop
VMainGraphicsView::VMainGraphicsView(QWidget *parent) :
QGraphicsView(parent){

View File

@ -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 <QGraphicsView>
#pragma GCC diagnostic pop
class VMainGraphicsView : public QGraphicsView
{

View File

@ -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 <QDebug>
#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<QString, QDomElement>()), nameActivDraw(QString()), data(data),
tools(QMap<qint64, VDataTool*>()), history(QVector<VToolRecord>()), 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<QString, QDomElement>()), nameActivDraw(QString()), data(data),
tools(QMap<qint64, VDataTool*>()), history(QVector<VToolRecord>()), 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<QString, QDomElement>()), nameActivDraw(QString()), data(data),
tools(QMap<qint64, VDataTool*>()), history(QVector<VToolRecord>()), 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);
}

View File

@ -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 <QDomDocument>
#include <QMap>
#include <QObject>
@ -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<VToolRecord> 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

View File

@ -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 <QtGlobal>
#include <QString>
#pragma GCC diagnostic warning "-Wsign-conversion"
#pragma GCC diagnostic warning "-Weffc++"
#pragma GCC diagnostic pop
#include "../options.h"
class VToolRecord