Refactoring. Delete global variables.

--HG--
branch : feature
This commit is contained in:
dismine 2014-03-19 20:27:11 +02:00
parent f641894abd
commit fa06c04cd2
59 changed files with 626 additions and 504 deletions

View File

@ -1,11 +1,11 @@
SOURCES += \ SOURCES += \
src/container/vincrementtablerow.cpp \
src/container/vcontainer.cpp \ src/container/vcontainer.cpp \
src/container/calculator.cpp \ src/container/calculator.cpp \
src/container/vmeasurement.cpp src/container/vmeasurement.cpp \
src/container/vincrement.cpp
HEADERS += \ HEADERS += \
src/container/vincrementtablerow.h \
src/container/vcontainer.h \ src/container/vcontainer.h \
src/container/calculator.h \ src/container/calculator.h \
src/container/vmeasurement.h src/container/vmeasurement.h \
src/container/vincrement.h

View File

@ -30,12 +30,13 @@
#include <QDebug> #include <QDebug>
#include <QtAlgorithms> #include <QtAlgorithms>
#include "../widgets/vapplication.h"
quint32 VContainer::_id = 0; quint32 VContainer::_id = 0;
VContainer::VContainer() VContainer::VContainer()
:_size(50), sizeName("Сг"), _height(176), heightName("P"), gObjects(QHash<quint32, VGObject *>()), :_size(50), sizeName("Сг"), _height(176), heightName("P"), gObjects(QHash<quint32, VGObject *>()),
measurements(QHash<QString, VMeasurement>()), incrementTable(QHash<QString, VIncrementTableRow>()), measurements(QHash<QString, VMeasurement>()), increments(QHash<QString, VIncrement>()),
lengthLines(QHash<QString, qreal>()), lineAngles(QHash<QString, qreal>()), lengthSplines(QHash<QString, qreal>()), lengthLines(QHash<QString, qreal>()), lineAngles(QHash<QString, qreal>()), lengthSplines(QHash<QString, qreal>()),
lengthArcs(QHash<QString, qreal>()), details(QHash<quint32, VDetail>()) lengthArcs(QHash<QString, qreal>()), details(QHash<quint32, VDetail>())
{ {
@ -49,7 +50,7 @@ VContainer &VContainer::operator =(const VContainer &data)
VContainer::VContainer(const VContainer &data) VContainer::VContainer(const VContainer &data)
:_size(50), sizeName("Сг"), _height(176), heightName("P"), gObjects(QHash<quint32, VGObject *>()), :_size(50), sizeName("Сг"), _height(176), heightName("P"), gObjects(QHash<quint32, VGObject *>()),
measurements(QHash<QString, VMeasurement>()), incrementTable(QHash<QString, VIncrementTableRow>()), measurements(QHash<QString, VMeasurement>()), increments(QHash<QString, VIncrement>()),
lengthLines(QHash<QString, qreal>()), lineAngles(QHash<QString, qreal>()), lengthSplines(QHash<QString, qreal>()), lengthLines(QHash<QString, qreal>()), lineAngles(QHash<QString, qreal>()), lengthSplines(QHash<QString, qreal>()),
lengthArcs(QHash<QString, qreal>()), details(QHash<quint32, VDetail>()) lengthArcs(QHash<QString, qreal>()), details(QHash<quint32, VDetail>())
{ {
@ -104,7 +105,7 @@ void VContainer::setData(const VContainer &data)
} }
} }
measurements = *data.DataMeasurements(); measurements = *data.DataMeasurements();
incrementTable = *data.DataIncrementTable(); increments = *data.DataIncrements();
lengthLines = *data.DataLengthLines(); lengthLines = *data.DataLengthLines();
lineAngles = *data.DataLineAngles(); lineAngles = *data.DataLineAngles();
lengthSplines = *data.DataLengthSplines(); lengthSplines = *data.DataLengthSplines();
@ -149,10 +150,10 @@ const VMeasurement VContainer::GetMeasurement(const QString &name) const
return GetVariable(measurements, name); return GetVariable(measurements, name);
} }
const VIncrementTableRow VContainer::GetIncrementTableRow(const QString& name) const const VIncrement VContainer::GetIncrement(const QString& name) const
{ {
Q_ASSERT(name.isEmpty()==false); Q_ASSERT(name.isEmpty()==false);
return GetVariable(incrementTable, name); return GetVariable(increments, name);
} }
qreal VContainer::GetLine(const QString &name) const qreal VContainer::GetLine(const QString &name) const
@ -196,9 +197,9 @@ quint32 VContainer::AddDetail(VDetail detail)
return id; return id;
} }
void VContainer::AddIncrementTableRow(const QString &name, VIncrementTableRow row) void VContainer::AddIncrement(const QString &name, VIncrement incr)
{ {
incrementTable[name] = row; increments[name] = incr;
} }
quint32 VContainer::getNextId() quint32 VContainer::getNextId()
@ -239,7 +240,7 @@ void VContainer::AddLengthSpline(const QString &name, const qreal &value)
void VContainer::AddLengthArc(const quint32 &id) void VContainer::AddLengthArc(const quint32 &id)
{ {
const VArc * arc = GeometricObject<const VArc *>(id); const VArc * arc = GeometricObject<const VArc *>(id);
lengthArcs[arc->name()] = fromPixel(arc->GetLength()); lengthArcs[arc->name()] = qApp->fromPixel(arc->GetLength());
} }
void VContainer::AddLineAngle(const QString &name, const qreal &value) void VContainer::AddLineAngle(const QString &name, const qreal &value)
@ -251,7 +252,7 @@ void VContainer::AddLineAngle(const QString &name, const qreal &value)
qreal VContainer::GetValueStandardTableRow(const QString& name) const qreal VContainer::GetValueStandardTableRow(const QString& name) const
{ {
const VMeasurement m = GetMeasurement(name); const VMeasurement m = GetMeasurement(name);
if (patternType == Pattern::Individual) if (qApp->patternType() == Pattern::Individual)
{ {
return m.GetValue(); return m.GetValue();
} }
@ -263,18 +264,22 @@ qreal VContainer::GetValueStandardTableRow(const QString& name) const
qreal VContainer::GetValueIncrementTableRow(const QString& name) const qreal VContainer::GetValueIncrementTableRow(const QString& name) const
{ {
const VIncrementTableRow row = GetIncrementTableRow(name); const VIncrement icr = GetIncrement(name);
const qreal k_size = ( size() - 50.0 ) / 2.0; if (qApp->patternType() == Pattern::Individual)
const qreal k_growth = ( height() - 176.0 ) / 6.0; {
const qreal value = row.getBase() + k_size * row.getKsize() + k_growth * row.getKgrowth(); return icr.GetValue();
return value; }
else
{
return icr.GetValue(size(), height());
}
} }
void VContainer::Clear() void VContainer::Clear()
{ {
_id = 0; _id = 0;
measurements.clear(); measurements.clear();
incrementTable.clear(); increments.clear();
lengthLines.clear(); lengthLines.clear();
lengthArcs.clear(); lengthArcs.clear();
lineAngles.clear(); lineAngles.clear();
@ -326,7 +331,7 @@ qreal VContainer::FindVar(const QString &name, bool *ok)const
*ok = true; *ok = true;
return GetValueStandardTableRow(name); return GetValueStandardTableRow(name);
} }
if (incrementTable.contains(name)) if (increments.contains(name))
{ {
*ok = true; *ok = true;
return GetValueIncrementTableRow(name); return GetValueIncrementTableRow(name);
@ -360,7 +365,7 @@ void VContainer::AddLine(const quint32 &firstPointId, const quint32 &secondPoint
QString nameLine = GetNameLine(firstPointId, secondPointId); QString nameLine = GetNameLine(firstPointId, secondPointId);
const VPointF *first = GeometricObject<const VPointF *>(firstPointId); const VPointF *first = GeometricObject<const VPointF *>(firstPointId);
const VPointF *second = GeometricObject<const VPointF *>(secondPointId); const VPointF *second = GeometricObject<const VPointF *>(secondPointId);
AddLengthLine(nameLine, fromPixel(QLineF(first->toQPointF(), second->toQPointF()).length())); AddLengthLine(nameLine, qApp->fromPixel(QLineF(first->toQPointF(), second->toQPointF()).length()));
nameLine = GetNameLineAngle(firstPointId, secondPointId); nameLine = GetNameLineAngle(firstPointId, secondPointId);
AddLineAngle(nameLine, QLineF(first->toQPointF(), second->toQPointF()).angle()); AddLineAngle(nameLine, QLineF(first->toQPointF(), second->toQPointF()).angle());
} }

View File

@ -30,7 +30,7 @@
#define VCONTAINER_H #define VCONTAINER_H
#include "vmeasurement.h" #include "vmeasurement.h"
#include "vincrementtablerow.h" #include "vincrement.h"
#include "../geometry/varc.h" #include "../geometry/varc.h"
#include "../geometry/vsplinepath.h" #include "../geometry/vsplinepath.h"
#include "../geometry/vdetail.h" #include "../geometry/vdetail.h"
@ -113,11 +113,11 @@ public:
*/ */
const VMeasurement GetMeasurement(const QString& name) const; const VMeasurement GetMeasurement(const QString& name) const;
/** /**
* @brief GetIncrementTableRow return increment table row by name * @brief GetIncrement return increment table row by name
* @param name name of increment table row * @param name name of increment table row
* @return row of increment table * @return increment
*/ */
const VIncrementTableRow GetIncrementTableRow(const QString& name) const; const VIncrement GetIncrement(const QString& name) const;
/** /**
* @brief GetLine return length of line by name * @brief GetLine return length of line by name
* @param name name of line * @param name name of line
@ -172,11 +172,11 @@ public:
*/ */
void AddMeasurement(const QString& name, const VMeasurement &m); void AddMeasurement(const QString& name, const VMeasurement &m);
/** /**
* @brief AddIncrementTableRow add new row of increment table * @brief AddIncrement add new row of increment table
* @param name name of new row of increment table * @param name name of new row of increment table
* @param row new row of increment table * @param row new row of increment table
*/ */
void AddIncrementTableRow(const QString& name, VIncrementTableRow row); void AddIncrement(const QString& name, VIncrement incr);
/** /**
* @brief AddLengthLine add length of line to container * @brief AddLengthLine add length of line to container
* @param name name of line * @param name name of line
@ -242,11 +242,11 @@ public:
*/ */
void UpdateMeasurement(const QString& name, VMeasurement m); void UpdateMeasurement(const QString& name, VMeasurement m);
/** /**
* @brief UpdateIncrementTableRow update increment table row by name * @brief UpdateIncrement update increment table row by name
* @param name name of row * @param name name of row
* @param row row * @param row row
*/ */
void UpdateIncrementTableRow(const QString& name, VIncrementTableRow row); void UpdateIncrement(const QString& name, VIncrement incr);
/** /**
* @brief GetValueStandardTableRow return value of measurement by name * @brief GetValueStandardTableRow return value of measurement by name
* @param name name of measurement * @param name name of measurement
@ -347,10 +347,10 @@ public:
*/ */
const QHash<QString, VMeasurement> *DataMeasurements() const; const QHash<QString, VMeasurement> *DataMeasurements() const;
/** /**
* @brief data container with dataIncrementTable return container of increment table * @brief data container with dataIncrements return container of increment table
* @return pointer on container of increment table * @return pointer on container of increment table
*/ */
const QHash<QString, VIncrementTableRow> *DataIncrementTable() const; const QHash<QString, VIncrement> *DataIncrements() const;
/** /**
* @brief data container with dataLengthLines return container of lines lengths * @brief data container with dataLengthLines return container of lines lengths
* @return pointer on container of lines lengths * @return pointer on container of lines lengths
@ -399,9 +399,9 @@ private:
*/ */
QHash<QString, VMeasurement> measurements; QHash<QString, VMeasurement> measurements;
/** /**
* @brief incrementTable * @brief increments
*/ */
QHash<QString, VIncrementTableRow> incrementTable; QHash<QString, VIncrement> increments;
/** /**
* @brief lengthLines container of lines lengths * @brief lengthLines container of lines lengths
*/ */
@ -468,14 +468,14 @@ inline void VContainer::UpdateMeasurement(const QString &name, VMeasurement m)
measurements[name] = m; measurements[name] = m;
} }
inline void VContainer::UpdateIncrementTableRow(const QString &name, VIncrementTableRow row) inline void VContainer::UpdateIncrement(const QString &name, VIncrement incr)
{ {
incrementTable[name] = row; increments[name] = incr;
} }
inline void VContainer::ClearIncrementTable() inline void VContainer::ClearIncrementTable()
{ {
incrementTable.clear(); increments.clear();
} }
inline void VContainer::ClearLengthLines() inline void VContainer::ClearLengthLines()
@ -545,12 +545,12 @@ inline QString VContainer::HeightName() const
inline bool VContainer::IncrementTableContains(const QString &name) inline bool VContainer::IncrementTableContains(const QString &name)
{ {
return incrementTable.contains(name); return increments.contains(name);
} }
inline void VContainer::RemoveIncrementTableRow(const QString &name) inline void VContainer::RemoveIncrementTableRow(const QString &name)
{ {
incrementTable.remove(name); increments.remove(name);
} }
inline const QHash<quint32, VGObject *> *VContainer::DataGObjects() const inline const QHash<quint32, VGObject *> *VContainer::DataGObjects() const
@ -563,9 +563,9 @@ inline const QHash<QString, VMeasurement> *VContainer::DataMeasurements() const
return &measurements; return &measurements;
} }
inline const QHash<QString, VIncrementTableRow> *VContainer::DataIncrementTable() const inline const QHash<QString, VIncrement> *VContainer::DataIncrements() const
{ {
return &incrementTable; return &increments;
} }
inline const QHash<QString, qreal> *VContainer::DataLengthLines() const inline const QHash<QString, qreal> *VContainer::DataLengthLines() const

View File

@ -26,10 +26,22 @@
** **
*************************************************************************/ *************************************************************************/
#include "vincrementtablerow.h" #include "vincrement.h"
VIncrementTableRow::VIncrementTableRow() VIncrement::VIncrement()
:id(0), base(0), ksize(0), kgrowth(0), description(QString()){} :id(0), base(0), ksize(50.0), kheight(176.0), description(QString()){}
VIncrementTableRow::VIncrementTableRow(quint32 id, qreal base, qreal ksize, qreal kgrowth, QString description) VIncrement::VIncrement(quint32 id, qreal base, qreal ksize, qreal kheight, QString description)
:id(id), base(base), ksize(ksize), kgrowth(kgrowth), description(description){} :id(id), base(base), ksize(ksize), kheight(kheight), description(description){}
qreal VIncrement::GetValue() const
{
return base;
}
qreal VIncrement::GetValue(const qreal &size, const qreal &height) const
{
const qreal k_size = ( size - 50.0 ) / 2.0;
const qreal k_height = ( height - 176.0 ) / 6.0;
return base + k_size * ksize + k_height * kheight;
}

View File

@ -32,15 +32,15 @@
#include <QString> #include <QString>
/** /**
* @brief The VIncrementTableRow class keep data row of increment table * @brief The VIncrement class keep data row of increment table
*/ */
class VIncrementTableRow class VIncrement
{ {
public: public:
/** /**
* @brief VIncrementTableRow create enpty row * @brief VIncrementTableRow create enpty row
*/ */
VIncrementTableRow(); VIncrement();
/** /**
* @brief VIncrementTableRow create row * @brief VIncrementTableRow create row
* @param id id * @param id id
@ -49,8 +49,7 @@ public:
* @param kgrowth increment in growths * @param kgrowth increment in growths
* @param description description of increment * @param description description of increment
*/ */
VIncrementTableRow(quint32 id, qreal base, qreal ksize, qreal kgrowth, VIncrement(quint32 id, qreal base, qreal ksize, qreal kheight, QString description = QString());
QString description = QString());
/** /**
* @brief getId return id of row * @brief getId return id of row
* @return id * @return id
@ -82,15 +81,15 @@ public:
*/ */
void setKsize(const qreal &value); void setKsize(const qreal &value);
/** /**
* @brief getKgrowth return increment in growths * @brief getKheight return increment in growths
* @return increment * @return increment
*/ */
qreal getKgrowth() const; qreal getKheight() const;
/** /**
* @brief setKgrowth set increment in growths * @brief setKheight set increment in growths
* @param value value of increment * @param value value of increment
*/ */
void setKgrowth(const qreal &value); void setKheight(const qreal &value);
/** /**
* @brief getDescription return description * @brief getDescription return description
* @return description * @return description
@ -101,6 +100,8 @@ public:
* @param value description * @param value description
*/ */
void setDescription(const QString &value); void setDescription(const QString &value);
qreal GetValue() const;
qreal GetValue(const qreal &size, const qreal &height) const;
private: private:
/** /**
* @brief id identificator * @brief id identificator
@ -117,59 +118,59 @@ private:
/** /**
* @brief kgrowth increment in growths * @brief kgrowth increment in growths
*/ */
qreal kgrowth; qreal kheight;
/** /**
* @brief description description of increment * @brief description description of increment
*/ */
QString description; QString description;
}; };
inline quint32 VIncrementTableRow::getId() const inline quint32 VIncrement::getId() const
{ {
return id; return id;
} }
inline void VIncrementTableRow::setId(const quint32 &value) inline void VIncrement::setId(const quint32 &value)
{ {
id = value; id = value;
} }
inline qreal VIncrementTableRow::getBase() const inline qreal VIncrement::getBase() const
{ {
return base; return base;
} }
inline void VIncrementTableRow::setBase(const qreal &value) inline void VIncrement::setBase(const qreal &value)
{ {
base = value; base = value;
} }
inline qreal VIncrementTableRow::getKsize() const inline qreal VIncrement::getKsize() const
{ {
return ksize; return ksize;
} }
inline void VIncrementTableRow::setKsize(const qreal &value) inline void VIncrement::setKsize(const qreal &value)
{ {
ksize = value; ksize = value;
} }
inline qreal VIncrementTableRow::getKgrowth() const inline qreal VIncrement::getKheight() const
{ {
return kgrowth; return kheight;
} }
inline void VIncrementTableRow::setKgrowth(const qreal &value) inline void VIncrement::setKheight(const qreal &value)
{ {
kgrowth = value; kheight = value;
} }
inline QString VIncrementTableRow::getDescription() const inline QString VIncrement::getDescription() const
{ {
return description; return description;
} }
inline void VIncrementTableRow::setDescription(const QString &value) inline void VIncrement::setDescription(const QString &value)
{ {
description = value; description = value;
} }

View File

@ -49,6 +49,6 @@ qreal VMeasurement::GetValue() const
qreal VMeasurement::GetValue(const qreal &size, const qreal &height) const qreal VMeasurement::GetValue(const qreal &size, const qreal &height) const
{ {
const qreal k_size = ( size - 50.0 ) / 2.0; const qreal k_size = ( size - 50.0 ) / 2.0;
const qreal k_growth = ( height - 176.0 ) / 6.0; const qreal k_height = ( height - 176.0 ) / 6.0;
return base + k_size * ksize + k_growth * kheight; return base + k_size * ksize + k_height * kheight;
} }

View File

@ -45,13 +45,40 @@ DialogIncrements::DialogIncrements(VContainer *data, VPattern *doc, QWidget *par
ui->tableWidgetIncrement->setItemDelegateForColumn(3, doubleDelegate); ui->tableWidgetIncrement->setItemDelegateForColumn(3, doubleDelegate);
ui->tableWidgetIncrement->setItemDelegateForColumn(4, doubleDelegate); ui->tableWidgetIncrement->setItemDelegateForColumn(4, doubleDelegate);
if (qApp->patternType() == Pattern::Standard)
{
ui->labelBirthDate->setVisible(false);
ui->lineEditBirthDate->setVisible(false);
ui->labelFamilyName->setVisible(false);
ui->lineEditFamilyName->setVisible(false);
ui->labelGivenName->setVisible(false);
ui->lineEditGivenName->setVisible(false);
ui->labelSex->setVisible(false);
ui->lineEditSex->setVisible(false);
}
else
{
ui->tableWidgetMeasurements->setColumnHidden( 1, true );
ui->tableWidgetMeasurements->setColumnHidden( 3, true );
ui->tableWidgetMeasurements->setColumnHidden( 4, true );
ui->tableWidgetIncrement->setColumnHidden( 1, true );
ui->tableWidgetIncrement->setColumnHidden( 3, true );
ui->tableWidgetIncrement->setColumnHidden( 4, true );
ui->tableWidgetMeasurements->setItemDelegateForColumn(0, textDelegate);
ui->tableWidgetMeasurements->setItemDelegateForColumn(2, doubleDelegate);
connect(ui->tableWidgetMeasurements, &QTableWidget::cellChanged, this, &DialogIncrements::MeasurementsChanged);
}
FillMeasurements(); FillMeasurements();
FillIncrementTable(); FillIncrements();
FillLengthLines(); FillLengthLines();
FillLengthSplines(); FillLengthSplines();
FillLengthArcs(); FillLengthArcs();
connect(ui->tableWidgetIncrement, &QTableWidget::cellChanged, this, &DialogIncrements::cellChanged); connect(ui->tableWidgetIncrement, &QTableWidget::cellChanged, this, &DialogIncrements::IncrementChanged);
connect(ui->toolButtonAdd, &QPushButton::clicked, this, &DialogIncrements::clickedToolButtonAdd); connect(ui->toolButtonAdd, &QPushButton::clicked, this, &DialogIncrements::clickedToolButtonAdd);
connect(ui->toolButtonRemove, &QPushButton::clicked, this, &DialogIncrements::clickedToolButtonRemove); connect(ui->toolButtonRemove, &QPushButton::clicked, this, &DialogIncrements::clickedToolButtonRemove);
@ -67,54 +94,61 @@ void DialogIncrements::FillMeasurements()
const QHash<QString, VMeasurement> *table = data->DataMeasurements(); const QHash<QString, VMeasurement> *table = data->DataMeasurements();
qint32 currentRow = -1; qint32 currentRow = -1;
QHashIterator<QString, VMeasurement> i(*table); QHashIterator<QString, VMeasurement> i(*table);
ui->tableWidgetStandard->setRowCount ( table->size() ); ui->tableWidgetMeasurements->setRowCount ( table->size() );
while (i.hasNext()) while (i.hasNext())
{ {
i.next(); i.next();
VMeasurement cell = i.value(); VMeasurement m = i.value();
currentRow++; currentRow++;
QTableWidgetItem *item = new QTableWidgetItem(QString(i.key())); QTableWidgetItem *item = new QTableWidgetItem(QString(i.key()));
item->setTextAlignment(Qt::AlignHCenter); item->setTextAlignment(Qt::AlignHCenter);
item->setFont(QFont("Times", 12, QFont::Bold)); item->setFont(QFont("Times", 12, QFont::Bold));
ui->tableWidgetStandard->setItem(currentRow, 0, item); item->setToolTip(m.GetDescription());
ui->tableWidgetMeasurements->setItem(currentRow, 0, item);
item = new QTableWidgetItem(QString().setNum(data->GetValueStandardTableRow(i.key()))); if (qApp->patternType() == Pattern::Standard)
item->setTextAlignment(Qt::AlignHCenter); {
ui->tableWidgetStandard->setItem(currentRow, 1, item); QTableWidgetItem *item = new QTableWidgetItem(QString().setNum(data->GetValueStandardTableRow(i.key())));
item->setTextAlignment(Qt::AlignHCenter);
ui->tableWidgetMeasurements->setItem(currentRow, 1, item);
}
item = new QTableWidgetItem(QString().setNum(cell.GetBase())); item = new QTableWidgetItem(QString().setNum(m.GetBase()));
item->setTextAlignment(Qt::AlignHCenter); item->setTextAlignment(Qt::AlignHCenter);
ui->tableWidgetStandard->setItem(currentRow, 2, item); ui->tableWidgetMeasurements->setItem(currentRow, 2, item);
item = new QTableWidgetItem(QString().setNum(cell.GetKsize())); if (qApp->patternType() == Pattern::Standard)
item->setTextAlignment(Qt::AlignHCenter); {
ui->tableWidgetStandard->setItem(currentRow, 3, item); QTableWidgetItem *item = new QTableWidgetItem(QString().setNum(m.GetKsize()));
item->setTextAlignment(Qt::AlignHCenter);
ui->tableWidgetMeasurements->setItem(currentRow, 3, item);
item = new QTableWidgetItem(QString().setNum(cell.GetKheight())); item = new QTableWidgetItem(QString().setNum(m.GetKheight()));
item->setTextAlignment(Qt::AlignHCenter); item->setTextAlignment(Qt::AlignHCenter);
ui->tableWidgetStandard->setItem(currentRow, 4, item); ui->tableWidgetMeasurements->setItem(currentRow, 4, item);
}
item = new QTableWidgetItem(cell.GetDescription()); item = new QTableWidgetItem(m.GetNumber());
item->setTextAlignment(Qt::AlignHCenter); item->setTextAlignment(Qt::AlignHCenter);
ui->tableWidgetStandard->setItem(currentRow, 5, item); ui->tableWidgetMeasurements->setItem(currentRow, 5, item);
} }
ui->tableWidgetStandard->resizeColumnsToContents(); ui->tableWidgetMeasurements->resizeColumnsToContents();
ui->tableWidgetStandard->resizeRowsToContents(); ui->tableWidgetMeasurements->resizeRowsToContents();
ui->tableWidgetStandard->verticalHeader()->setDefaultSectionSize(20); ui->tableWidgetMeasurements->verticalHeader()->setDefaultSectionSize(20);
} }
void DialogIncrements::FillIncrementTable() void DialogIncrements::FillIncrements()
{ {
const QHash<QString, VIncrementTableRow> *incrementTable = data->DataIncrementTable(); const QHash<QString, VIncrement> *increments = data->DataIncrements();
QHashIterator<QString, VIncrementTableRow> i(*incrementTable); QHashIterator<QString, VIncrement> i(*increments);
QMap<quint32, QString> map; QMap<quint32, QString> map;
//Sorting QHash by id //Sorting QHash by id
while (i.hasNext()) while (i.hasNext())
{ {
i.next(); i.next();
VIncrementTableRow cell = i.value(); VIncrement incr = i.value();
map.insert(cell.getId(), i.key()); map.insert(incr.getId(), i.key());
} }
qint32 currentRow = -1; qint32 currentRow = -1;
@ -122,37 +156,43 @@ void DialogIncrements::FillIncrementTable()
while (iMap.hasNext()) while (iMap.hasNext())
{ {
iMap.next(); iMap.next();
VIncrementTableRow cell = incrementTable->value(iMap.value()); VIncrement incr = increments->value(iMap.value());
currentRow++; currentRow++;
ui->tableWidgetIncrement->setRowCount ( incrementTable->size() ); ui->tableWidgetIncrement->setRowCount ( increments->size() );
QTableWidgetItem *item = new QTableWidgetItem(iMap.value()); QTableWidgetItem *item = new QTableWidgetItem(iMap.value());
item->setTextAlignment(Qt::AlignHCenter); item->setTextAlignment(Qt::AlignHCenter);
item->setFont(QFont("Times", 12, QFont::Bold)); item->setFont(QFont("Times", 12, QFont::Bold));
item->setData(Qt::UserRole, cell.getId()); item->setData(Qt::UserRole, incr.getId());
ui->tableWidgetIncrement->setItem(currentRow, 0, item); ui->tableWidgetIncrement->setItem(currentRow, 0, item);
item = new QTableWidgetItem(QString().setNum(data->GetValueIncrementTableRow(iMap.value()))); if (qApp->patternType() == Pattern::Standard)
item->setTextAlignment(Qt::AlignHCenter); {
// set the item non-editable (view only), and non-selectable item = new QTableWidgetItem(QString().setNum(data->GetValueIncrementTableRow(iMap.value())));
Qt::ItemFlags flags = item->flags(); item->setTextAlignment(Qt::AlignHCenter);
flags &= ~(Qt::ItemIsSelectable | Qt::ItemIsEditable); // reset/clear the flag // set the item non-editable (view only), and non-selectable
item->setFlags(flags); Qt::ItemFlags flags = item->flags();
ui->tableWidgetIncrement->setItem(currentRow, 1, item); flags &= ~(Qt::ItemIsSelectable | Qt::ItemIsEditable); // reset/clear the flag
item->setFlags(flags);
ui->tableWidgetIncrement->setItem(currentRow, 1, item);
}
item = new QTableWidgetItem(QString().setNum(cell.getBase())); item = new QTableWidgetItem(QString().setNum(incr.getBase()));
item->setTextAlignment(Qt::AlignHCenter); item->setTextAlignment(Qt::AlignHCenter);
ui->tableWidgetIncrement->setItem(currentRow, 2, item); ui->tableWidgetIncrement->setItem(currentRow, 2, item);
item = new QTableWidgetItem(QString().setNum(cell.getKsize())); if (qApp->patternType() == Pattern::Standard)
item->setTextAlignment(Qt::AlignHCenter); {
ui->tableWidgetIncrement->setItem(currentRow, 3, item); item = new QTableWidgetItem(QString().setNum(incr.getKsize()));
item->setTextAlignment(Qt::AlignHCenter);
ui->tableWidgetIncrement->setItem(currentRow, 3, item);
item = new QTableWidgetItem(QString().setNum(cell.getKgrowth())); item = new QTableWidgetItem(QString().setNum(incr.getKheight()));
item->setTextAlignment(Qt::AlignHCenter); item->setTextAlignment(Qt::AlignHCenter);
ui->tableWidgetIncrement->setItem(currentRow, 4, item); ui->tableWidgetIncrement->setItem(currentRow, 4, item);
}
item = new QTableWidgetItem(cell.getDescription()); item = new QTableWidgetItem(incr.getDescription());
item->setTextAlignment(Qt::AlignLeft); item->setTextAlignment(Qt::AlignLeft);
ui->tableWidgetIncrement->setItem(currentRow, 5, item); ui->tableWidgetIncrement->setItem(currentRow, 5, item);
} }
@ -273,13 +313,13 @@ void DialogIncrements::FillLengthArcs()
void DialogIncrements::FullUpdateFromFile() void DialogIncrements::FullUpdateFromFile()
{ {
disconnect(ui->tableWidgetIncrement, &QTableWidget::cellChanged, this, disconnect(ui->tableWidgetIncrement, &QTableWidget::cellChanged, this,
&DialogIncrements::cellChanged); &DialogIncrements::IncrementChanged);
ui->tableWidgetStandard->clearContents(); ui->tableWidgetMeasurements->clearContents();
FillMeasurements(); FillMeasurements();
ui->tableWidgetIncrement->clearContents(); ui->tableWidgetIncrement->clearContents();
FillIncrementTable(); FillIncrements();
ui->tableWidgetLines->clearContents(); ui->tableWidgetLines->clearContents();
FillLengthLines(); FillLengthLines();
@ -291,14 +331,14 @@ void DialogIncrements::FullUpdateFromFile()
FillLengthArcs(); FillLengthArcs();
connect(ui->tableWidgetIncrement, &QTableWidget::cellChanged, this, connect(ui->tableWidgetIncrement, &QTableWidget::cellChanged, this,
&DialogIncrements::cellChanged); &DialogIncrements::IncrementChanged);
} }
void DialogIncrements::clickedToolButtonAdd() void DialogIncrements::clickedToolButtonAdd()
{ {
ui->tableWidgetIncrement->setFocus(Qt::OtherFocusReason); ui->tableWidgetIncrement->setFocus(Qt::OtherFocusReason);
disconnect(ui->tableWidgetIncrement, &QTableWidget::cellChanged, this, disconnect(ui->tableWidgetIncrement, &QTableWidget::cellChanged, this,
&DialogIncrements::cellChanged); &DialogIncrements::IncrementChanged);
qint32 currentRow = ui->tableWidgetIncrement->rowCount(); qint32 currentRow = ui->tableWidgetIncrement->rowCount();
ui->tableWidgetIncrement->insertRow( currentRow ); ui->tableWidgetIncrement->insertRow( currentRow );
@ -315,8 +355,8 @@ void DialogIncrements::clickedToolButtonAdd()
qreal ksize = 0; qreal ksize = 0;
qreal kgrowth = 0; qreal kgrowth = 0;
QString description = QString(tr("Description")); QString description = QString(tr("Description"));
VIncrementTableRow incrementRow = VIncrementTableRow(id, base, ksize, kgrowth, description); VIncrement incr = VIncrement(id, base, ksize, kgrowth, description);
data->AddIncrementTableRow(name, incrementRow); data->AddIncrement(name, incr);
AddIncrementToFile(id, name, base, ksize, kgrowth, description); AddIncrementToFile(id, name, base, ksize, kgrowth, description);
@ -353,14 +393,14 @@ void DialogIncrements::clickedToolButtonAdd()
ui->toolButtonRemove->setEnabled(true); ui->toolButtonRemove->setEnabled(true);
connect(ui->tableWidgetIncrement, &QTableWidget::cellChanged, this, connect(ui->tableWidgetIncrement, &QTableWidget::cellChanged, this,
&DialogIncrements::cellChanged); &DialogIncrements::IncrementChanged);
emit haveLiteChange(); emit haveLiteChange();
} }
void DialogIncrements::clickedToolButtonRemove() void DialogIncrements::clickedToolButtonRemove()
{ {
disconnect(ui->tableWidgetIncrement, &QTableWidget::cellChanged, this, disconnect(ui->tableWidgetIncrement, &QTableWidget::cellChanged, this,
&DialogIncrements::cellChanged); &DialogIncrements::IncrementChanged);
QTableWidgetItem *item = ui->tableWidgetIncrement->currentItem(); QTableWidgetItem *item = ui->tableWidgetIncrement->currentItem();
qint32 row = item->row(); qint32 row = item->row();
QTableWidgetItem *itemName = ui->tableWidgetIncrement->item(row, 0); QTableWidgetItem *itemName = ui->tableWidgetIncrement->item(row, 0);
@ -378,7 +418,7 @@ void DialogIncrements::clickedToolButtonRemove()
ui->toolButtonRemove->setEnabled(false); ui->toolButtonRemove->setEnabled(false);
} }
connect(ui->tableWidgetIncrement, &QTableWidget::cellChanged, this, connect(ui->tableWidgetIncrement, &QTableWidget::cellChanged, this,
&DialogIncrements::cellChanged); &DialogIncrements::IncrementChanged);
emit haveLiteChange(); emit haveLiteChange();
} }
@ -415,7 +455,7 @@ void DialogIncrements::AddIncrementToFile(quint32 id, QString name, qreal base,
list.at(0).appendChild(element); list.at(0).appendChild(element);
} }
void DialogIncrements::cellChanged ( qint32 row, qint32 column ) void DialogIncrements::IncrementChanged ( qint32 row, qint32 column )
{ {
QTableWidgetItem *item = nullptr; QTableWidgetItem *item = nullptr;
QTableWidgetItem *itemName = nullptr; QTableWidgetItem *itemName = nullptr;
@ -493,9 +533,9 @@ void DialogIncrements::cellChanged ( qint32 row, qint32 column )
if (domElement.isElement()) if (domElement.isElement())
{ {
domElement.setAttribute("description", item->text()); domElement.setAttribute("description", item->text());
VIncrementTableRow incr = data->GetIncrementTableRow(itemName->text()); VIncrement incr = data->GetIncrement(itemName->text());
incr.setDescription(item->text()); incr.setDescription(item->text());
data->UpdateIncrementTableRow(itemName->text(), incr); data->UpdateIncrement(itemName->text(), incr);
ui->tableWidgetIncrement->resizeColumnsToContents(); ui->tableWidgetIncrement->resizeColumnsToContents();
ui->tableWidgetIncrement->resizeRowsToContents(); ui->tableWidgetIncrement->resizeRowsToContents();
ui->tableWidgetIncrement->setCurrentCell( row, 0 ); ui->tableWidgetIncrement->setCurrentCell( row, 0 );
@ -507,6 +547,11 @@ void DialogIncrements::cellChanged ( qint32 row, qint32 column )
} }
} }
void DialogIncrements::MeasurementsChanged(qint32 row, qint32 column)
{
}
void DialogIncrements::closeEvent(QCloseEvent *event) void DialogIncrements::closeEvent(QCloseEvent *event)
{ {
emit DialogClosed(QDialog::Accepted); emit DialogClosed(QDialog::Accepted);

View File

@ -66,7 +66,8 @@ public slots:
* @param row number of row * @param row number of row
* @param column number of column * @param column number of column
*/ */
void cellChanged ( qint32 row, qint32 column ); void IncrementChanged ( qint32 row, qint32 column );
void MeasurementsChanged ( qint32 row, qint32 column );
/** /**
* @brief FullUpdateFromFile update information in tables form file * @brief FullUpdateFromFile update information in tables form file
*/ */
@ -111,7 +112,7 @@ private:
/** /**
* @brief FillIncrementTable fill data for increment table * @brief FillIncrementTable fill data for increment table
*/ */
void FillIncrementTable(); void FillIncrements();
/** /**
* @brief FillLengthLines fill data for table of lines lengths * @brief FillLengthLines fill data for table of lines lengths
*/ */

View File

@ -61,7 +61,9 @@
<string>...</string> <string>...</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset theme="document-open"/> <iconset theme="document-open">
<normaloff/>
</iconset>
</property> </property>
</widget> </widget>
</item> </item>
@ -70,21 +72,21 @@
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QHBoxLayout" name="horizontalLayout_2">
<item> <item>
<widget class="QLabel" name="label"> <widget class="QLabel" name="labelFamilyName">
<property name="text"> <property name="text">
<string>Family name</string> <string>Family name</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLineEdit" name="lineEdit"/> <widget class="QLineEdit" name="lineEditFamilyName"/>
</item> </item>
</layout> </layout>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_3"> <layout class="QHBoxLayout" name="horizontalLayout_3">
<item> <item>
<widget class="QLabel" name="label_2"> <widget class="QLabel" name="labelGivenName">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>84</width> <width>84</width>
@ -97,14 +99,14 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLineEdit" name="lineEdit_2"/> <widget class="QLineEdit" name="lineEditGivenName"/>
</item> </item>
</layout> </layout>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_4"> <layout class="QHBoxLayout" name="horizontalLayout_4">
<item> <item>
<widget class="QLabel" name="label_3"> <widget class="QLabel" name="labelBirthDate">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>84</width> <width>84</width>
@ -117,14 +119,14 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLineEdit" name="lineEdit_3"/> <widget class="QLineEdit" name="lineEditBirthDate"/>
</item> </item>
</layout> </layout>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_5"> <layout class="QHBoxLayout" name="horizontalLayout_5">
<item> <item>
<widget class="QLabel" name="label_4"> <widget class="QLabel" name="labelSex">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>84</width> <width>84</width>
@ -137,12 +139,12 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLineEdit" name="lineEdit_4"/> <widget class="QLineEdit" name="lineEditSex"/>
</item> </item>
</layout> </layout>
</item> </item>
<item> <item>
<widget class="QTableWidget" name="tableWidgetStandard"> <widget class="QTableWidget" name="tableWidgetMeasurements">
<property name="enabled"> <property name="enabled">
<bool>true</bool> <bool>true</bool>
</property> </property>
@ -448,7 +450,7 @@
</layout> </layout>
</widget> </widget>
<tabstops> <tabstops>
<tabstop>tableWidgetStandard</tabstop> <tabstop>tableWidgetMeasurements</tabstop>
<tabstop>tableWidgetIncrement</tabstop> <tabstop>tableWidgetIncrement</tabstop>
<tabstop>toolButtonAdd</tabstop> <tabstop>toolButtonAdd</tabstop>
<tabstop>toolButtonRemove</tabstop> <tabstop>toolButtonRemove</tabstop>

View File

@ -33,6 +33,7 @@
#include <QSettings> #include <QSettings>
#include <QFileDialog> #include <QFileDialog>
#include <QMessageBox> #include <QMessageBox>
#include "../../widgets/vapplication.h"
DialogIndividualMeasurements::DialogIndividualMeasurements(VContainer *data, const QString &patternPieceName, DialogIndividualMeasurements::DialogIndividualMeasurements(VContainer *data, const QString &patternPieceName,
QWidget *parent) : QWidget *parent) :
@ -112,7 +113,7 @@ void DialogIndividualMeasurements::DialogAccepted()
try try
{ {
m.setContent(&file); m.setContent(&file);
patternUnit = m.Unit(); qApp->setPatternUnit( m.Unit());
} }
catch(VException &e) catch(VException &e)
{ {
@ -196,18 +197,9 @@ void DialogIndividualMeasurements::CheckState()
void DialogIndividualMeasurements::LoadIndividualTables() void DialogIndividualMeasurements::LoadIndividualTables()
{ {
#ifdef Q_OS_WIN
const QString pathToTables = QString("/tables/individual");
#else
#ifdef QT_DEBUG
const QString pathToTables = QString("/tables/individual");
#else
const QString pathToTables = QString("/usr/share/valentina/tables/individual");
#endif
#endif
QStringList filters; QStringList filters;
filters << "*.vit"; filters << "*.vit";
QDir tablesDir(pathToTables); QDir tablesDir(qApp->pathToTables());
tablesDir.setNameFilters(filters); tablesDir.setNameFilters(filters);
const QStringList allFiles = tablesDir.entryList(QDir::NoDotAndDotDot | QDir::Files); const QStringList allFiles = tablesDir.entryList(QDir::NoDotAndDotDot | QDir::Files);

View File

@ -30,6 +30,7 @@
#include "ui_dialogstandardmeasurements.h" #include "ui_dialogstandardmeasurements.h"
#include <QDir> #include <QDir>
#include "../../xml/vstandardmeasurements.h" #include "../../xml/vstandardmeasurements.h"
#include "../../widgets/vapplication.h"
DialogStandardMeasurements::DialogStandardMeasurements(VContainer *data, const QString &patternPieceName, DialogStandardMeasurements::DialogStandardMeasurements(VContainer *data, const QString &patternPieceName,
QWidget *parent) : QWidget *parent) :
@ -94,7 +95,7 @@ void DialogStandardMeasurements::DialogAccepted()
try try
{ {
m.setContent(&file); m.setContent(&file);
patternUnit = m.Unit(); qApp->setPatternUnit(m.Unit());
} }
catch(VException &e) catch(VException &e)
{ {
@ -148,18 +149,9 @@ void DialogStandardMeasurements::CheckState()
void DialogStandardMeasurements::LoadStandardTables() void DialogStandardMeasurements::LoadStandardTables()
{ {
#ifdef Q_OS_WIN
const QString pathToTables = QString("/tables/standard");
#else
#ifdef QT_DEBUG
const QString pathToTables = QString("/tables/standard");
#else
const QString pathToTables = QString("/usr/share/valentina/tables/standard");
#endif
#endif
QStringList filters; QStringList filters;
filters << "*.vst"; filters << "*.vst";
QDir tablesDir(pathToTables); QDir tablesDir(qApp->pathToTables());
tablesDir.setNameFilters(filters); tablesDir.setNameFilters(filters);
const QStringList allFiles = tablesDir.entryList(QDir::NoDotAndDotDot | QDir::Files); const QStringList allFiles = tablesDir.entryList(QDir::NoDotAndDotDot | QDir::Files);

View File

@ -28,6 +28,7 @@
#include "pages.h" #include "pages.h"
#include "../../options.h" #include "../../options.h"
#include "../../widgets/vapplication.h"
ConfigurationPage::ConfigurationPage(QWidget *parent): ConfigurationPage::ConfigurationPage(QWidget *parent):
QWidget(parent), autoSaveCheck(0), autoTime(0), langCombo(0), osOptionCheck(0), langChanged(false) QWidget(parent), autoSaveCheck(0), autoTime(0), langCombo(0), osOptionCheck(0), langChanged(false)
@ -115,7 +116,7 @@ QGroupBox *ConfigurationPage::LangGroup()
QString checkedLocale = settings.value("configuration/locale", defaultLocale).toString(); QString checkedLocale = settings.value("configuration/locale", defaultLocale).toString();
QString m_langPath = QApplication::applicationDirPath(); QString m_langPath = QApplication::applicationDirPath();
m_langPath.append(translationsPath); m_langPath.append(qApp->translationsPath());
QDir dir(m_langPath); QDir dir(m_langPath);
QStringList fileNames = dir.entryList(QStringList("valentina_*.qm")); QStringList fileNames = dir.entryList(QStringList("valentina_*.qm"));

View File

@ -150,8 +150,8 @@ void DialogDetail::NewItem(quint32 id, const Valentina::Tools &typeTool, const N
this, &DialogDetail::BiasXChanged); this, &DialogDetail::BiasXChanged);
disconnect(ui.spinBoxBiasY, static_cast<void (QSpinBox::*)(qint32)>(&QSpinBox::valueChanged), disconnect(ui.spinBoxBiasY, static_cast<void (QSpinBox::*)(qint32)>(&QSpinBox::valueChanged),
this, &DialogDetail::BiasYChanged); this, &DialogDetail::BiasYChanged);
ui.spinBoxBiasX->setValue(static_cast<qint32>(fromPixel(node.getMx()))); ui.spinBoxBiasX->setValue(static_cast<qint32>(qApp->fromPixel(node.getMx())));
ui.spinBoxBiasY->setValue(static_cast<qint32>(fromPixel(node.getMy()))); ui.spinBoxBiasY->setValue(static_cast<qint32>(qApp->fromPixel(node.getMy())));
connect(ui.spinBoxBiasX, static_cast<void (QSpinBox::*)(qint32)>(&QSpinBox::valueChanged), connect(ui.spinBoxBiasX, static_cast<void (QSpinBox::*)(qint32)>(&QSpinBox::valueChanged),
this, &DialogDetail::BiasXChanged); this, &DialogDetail::BiasXChanged);
connect(ui.spinBoxBiasY, static_cast<void (QSpinBox::*)(qint32)>(&QSpinBox::valueChanged), connect(ui.spinBoxBiasY, static_cast<void (QSpinBox::*)(qint32)>(&QSpinBox::valueChanged),
@ -184,7 +184,7 @@ void DialogDetail::BiasXChanged(qreal d)
QListWidgetItem *item = ui.listWidget->item( row ); QListWidgetItem *item = ui.listWidget->item( row );
Q_CHECK_PTR(item); Q_CHECK_PTR(item);
VNodeDetail node = qvariant_cast<VNodeDetail>(item->data(Qt::UserRole)); VNodeDetail node = qvariant_cast<VNodeDetail>(item->data(Qt::UserRole));
node.setMx(toPixel(d)); node.setMx(qApp->toPixel(d));
item->setData(Qt::UserRole, QVariant::fromValue(node)); item->setData(Qt::UserRole, QVariant::fromValue(node));
} }
@ -194,7 +194,7 @@ void DialogDetail::BiasYChanged(qreal d)
QListWidgetItem *item = ui.listWidget->item( row ); QListWidgetItem *item = ui.listWidget->item( row );
Q_CHECK_PTR(item); Q_CHECK_PTR(item);
VNodeDetail node = qvariant_cast<VNodeDetail>(item->data(Qt::UserRole)); VNodeDetail node = qvariant_cast<VNodeDetail>(item->data(Qt::UserRole));
node.setMy(toPixel(d)); node.setMy(qApp->toPixel(d));
item->setData(Qt::UserRole, QVariant::fromValue(node)); item->setData(Qt::UserRole, QVariant::fromValue(node));
} }
@ -218,8 +218,8 @@ void DialogDetail::ObjectChanged(int row)
} }
QListWidgetItem *item = ui.listWidget->item( row ); QListWidgetItem *item = ui.listWidget->item( row );
VNodeDetail node = qvariant_cast<VNodeDetail>(item->data(Qt::UserRole)); VNodeDetail node = qvariant_cast<VNodeDetail>(item->data(Qt::UserRole));
ui.spinBoxBiasX->setValue(static_cast<qint32>(fromPixel(node.getMx()))); ui.spinBoxBiasX->setValue(static_cast<qint32>(qApp->fromPixel(node.getMx())));
ui.spinBoxBiasY->setValue(static_cast<qint32>(fromPixel(node.getMy()))); ui.spinBoxBiasY->setValue(static_cast<qint32>(qApp->fromPixel(node.getMy())));
} }
void DialogDetail::DeleteItem() void DialogDetail::DeleteItem()

View File

@ -67,7 +67,7 @@ DialogPointOfContact::DialogPointOfContact(const VContainer *data, QWidget *pare
connect(ui.listWidget, &QListWidget::itemDoubleClicked, this, &DialogPointOfContact::PutVal); connect(ui.listWidget, &QListWidget::itemDoubleClicked, this, &DialogPointOfContact::PutVal);
connect(ui.listWidget, &QListWidget::currentRowChanged, this, &DialogPointOfContact::ValChenged); connect(ui.listWidget, &QListWidget::currentRowChanged, this, &DialogPointOfContact::ValChenged);
if (patternType == Pattern::Standard) if (qApp->patternType() == Pattern::Standard)
{ {
SizeHeight(); SizeHeight();
connect(ui.radioButtonSizeGrowth, &QRadioButton::clicked, this, &DialogTool::SizeHeight); connect(ui.radioButtonSizeGrowth, &QRadioButton::clicked, this, &DialogTool::SizeHeight);

View File

@ -36,8 +36,8 @@ DialogSinglePoint::DialogSinglePoint(const VContainer *data, QWidget *parent)
point(QPointF()) point(QPointF())
{ {
ui->setupUi(this); ui->setupUi(this);
ui->doubleSpinBoxX->setRange(0, fromPixel(SceneSize)); ui->doubleSpinBoxX->setRange(0, qApp->fromPixel(SceneSize));
ui->doubleSpinBoxY->setRange(0, fromPixel(SceneSize)); ui->doubleSpinBoxY->setRange(0, qApp->fromPixel(SceneSize));
labelEditNamePoint = ui->labelEditName; labelEditNamePoint = ui->labelEditName;
InitOkCansel(ui); InitOkCansel(ui);
@ -51,20 +51,20 @@ void DialogSinglePoint::mousePress(const QPointF &scenePos)
{ {
if (isInitialized == false) if (isInitialized == false)
{ {
ui->doubleSpinBoxX->setValue(fromPixel(scenePos.x())); ui->doubleSpinBoxX->setValue(qApp->fromPixel(scenePos.x()));
ui->doubleSpinBoxY->setValue(fromPixel(scenePos.y())); ui->doubleSpinBoxY->setValue(qApp->fromPixel(scenePos.y()));
this->show(); this->show();
} }
else else
{ {
ui->doubleSpinBoxX->setValue(fromPixel(scenePos.x())); ui->doubleSpinBoxX->setValue(qApp->fromPixel(scenePos.x()));
ui->doubleSpinBoxY->setValue(fromPixel(scenePos.y())); ui->doubleSpinBoxY->setValue(qApp->fromPixel(scenePos.y()));
} }
} }
void DialogSinglePoint::DialogAccepted() void DialogSinglePoint::DialogAccepted()
{ {
point = QPointF(toPixel(ui->doubleSpinBoxX->value()), toPixel(ui->doubleSpinBoxY->value())); point = QPointF(qApp->toPixel(ui->doubleSpinBoxX->value()), qApp->toPixel(ui->doubleSpinBoxY->value()));
name = ui->lineEditName->text(); name = ui->lineEditName->text();
emit DialogClosed(QDialog::Accepted); emit DialogClosed(QDialog::Accepted);
} }
@ -75,8 +75,8 @@ void DialogSinglePoint::setData(const QString &name, const QPointF &point)
this->point = point; this->point = point;
isInitialized = true; isInitialized = true;
ui->lineEditName->setText(name); ui->lineEditName->setText(name);
ui->doubleSpinBoxX->setValue(fromPixel(point.x())); ui->doubleSpinBoxX->setValue(qApp->fromPixel(point.x()));
ui->doubleSpinBoxY->setValue(fromPixel(point.y())); ui->doubleSpinBoxY->setValue(qApp->fromPixel(point.y()));
} }
DialogSinglePoint::~DialogSinglePoint() DialogSinglePoint::~DialogSinglePoint()

View File

@ -566,7 +566,7 @@ void DialogTool::LengthCurves()
void DialogTool::Increments() void DialogTool::Increments()
{ {
ShowVariable(data->DataIncrementTable()); ShowVariable(data->DataIncrements());
} }
void DialogTool::PutHere() void DialogTool::PutHere()
@ -624,9 +624,9 @@ void DialogTool::ValChenged(int row)
} }
if (radioButtonIncrements->isChecked()) if (radioButtonIncrements->isChecked())
{ {
VIncrementTableRow itable = data->GetIncrementTableRow(item->text()); VIncrement incr = data->GetIncrement(item->text());
QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->GetValueIncrementTableRow(item->text())) QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->GetValueIncrementTableRow(item->text()))
.arg(itable.getDescription()); .arg(incr.getDescription());
labelDescription->setText(desc); labelDescription->setText(desc);
return; return;
} }
@ -672,7 +672,7 @@ void DialogTool::UpdateList()
} }
if (radioButtonIncrements->isChecked()) if (radioButtonIncrements->isChecked())
{ {
ShowVariable(data->DataIncrementTable()); ShowVariable(data->DataIncrements());
} }
if (radioButtonLengthLine->isChecked()) if (radioButtonLengthLine->isChecked())
{ {

View File

@ -37,6 +37,7 @@
#include <QRadioButton> #include <QRadioButton>
#include <QDialogButtonBox> #include <QDialogButtonBox>
#include "../../container/vcontainer.h" #include "../../container/vcontainer.h"
#include "../../widgets/vapplication.h"
namespace ComboMode namespace ComboMode
{ {
@ -428,7 +429,7 @@ protected:
connect(listWidget, &QListWidget::currentRowChanged, this, &DialogTool::ValChenged); connect(listWidget, &QListWidget::currentRowChanged, this, &DialogTool::ValChenged);
if (patternType == Pattern::Standard) if (qApp->patternType() == Pattern::Standard)
{ {
SizeHeight(); SizeHeight();
connect(radioButtonSizeGrowth, &QRadioButton::clicked, this, &DialogTool::SizeHeight); connect(radioButtonSizeGrowth, &QRadioButton::clicked, this, &DialogTool::SizeHeight);

View File

@ -27,6 +27,7 @@
*************************************************************************/ *************************************************************************/
#include "vequidistant.h" #include "vequidistant.h"
#include "../widgets/vapplication.h"
QPainterPath VEquidistant::ContourPath(const quint32 &idDetail, const VContainer *data) const QPainterPath VEquidistant::ContourPath(const quint32 &idDetail, const VContainer *data) const
{ {
@ -145,11 +146,11 @@ QPainterPath VEquidistant::ContourPath(const quint32 &idDetail, const VContainer
QPainterPath ekv; QPainterPath ekv;
if (detail.getClosed() == true) if (detail.getClosed() == true)
{ {
ekv = Equidistant(pointsEkv, Detail::CloseEquidistant, toPixel(detail.getWidth())); ekv = Equidistant(pointsEkv, Detail::CloseEquidistant, qApp->toPixel(detail.getWidth()));
} }
else else
{ {
ekv = Equidistant(pointsEkv, Detail::OpenEquidistant, toPixel(detail.getWidth())); ekv = Equidistant(pointsEkv, Detail::OpenEquidistant, qApp->toPixel(detail.getWidth()));
} }
path.addPath(ekv); path.addPath(ekv);
path.setFillRule(Qt::WindingFill); path.setFillRule(Qt::WindingFill);
@ -385,7 +386,7 @@ QVector<QPointF> VEquidistant::EkvPoint(const QLineF &line1, const QLineF &line2
case (QLineF::UnboundedIntersection): case (QLineF::UnboundedIntersection):
{ {
QLineF line( line1.p2(), CrosPoint ); QLineF line( line1.p2(), CrosPoint );
if (line.length() > width + toPixel(8)) if (line.length() > width + qApp->toPixel(8))
{ {
QLineF lineL = QLineF(bigLine1.p2(), CrosPoint); QLineF lineL = QLineF(bigLine1.p2(), CrosPoint);
lineL.setLength(width); lineL.setLength(width);

View File

@ -31,20 +31,6 @@
#include <QTextCodec> #include <QTextCodec>
#include <QtCore> #include <QtCore>
#include "tablewindow.h" #include "tablewindow.h"
#include "options.h"
Valentina::Units patternUnit = Valentina::Cm;// Default pattern unit.
Pattern::Measurements patternType = Pattern::Individual;// Default pattern type.
#ifdef Q_OS_WIN
const QString translationsPath = QString("/translations");
#else
#ifdef QT_DEBUG
const QString translationsPath = QString("/translations");
#else
const QString translationsPath = QString("/usr/share/valentina/translations");
#endif
#endif
void myMessageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg) void myMessageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg)
{ {
@ -98,12 +84,12 @@ int main(int argc, char *argv[])
QTranslator appTranslator; QTranslator appTranslator;
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
appTranslator.load("valentina_" + checkedLocale, "."+translationsPath); appTranslator.load("valentina_" + checkedLocale, "."+qApp->translationsPath());
#else #else
#ifdef QT_DEBUG #ifdef QT_DEBUG
appTranslator.load("valentina_" + checkedLocale, "."+translationsPath); appTranslator.load("valentina_" + checkedLocale, "."+qApp->translationsPath());
#else #else
appTranslator.load("valentina_" + checkedLocale, translationsPath); appTranslator.load("valentina_" + checkedLocale, qApp->translationsPath());
#endif #endif
#endif #endif
app.installTranslator(&appTranslator); app.installTranslator(&appTranslator);

View File

@ -120,7 +120,7 @@ void MainWindow::ActionNewDraw()
measurements.exec(); measurements.exec();
if (measurements.type() == Measurements::Standard) if (measurements.type() == Measurements::Standard)
{ {
patternType == Pattern::Standard; qApp->setPatternType(Pattern::Standard);
DialogStandardMeasurements stMeasurements(pattern, patternPieceName, this); DialogStandardMeasurements stMeasurements(pattern, patternPieceName, this);
if (stMeasurements.exec() == QDialog::Accepted) if (stMeasurements.exec() == QDialog::Accepted)
{ {
@ -134,7 +134,7 @@ void MainWindow::ActionNewDraw()
} }
else else
{ {
patternType == Pattern::Individual; qApp->setPatternType(Pattern::Individual);
DialogIndividualMeasurements indMeasurements(pattern, patternPieceName, this); DialogIndividualMeasurements indMeasurements(pattern, patternPieceName, this);
if (indMeasurements.exec() == QDialog::Accepted) if (indMeasurements.exec() == QDialog::Accepted)
{ {
@ -167,7 +167,7 @@ void MainWindow::ActionNewDraw()
pattern->ClearGObjects(); pattern->ClearGObjects();
//Create single point //Create single point
const quint32 id = pattern->AddGObject(new VPointF(toPixel((10+comboBoxDraws->count()*5)), toPixel(10), "А", 5, const quint32 id = pattern->AddGObject(new VPointF(qApp->toPixel((10+comboBoxDraws->count()*5)), qApp->toPixel(10), "А", 5,
10)); 10));
VToolSinglePoint *spoint = new VToolSinglePoint(doc, pattern, id, Valentina::FromGui); VToolSinglePoint *spoint = new VToolSinglePoint(doc, pattern, id, Valentina::FromGui);
sceneDraw->addItem(spoint); sceneDraw->addItem(spoint);
@ -626,8 +626,8 @@ void MainWindow::currentDrawChanged( int index )
void MainWindow::mouseMove(const QPointF &scenePos) void MainWindow::mouseMove(const QPointF &scenePos)
{ {
QString string = QString("%1, %2") QString string = QString("%1, %2")
.arg(static_cast<qint32>(fromPixel(scenePos.x()))) .arg(static_cast<qint32>(qApp->fromPixel(scenePos.x())))
.arg(static_cast<qint32>(fromPixel(scenePos.y()))); .arg(static_cast<qint32>(qApp->fromPixel(scenePos.y())));
mouseCoordinate->setText(string); mouseCoordinate->setText(string);
} }

View File

@ -101,8 +101,6 @@ Q_DECLARE_OPERATORS_FOR_FLAGS( Valentina::Sources )
Q_DECLARE_OPERATORS_FOR_FLAGS( Valentina::Draws ) Q_DECLARE_OPERATORS_FOR_FLAGS( Valentina::Draws )
Q_DECLARE_OPERATORS_FOR_FLAGS( Valentina::Units ) Q_DECLARE_OPERATORS_FOR_FLAGS( Valentina::Units )
extern Valentina::Units patternUnit;
namespace Pattern namespace Pattern
{ {
/** /**
@ -111,51 +109,7 @@ namespace Pattern
enum Measurement { Standard, Individual }; enum Measurement { Standard, Individual };
Q_DECLARE_FLAGS(Measurements, Measurement) Q_DECLARE_FLAGS(Measurements, Measurement)
} }
Q_DECLARE_OPERATORS_FOR_FLAGS( Pattern::Measurements ) Q_DECLARE_OPERATORS_FOR_FLAGS( Pattern::Measurements )
extern Pattern::Measurements patternType;
#define PrintDPI 96.0
inline double toPixel(double unit)
{
double result = 0;
switch (patternUnit)
{
case Valentina::Mm:
result = (unit / 25.4) * PrintDPI;
break;
case Valentina::Cm:
result = ((unit * 10.0) / 25.4) * PrintDPI;
break;
case Valentina::In:
result = unit * PrintDPI;
break;
default:
break;
}
return result;
}
inline double fromPixel(double pix)
{
double result = 0;
switch (patternUnit)
{
case Valentina::Mm:
result = (pix / PrintDPI) * 25.4;
break;
case Valentina::Cm:
result = ((pix / PrintDPI) * 25.4) / 10.0;
break;
case Valentina::In:
result = pix / PrintDPI;
break;
default:
break;
}
return result;
}
#define widthMainLine 1.2 //mm #define widthMainLine 1.2 //mm
#define widthHairLine widthMainLine/3 #define widthHairLine widthMainLine/3

View File

@ -47,7 +47,6 @@ were in use. */
#include <QtXml> #include <QtXml>
#include <QtWidgets> #include <QtWidgets>
#include <QtSvg/QtSvg> #include <QtSvg/QtSvg>
#include "options.h"
#endif #endif
#endif // STABLE_H #endif // STABLE_H

View File

@ -31,7 +31,7 @@
#include "widgets/vtablegraphicsview.h" #include "widgets/vtablegraphicsview.h"
#include <QtSvg> #include <QtSvg>
#include <QPrinter> #include <QPrinter>
#include "options.h" #include "widgets/vapplication.h"
TableWindow::TableWindow(QWidget *parent) TableWindow::TableWindow(QWidget *parent)
:QMainWindow(parent), numberDetal(nullptr), colission(nullptr), ui(new Ui::TableWindow), :QMainWindow(parent), numberDetal(nullptr), colission(nullptr), ui(new Ui::TableWindow),
@ -45,8 +45,8 @@ TableWindow::TableWindow(QWidget *parent)
ui->statusBar->addWidget(numberDetal); ui->statusBar->addWidget(numberDetal);
ui->statusBar->addWidget(colission); ui->statusBar->addWidget(colission);
outItems = collidingItems = false; outItems = collidingItems = false;
//sceneRect = QRectF(0, 0, toPixel(203), toPixel(287)); //sceneRect = QRectF(0, 0, qApp->toPixel(203), qApp->toPixel(287));
sceneRect = QRectF(0, 0, toPixel(823), toPixel(1171)); sceneRect = QRectF(0, 0, qApp->toPixel(823), qApp->toPixel(1171));
tableScene = new QGraphicsScene(sceneRect); tableScene = new QGraphicsScene(sceneRect);
QBrush brush; QBrush brush;
brush.setStyle( Qt::SolidPattern ); brush.setStyle( Qt::SolidPattern );
@ -81,7 +81,7 @@ void TableWindow::AddPaper()
shadowPaper->setBrush(QBrush(Qt::black)); shadowPaper->setBrush(QBrush(Qt::black));
tableScene->addItem(shadowPaper); tableScene->addItem(shadowPaper);
paper = new QGraphicsRectItem(QRectF(x1, y1, x2, y2)); paper = new QGraphicsRectItem(QRectF(x1, y1, x2, y2));
paper->setPen(QPen(Qt::black, toPixel(widthMainLine))); paper->setPen(QPen(Qt::black, qApp->toPixel(widthMainLine)));
paper->setBrush(QBrush(Qt::white)); paper->setBrush(QBrush(Qt::white));
tableScene->addItem(paper); tableScene->addItem(paper);
qDebug()<<paper->rect().size().toSize(); qDebug()<<paper->rect().size().toSize();
@ -168,7 +168,7 @@ void TableWindow::StopTable()
delete listOutItems; delete listOutItems;
listDetails.clear(); listDetails.clear();
//sceneRect = QRectF(0, 0, 230*resol/25.9, 327*resol/25.9); //sceneRect = QRectF(0, 0, 230*resol/25.9, 327*resol/25.9);
sceneRect = QRectF(0, 0, toPixel(823), toPixel(1171)); sceneRect = QRectF(0, 0, qApp->toPixel(823), qApp->toPixel(1171));
emit closed(); emit closed();
} }
@ -216,6 +216,7 @@ void TableWindow::saveScene()
tableScene->setBackgroundBrush( *brush ); tableScene->setBackgroundBrush( *brush );
tableScene->clearSelection(); // Selections would also render to the file, so need delete them tableScene->clearSelection(); // Selections would also render to the file, so need delete them
shadowPaper->setVisible(false); shadowPaper->setVisible(false);
paper->setPen(QPen(Qt::white, 0.1, Qt::NoPen));
QFileInfo fi( name ); QFileInfo fi( name );
QStringList suffix; QStringList suffix;
suffix << "svg" << "png" << "pdf" << "eps" << "ps"; suffix << "svg" << "png" << "pdf" << "eps" << "ps";
@ -226,30 +227,23 @@ void TableWindow::saveScene()
SvgFile(name); SvgFile(name);
paper->setVisible(true); paper->setVisible(true);
break; break;
case 1: //png case 1: //png
paper->setPen(QPen(Qt::white, 0.1, Qt::NoPen));
PngFile(name); PngFile(name);
paper->setPen(QPen(Qt::black, toPixel(widthMainLine)));
break; break;
case 2: //pdf case 2: //pdf
paper->setPen(QPen(Qt::white, 0.1, Qt::NoPen)); PdfFile(name);
PdfFile(name);
paper->setPen(QPen(Qt::black, toPixel(widthMainLine)));
break; break;
case 3: //eps case 3: //eps
paper->setPen(QPen(Qt::white, 0.1, Qt::NoPen));
EpsFile(name); EpsFile(name);
paper->setPen(QPen(Qt::black, toPixel(widthMainLine)));
break; break;
case 4: //ps case 4: //ps
paper->setPen(QPen(Qt::white, 0.1, Qt::NoPen));
PsFile(name); PsFile(name);
paper->setPen(QPen(Qt::black, toPixel(widthMainLine)));
break; break;
default: default:
qWarning() << "Bad file suffix"<<Q_FUNC_INFO; qWarning() << "Bad file suffix"<<Q_FUNC_INFO;
break; break;
} }
paper->setPen(QPen(Qt::black, qApp->toPixel(widthMainLine)));
brush->setColor( QColor( Qt::gray ) ); brush->setColor( QColor( Qt::gray ) );
brush->setStyle( Qt::SolidPattern ); brush->setStyle( Qt::SolidPattern );
tableScene->setBackgroundBrush( *brush ); tableScene->setBackgroundBrush( *brush );
@ -323,7 +317,7 @@ void TableWindow::itemColliding(QList<QGraphicsItem *> list, int number)
{ {
VItem * bitem = qgraphicsitem_cast<VItem *> ( listCollidingItems.at(i) ); VItem * bitem = qgraphicsitem_cast<VItem *> ( listCollidingItems.at(i) );
Q_CHECK_PTR(bitem); Q_CHECK_PTR(bitem);
bitem->setPen(QPen(Qt::black, toPixel(widthMainLine))); bitem->setPen(QPen(Qt::black, qApp->toPixel(widthMainLine)));
listCollidingItems.removeAt(i); listCollidingItems.removeAt(i);
} }
} }
@ -332,7 +326,7 @@ void TableWindow::itemColliding(QList<QGraphicsItem *> list, int number)
{ {
VItem * bitem = qgraphicsitem_cast<VItem *> ( listCollidingItems.at(0) ); VItem * bitem = qgraphicsitem_cast<VItem *> ( listCollidingItems.at(0) );
Q_CHECK_PTR(bitem); Q_CHECK_PTR(bitem);
bitem->setPen(QPen(Qt::black, toPixel(widthMainLine))); bitem->setPen(QPen(Qt::black, qApp->toPixel(widthMainLine)));
listCollidingItems.clear(); listCollidingItems.clear();
collidingItems = true; collidingItems = true;
} }
@ -378,13 +372,13 @@ void TableWindow::GetNextDetail()
void TableWindow::AddLength() void TableWindow::AddLength()
{ {
QRectF rect = tableScene->sceneRect(); QRectF rect = tableScene->sceneRect();
rect.setHeight(rect.height()+toPixel(279)); rect.setHeight(rect.height()+qApp->toPixel(279));
tableScene->setSceneRect(rect); tableScene->setSceneRect(rect);
rect = shadowPaper->rect(); rect = shadowPaper->rect();
rect.setHeight(rect.height()+toPixel(279)); rect.setHeight(rect.height()+qApp->toPixel(279));
shadowPaper->setRect(rect); shadowPaper->setRect(rect);
rect = paper->rect(); rect = paper->rect();
rect.setHeight(rect.height()+toPixel(279)); rect.setHeight(rect.height()+qApp->toPixel(279));
paper->setRect(rect); paper->setRect(rect);
ui->actionRemove->setEnabled(true); ui->actionRemove->setEnabled(true);
emit LengthChanged(); emit LengthChanged();
@ -395,13 +389,13 @@ void TableWindow::RemoveLength()
if (sceneRect.height() <= tableScene->sceneRect().height() - 100) if (sceneRect.height() <= tableScene->sceneRect().height() - 100)
{ {
QRectF rect = tableScene->sceneRect(); QRectF rect = tableScene->sceneRect();
rect.setHeight(rect.height()-toPixel(279)); rect.setHeight(rect.height()-qApp->toPixel(279));
tableScene->setSceneRect(rect); tableScene->setSceneRect(rect);
rect = shadowPaper->rect(); rect = shadowPaper->rect();
rect.setHeight(rect.height()-toPixel(279)); rect.setHeight(rect.height()-qApp->toPixel(279));
shadowPaper->setRect(rect); shadowPaper->setRect(rect);
rect = paper->rect(); rect = paper->rect();
rect.setHeight(rect.height()-toPixel(279)); rect.setHeight(rect.height()-qApp->toPixel(279));
paper->setRect(rect); paper->setRect(rect);
if (fabs(sceneRect.height() - tableScene->sceneRect().height()) < 0.01) if (fabs(sceneRect.height() - tableScene->sceneRect().height()) < 0.01)
{ {
@ -437,12 +431,12 @@ void TableWindow::SvgFile(const QString &name) const
generator.setViewBox(paper->rect()); generator.setViewBox(paper->rect());
generator.setTitle("Valentina pattern"); generator.setTitle("Valentina pattern");
generator.setDescription(description); generator.setDescription(description);
generator.setResolution(PrintDPI); generator.setResolution(static_cast<int>(qApp->PrintDPI));
QPainter painter; QPainter painter;
painter.begin(&generator); painter.begin(&generator);
painter.setFont( QFont( "Arial", 8, QFont::Normal ) ); painter.setFont( QFont( "Arial", 8, QFont::Normal ) );
painter.setRenderHint(QPainter::Antialiasing, true); painter.setRenderHint(QPainter::Antialiasing, true);
painter.setPen(QPen(Qt::black, toPixel(widthHairLine), Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); painter.setPen(QPen(Qt::black, qApp->toPixel(widthHairLine), Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
painter.setBrush ( QBrush ( Qt::NoBrush ) ); painter.setBrush ( QBrush ( Qt::NoBrush ) );
tableScene->render(&painter); tableScene->render(&painter);
painter.end(); painter.end();
@ -459,7 +453,7 @@ void TableWindow::PngFile(const QString &name) const
QPainter painter(&image); QPainter painter(&image);
painter.setFont( QFont( "Arial", 8, QFont::Normal ) ); painter.setFont( QFont( "Arial", 8, QFont::Normal ) );
painter.setRenderHint(QPainter::Antialiasing, true); painter.setRenderHint(QPainter::Antialiasing, true);
painter.setPen(QPen(Qt::black, toPixel(widthMainLine), Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); painter.setPen(QPen(Qt::black, qApp->toPixel(widthMainLine), Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
painter.setBrush ( QBrush ( Qt::NoBrush ) ); painter.setBrush ( QBrush ( Qt::NoBrush ) );
tableScene->render(&painter); tableScene->render(&painter);
image.save(name); image.save(name);
@ -473,8 +467,8 @@ void TableWindow::PdfFile(const QString &name) const
QRectF r = paper->rect(); QRectF r = paper->rect();
qreal x=0, y=0, w=0, h=0; qreal x=0, y=0, w=0, h=0;
r.getRect(&x, &y, &w, &h);// Re-shrink the scene to it's bounding contents r.getRect(&x, &y, &w, &h);// Re-shrink the scene to it's bounding contents
printer.setResolution(PrintDPI); printer.setResolution(static_cast<int>(qApp->PrintDPI));
printer.setPaperSize ( QSizeF(fromPixel(w), fromPixel(h)), QPrinter::Millimeter ); printer.setPaperSize ( QSizeF(qApp->fromPixel(w), qApp->fromPixel(h)), QPrinter::Millimeter );
QPainter painter; QPainter painter;
if (painter.begin( &printer ) == false) if (painter.begin( &printer ) == false)
{ // failed to open file { // failed to open file
@ -483,7 +477,7 @@ void TableWindow::PdfFile(const QString &name) const
} }
painter.setFont( QFont( "Arial", 8, QFont::Normal ) ); painter.setFont( QFont( "Arial", 8, QFont::Normal ) );
painter.setRenderHint(QPainter::Antialiasing, true); painter.setRenderHint(QPainter::Antialiasing, true);
painter.setPen(QPen(Qt::black, toPixel(widthMainLine), Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); painter.setPen(QPen(Qt::black, qApp->toPixel(widthMainLine), Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
painter.setBrush ( QBrush ( Qt::NoBrush ) ); painter.setBrush ( QBrush ( Qt::NoBrush ) );
tableScene->render(&painter); tableScene->render(&painter);
painter.end(); painter.end();

View File

@ -54,7 +54,7 @@ void VAbstractSpline::ChangedActivDraw(const QString &newName)
selectable = false; selectable = false;
currentColor = Qt::gray; currentColor = Qt::gray;
} }
this->setPen(QPen(currentColor, toPixel(widthHairLine)/factor)); this->setPen(QPen(currentColor, qApp->toPixel(widthHairLine)/factor));
this->setFlag(QGraphicsItem::ItemIsSelectable, selectable); this->setFlag(QGraphicsItem::ItemIsSelectable, selectable);
this->setAcceptHoverEvents (selectable); this->setAcceptHoverEvents (selectable);
emit setEnabledPoint(selectable); emit setEnabledPoint(selectable);
@ -75,13 +75,13 @@ void VAbstractSpline::SetFactor(qreal factor)
void VAbstractSpline::hoverMoveEvent(QGraphicsSceneHoverEvent *event) void VAbstractSpline::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
this->setPen(QPen(currentColor, toPixel(widthMainLine)/factor)); this->setPen(QPen(currentColor, qApp->toPixel(widthMainLine)/factor));
} }
void VAbstractSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) void VAbstractSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
this->setPen(QPen(currentColor, toPixel(widthHairLine)/factor)); this->setPen(QPen(currentColor, qApp->toPixel(widthHairLine)/factor));
} }
QVariant VAbstractSpline::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value) QVariant VAbstractSpline::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value)

View File

@ -196,7 +196,7 @@ protected:
{ {
currentColor = color; currentColor = color;
} }
item->setPen(QPen(currentColor, toPixel(widthHairLine)/factor)); item->setPen(QPen(currentColor, qApp->toPixel(widthHairLine)/factor));
} }
} }
private: private:

View File

@ -87,8 +87,8 @@ void VToolAlongLine::AddToFile()
doc->SetAttribute(domElement, AttrId, id); doc->SetAttribute(domElement, AttrId, id);
doc->SetAttribute(domElement, AttrType, ToolType); doc->SetAttribute(domElement, AttrType, ToolType);
doc->SetAttribute(domElement, AttrName, point->name()); doc->SetAttribute(domElement, AttrName, point->name());
doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx()));
doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my()));
doc->SetAttribute(domElement, AttrTypeLine, typeLine); doc->SetAttribute(domElement, AttrTypeLine, typeLine);
doc->SetAttribute(domElement, AttrLength, formula); doc->SetAttribute(domElement, AttrLength, formula);
@ -104,8 +104,8 @@ void VToolAlongLine::RefreshDataInFile()
QDomElement domElement = doc->elementById(QString().setNum(id)); QDomElement domElement = doc->elementById(QString().setNum(id));
if (domElement.isElement()) if (domElement.isElement())
{ {
doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx()));
doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my()));
doc->SetAttribute(domElement, AttrName, point->name()); doc->SetAttribute(domElement, AttrName, point->name());
doc->SetAttribute(domElement, AttrTypeLine, typeLine); doc->SetAttribute(domElement, AttrTypeLine, typeLine);
doc->SetAttribute(domElement, AttrLength, formula); doc->SetAttribute(domElement, AttrLength, formula);
@ -172,7 +172,7 @@ void VToolAlongLine::Create(const quint32 _id, const QString &pointName, const Q
qreal result = cal.eval(formula, &errorMsg); qreal result = cal.eval(formula, &errorMsg);
if (errorMsg.isEmpty()) if (errorMsg.isEmpty())
{ {
line.setLength(toPixel(result)); line.setLength(qApp->toPixel(result));
quint32 id = _id; quint32 id = _id;
if (typeCreation == Valentina::FromGui) if (typeCreation == Valentina::FromGui)
{ {

View File

@ -42,7 +42,7 @@ VToolArc::VToolArc(VPattern *doc, VContainer *data, quint32 id, const Valentina:
path.addPath(arc->GetPath()); path.addPath(arc->GetPath());
path.setFillRule( Qt::WindingFill ); path.setFillRule( Qt::WindingFill );
this->setPath(path); this->setPath(path);
this->setPen(QPen(Qt::black, toPixel(widthHairLine)/factor)); this->setPen(QPen(Qt::black, qApp->toPixel(widthHairLine)/factor));
this->setFlag(QGraphicsItem::ItemIsSelectable, true); this->setFlag(QGraphicsItem::ItemIsSelectable, true);
this->setFlag(QGraphicsItem::ItemIsFocusable, true); this->setFlag(QGraphicsItem::ItemIsFocusable, true);
this->setAcceptHoverEvents(true); this->setAcceptHoverEvents(true);
@ -93,7 +93,7 @@ void VToolArc::Create(const quint32 _id, const quint32 &center, const QString &r
qreal result = cal.eval(radius, &errorMsg); qreal result = cal.eval(radius, &errorMsg);
if (errorMsg.isEmpty()) if (errorMsg.isEmpty())
{ {
calcRadius = toPixel(result); calcRadius = qApp->toPixel(result);
} }
errorMsg.clear(); errorMsg.clear();
@ -155,7 +155,7 @@ void VToolArc::ChangedActivDraw(const QString &newName)
selectable = false; selectable = false;
currentColor = Qt::gray; currentColor = Qt::gray;
} }
this->setPen(QPen(currentColor, toPixel(widthHairLine)/factor)); this->setPen(QPen(currentColor, qApp->toPixel(widthHairLine)/factor));
this->setFlag(QGraphicsItem::ItemIsSelectable, selectable); this->setFlag(QGraphicsItem::ItemIsSelectable, selectable);
this->setAcceptHoverEvents (selectable); this->setAcceptHoverEvents (selectable);
VDrawTool::ChangedActivDraw(newName); VDrawTool::ChangedActivDraw(newName);
@ -218,14 +218,14 @@ void VToolArc::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
void VToolArc::hoverMoveEvent(QGraphicsSceneHoverEvent *event) void VToolArc::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
this->setPen(QPen(currentColor, toPixel(widthMainLine)/factor)); this->setPen(QPen(currentColor, qApp->toPixel(widthMainLine)/factor));
} }
//cppcheck-suppress unusedFunction //cppcheck-suppress unusedFunction
void VToolArc::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) void VToolArc::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
this->setPen(QPen(currentColor, toPixel(widthHairLine)/factor)); this->setPen(QPen(currentColor, qApp->toPixel(widthHairLine)/factor));
} }
void VToolArc::RemoveReferens() void VToolArc::RemoveReferens()
@ -278,7 +278,7 @@ void VToolArc::SaveDialog(QDomElement &domElement)
void VToolArc::RefreshGeometry() void VToolArc::RefreshGeometry()
{ {
this->setPen(QPen(currentColor, toPixel(widthHairLine)/factor)); this->setPen(QPen(currentColor, qApp->toPixel(widthHairLine)/factor));
const VArc *arc = VAbstractTool::data.GeometricObject<const VArc *>(id); const VArc *arc = VAbstractTool::data.GeometricObject<const VArc *>(id);
QPainterPath path; QPainterPath path;
path.addPath(arc->GetPath()); path.addPath(arc->GetPath());

View File

@ -115,7 +115,7 @@ void VToolBisector::Create(const quint32 _id, const QString &formula, const quin
if (errorMsg.isEmpty()) if (errorMsg.isEmpty())
{ {
QPointF fPoint = VToolBisector::FindPoint(firstPoint->toQPointF(), secondPoint->toQPointF(), QPointF fPoint = VToolBisector::FindPoint(firstPoint->toQPointF(), secondPoint->toQPointF(),
thirdPoint->toQPointF(), toPixel(result)); thirdPoint->toQPointF(), qApp->toPixel(result));
quint32 id = _id; quint32 id = _id;
if (typeCreation == Valentina::FromGui) if (typeCreation == Valentina::FromGui)
{ {
@ -185,8 +185,8 @@ void VToolBisector::AddToFile()
doc->SetAttribute(domElement, AttrId, id); doc->SetAttribute(domElement, AttrId, id);
doc->SetAttribute(domElement, AttrType, ToolType); doc->SetAttribute(domElement, AttrType, ToolType);
doc->SetAttribute(domElement, AttrName, point->name()); doc->SetAttribute(domElement, AttrName, point->name());
doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx()));
doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my()));
doc->SetAttribute(domElement, AttrTypeLine, typeLine); doc->SetAttribute(domElement, AttrTypeLine, typeLine);
doc->SetAttribute(domElement, AttrLength, formula); doc->SetAttribute(domElement, AttrLength, formula);
@ -203,8 +203,8 @@ void VToolBisector::RefreshDataInFile()
QDomElement domElement = doc->elementById(QString().setNum(id)); QDomElement domElement = doc->elementById(QString().setNum(id));
if (domElement.isElement()) if (domElement.isElement())
{ {
doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx()));
doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my()));
doc->SetAttribute(domElement, AttrName, point->name()); doc->SetAttribute(domElement, AttrName, point->name());
doc->SetAttribute(domElement, AttrTypeLine, typeLine); doc->SetAttribute(domElement, AttrTypeLine, typeLine);
doc->SetAttribute(domElement, AttrLength, formula); doc->SetAttribute(domElement, AttrLength, formula);

View File

@ -98,7 +98,7 @@ void VToolCutArc::Create(const quint32 _id, const QString &pointName, const QStr
{ {
VArc arc1; VArc arc1;
VArc arc2; VArc arc2;
QPointF point = arc->CutArc(toPixel(result), arc1, arc2); QPointF point = arc->CutArc(qApp->toPixel(result), arc1, arc2);
quint32 id = _id; quint32 id = _id;
quint32 arc1id = 0; quint32 arc1id = 0;
@ -185,8 +185,8 @@ void VToolCutArc::ChangedActivDraw(const QString &newName)
secondArc->setFlag(QGraphicsItem::ItemIsSelectable, false); secondArc->setFlag(QGraphicsItem::ItemIsSelectable, false);
secondArc->setAcceptHoverEvents(false); secondArc->setAcceptHoverEvents(false);
} }
firstArc->setPen(QPen(currentColor, toPixel(widthHairLine)/factor)); firstArc->setPen(QPen(currentColor, qApp->toPixel(widthHairLine)/factor));
secondArc->setPen(QPen(currentColor, toPixel(widthHairLine)/factor)); secondArc->setPen(QPen(currentColor, qApp->toPixel(widthHairLine)/factor));
VToolPoint::ChangedActivDraw(newName); VToolPoint::ChangedActivDraw(newName);
} }
@ -208,8 +208,8 @@ void VToolCutArc::AddToFile()
doc->SetAttribute(domElement, AttrId, id); doc->SetAttribute(domElement, AttrId, id);
doc->SetAttribute(domElement, AttrType, ToolType); doc->SetAttribute(domElement, AttrType, ToolType);
doc->SetAttribute(domElement, AttrName, point->name()); doc->SetAttribute(domElement, AttrName, point->name());
doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx()));
doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my()));
doc->SetAttribute(domElement, AttrLength, formula); doc->SetAttribute(domElement, AttrLength, formula);
doc->SetAttribute(domElement, AttrArc, arcId); doc->SetAttribute(domElement, AttrArc, arcId);
@ -224,8 +224,8 @@ void VToolCutArc::RefreshDataInFile()
if (domElement.isElement()) if (domElement.isElement())
{ {
doc->SetAttribute(domElement, AttrName, point->name()); doc->SetAttribute(domElement, AttrName, point->name());
doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx()));
doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my()));
doc->SetAttribute(domElement, AttrLength, formula); doc->SetAttribute(domElement, AttrLength, formula);
doc->SetAttribute(domElement, AttrArc, arcId); doc->SetAttribute(domElement, AttrArc, arcId);
} }

View File

@ -98,7 +98,7 @@ void VToolCutSpline::Create(const quint32 _id, const QString &pointName,
if (errorMsg.isEmpty()) if (errorMsg.isEmpty())
{ {
QPointF spl1p2, spl1p3, spl2p2, spl2p3; QPointF spl1p2, spl1p3, spl2p2, spl2p3;
QPointF point = spl->CutSpline(toPixel(result), spl1p2, spl1p3, spl2p2, spl2p3); QPointF point = spl->CutSpline(qApp->toPixel(result), spl1p2, spl1p3, spl2p2, spl2p3);
quint32 id = _id; quint32 id = _id;
quint32 spl1id = 0; quint32 spl1id = 0;
@ -110,11 +110,11 @@ void VToolCutSpline::Create(const quint32 _id, const QString &pointName,
VSpline *spline1 = new VSpline(spl->GetP1(), spl1p2, spl1p3, *p, spl->GetKcurve()); VSpline *spline1 = new VSpline(spl->GetP1(), spl1p2, spl1p3, *p, spl->GetKcurve());
spl1id = data->AddGObject(spline1); spl1id = data->AddGObject(spline1);
data->AddLengthSpline(spline1->name(), fromPixel(spline1->GetLength())); data->AddLengthSpline(spline1->name(), qApp->fromPixel(spline1->GetLength()));
VSpline *spline2 = new VSpline(*p, spl2p2, spl2p3, spl->GetP4(), spl->GetKcurve()); VSpline *spline2 = new VSpline(*p, spl2p2, spl2p3, spl->GetP4(), spl->GetKcurve());
spl2id = data->AddGObject(spline2); spl2id = data->AddGObject(spline2);
data->AddLengthSpline(spline2->name(), fromPixel(spline2->GetLength())); data->AddLengthSpline(spline2->name(), qApp->fromPixel(spline2->GetLength()));
} }
else else
{ {
@ -126,11 +126,11 @@ void VToolCutSpline::Create(const quint32 _id, const QString &pointName,
VSpline *spline1 = new VSpline(spl->GetP1(), spl1p2, spl1p3, *p, spl->GetKcurve()); VSpline *spline1 = new VSpline(spl->GetP1(), spl1p2, spl1p3, *p, spl->GetKcurve());
data->UpdateGObject(spl1id, spline1); data->UpdateGObject(spl1id, spline1);
data->AddLengthSpline(spline1->name(), fromPixel(spline1->GetLength())); data->AddLengthSpline(spline1->name(), qApp->fromPixel(spline1->GetLength()));
VSpline *spline2 = new VSpline(*p, spl2p2, spl2p3, spl->GetP4(), spl->GetKcurve()); VSpline *spline2 = new VSpline(*p, spl2p2, spl2p3, spl->GetP4(), spl->GetKcurve());
data->UpdateGObject(spl2id, spline2); data->UpdateGObject(spl2id, spline2);
data->AddLengthSpline(spline2->name(), fromPixel(spline2->GetLength())); data->AddLengthSpline(spline2->name(), qApp->fromPixel(spline2->GetLength()));
if (parse != Document::FullParse) if (parse != Document::FullParse)
{ {
@ -204,8 +204,8 @@ void VToolCutSpline::AddToFile()
doc->SetAttribute(domElement, AttrId, id); doc->SetAttribute(domElement, AttrId, id);
doc->SetAttribute(domElement, AttrType, ToolType); doc->SetAttribute(domElement, AttrType, ToolType);
doc->SetAttribute(domElement, AttrName, point->name()); doc->SetAttribute(domElement, AttrName, point->name());
doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx()));
doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my()));
doc->SetAttribute(domElement, AttrLength, formula); doc->SetAttribute(domElement, AttrLength, formula);
doc->SetAttribute(domElement, AttrSpline, splineId); doc->SetAttribute(domElement, AttrSpline, splineId);
@ -220,8 +220,8 @@ void VToolCutSpline::RefreshDataInFile()
if (domElement.isElement()) if (domElement.isElement())
{ {
doc->SetAttribute(domElement, AttrName, point->name()); doc->SetAttribute(domElement, AttrName, point->name());
doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx()));
doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my()));
doc->SetAttribute(domElement, AttrLength, formula); doc->SetAttribute(domElement, AttrLength, formula);
doc->SetAttribute(domElement, AttrSpline, splineId); doc->SetAttribute(domElement, AttrSpline, splineId);
} }

View File

@ -102,7 +102,7 @@ void VToolCutSplinePath::Create(const quint32 _id, const QString &pointName, con
QPointF spl1p2, spl1p3, spl2p2, spl2p3; QPointF spl1p2, spl1p3, spl2p2, spl2p3;
qint32 p1 = 0, p2 = 0; qint32 p1 = 0, p2 = 0;
const QPointF point = splPath->CutSplinePath(toPixel(result), p1, p2, spl1p2, spl1p3, spl2p2, spl2p3); const QPointF point = splPath->CutSplinePath(qApp->toPixel(result), p1, p2, spl1p2, spl1p3, spl2p2, spl2p3);
VPointF *p = new VPointF(point.x(), point.y(), pointName, mx, my); VPointF *p = new VPointF(point.x(), point.y(), pointName, mx, my);
if (typeCreation == Valentina::FromGui) if (typeCreation == Valentina::FromGui)
{ {
@ -159,10 +159,10 @@ void VToolCutSplinePath::Create(const quint32 _id, const QString &pointName, con
splPath2->setMaxCountPoints(splPath->CountPoint()); splPath2->setMaxCountPoints(splPath->CountPoint());
splPath1id = data->AddGObject(splPath1); splPath1id = data->AddGObject(splPath1);
data->AddLengthSpline(splPath1->name(), fromPixel(splPath1->GetLength())); data->AddLengthSpline(splPath1->name(), qApp->fromPixel(splPath1->GetLength()));
splPath2id = data->AddGObject(splPath2); splPath2id = data->AddGObject(splPath2);
data->AddLengthSpline(splPath2->name(), fromPixel(splPath2->GetLength())); data->AddLengthSpline(splPath2->name(), qApp->fromPixel(splPath2->GetLength()));
} }
else else
{ {
@ -200,10 +200,10 @@ void VToolCutSplinePath::Create(const quint32 _id, const QString &pointName, con
splPath2->setMaxCountPoints(splPath->CountPoint()); splPath2->setMaxCountPoints(splPath->CountPoint());
data->UpdateGObject(splPath1id, splPath1); data->UpdateGObject(splPath1id, splPath1);
data->AddLengthSpline(splPath1->name(), fromPixel(splPath1->GetLength())); data->AddLengthSpline(splPath1->name(), qApp->fromPixel(splPath1->GetLength()));
data->UpdateGObject(splPath2id, splPath2); data->UpdateGObject(splPath2id, splPath2);
data->AddLengthSpline(splPath2->name(), fromPixel(splPath2->GetLength())); data->AddLengthSpline(splPath2->name(), qApp->fromPixel(splPath2->GetLength()));
if (parse != Document::FullParse) if (parse != Document::FullParse)
{ {
@ -278,8 +278,8 @@ void VToolCutSplinePath::AddToFile()
doc->SetAttribute(domElement, AttrId, id); doc->SetAttribute(domElement, AttrId, id);
doc->SetAttribute(domElement, AttrType, ToolType); doc->SetAttribute(domElement, AttrType, ToolType);
doc->SetAttribute(domElement, AttrName, point->name()); doc->SetAttribute(domElement, AttrName, point->name());
doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx()));
doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my()));
doc->SetAttribute(domElement, AttrLength, formula); doc->SetAttribute(domElement, AttrLength, formula);
doc->SetAttribute(domElement, AttrSplinePath, splinePathId); doc->SetAttribute(domElement, AttrSplinePath, splinePathId);
@ -294,8 +294,8 @@ void VToolCutSplinePath::RefreshDataInFile()
if (domElement.isElement()) if (domElement.isElement())
{ {
doc->SetAttribute(domElement, AttrName, point->name()); doc->SetAttribute(domElement, AttrName, point->name());
doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx()));
doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my()));
doc->SetAttribute(domElement, AttrLength, formula); doc->SetAttribute(domElement, AttrLength, formula);
doc->SetAttribute(domElement, AttrSplinePath, splinePathId); doc->SetAttribute(domElement, AttrSplinePath, splinePathId);
} }

View File

@ -89,7 +89,7 @@ void VToolEndLine::Create(const quint32 _id, const QString &pointName, const QSt
qreal result = cal.eval(formula, &errorMsg); qreal result = cal.eval(formula, &errorMsg);
if (errorMsg.isEmpty()) if (errorMsg.isEmpty())
{ {
line.setLength(toPixel(result)); line.setLength(qApp->toPixel(result));
line.setAngle(angle); line.setAngle(angle);
quint32 id = _id; quint32 id = _id;
if (typeCreation == Valentina::FromGui) if (typeCreation == Valentina::FromGui)
@ -151,8 +151,8 @@ void VToolEndLine::AddToFile()
doc->SetAttribute(domElement, AttrId, id); doc->SetAttribute(domElement, AttrId, id);
doc->SetAttribute(domElement, AttrType, ToolType); doc->SetAttribute(domElement, AttrType, ToolType);
doc->SetAttribute(domElement, AttrName, point->name()); doc->SetAttribute(domElement, AttrName, point->name());
doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx()));
doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my()));
doc->SetAttribute(domElement, AttrTypeLine, typeLine); doc->SetAttribute(domElement, AttrTypeLine, typeLine);
doc->SetAttribute(domElement, AttrLength, formula); doc->SetAttribute(domElement, AttrLength, formula);
@ -169,8 +169,8 @@ void VToolEndLine::RefreshDataInFile()
if (domElement.isElement()) if (domElement.isElement())
{ {
doc->SetAttribute(domElement, AttrName, point->name()); doc->SetAttribute(domElement, AttrName, point->name());
doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx()));
doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my()));
doc->SetAttribute(domElement, AttrTypeLine, typeLine); doc->SetAttribute(domElement, AttrTypeLine, typeLine);
doc->SetAttribute(domElement, AttrLength, formula); doc->SetAttribute(domElement, AttrLength, formula);
doc->SetAttribute(domElement, AttrAngle, angle); doc->SetAttribute(domElement, AttrAngle, angle);

View File

@ -157,8 +157,8 @@ void VToolHeight::AddToFile()
doc->SetAttribute(domElement, AttrId, id); doc->SetAttribute(domElement, AttrId, id);
doc->SetAttribute(domElement, AttrType, ToolType); doc->SetAttribute(domElement, AttrType, ToolType);
doc->SetAttribute(domElement, AttrName, point->name()); doc->SetAttribute(domElement, AttrName, point->name());
doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx()));
doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my()));
doc->SetAttribute(domElement, AttrTypeLine, typeLine); doc->SetAttribute(domElement, AttrTypeLine, typeLine);
doc->SetAttribute(domElement, AttrBasePoint, basePointId); doc->SetAttribute(domElement, AttrBasePoint, basePointId);
@ -176,8 +176,8 @@ void VToolHeight::RefreshDataInFile()
if (domElement.isElement()) if (domElement.isElement())
{ {
doc->SetAttribute(domElement, AttrName, point->name()); doc->SetAttribute(domElement, AttrName, point->name());
doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx()));
doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my()));
doc->SetAttribute(domElement, AttrTypeLine, typeLine); doc->SetAttribute(domElement, AttrTypeLine, typeLine);
doc->SetAttribute(domElement, AttrBasePoint, basePointId); doc->SetAttribute(domElement, AttrBasePoint, basePointId);
doc->SetAttribute(domElement, AttrP1Line, p1LineId); doc->SetAttribute(domElement, AttrP1Line, p1LineId);

View File

@ -45,7 +45,7 @@ VToolLine::VToolLine(VPattern *doc, VContainer *data, quint32 id, quint32 firstP
this->setFlag(QGraphicsItem::ItemIsSelectable, true); this->setFlag(QGraphicsItem::ItemIsSelectable, true);
this->setFlag(QGraphicsItem::ItemIsFocusable, true); this->setFlag(QGraphicsItem::ItemIsFocusable, true);
this->setAcceptHoverEvents(true); this->setAcceptHoverEvents(true);
this->setPen(QPen(Qt::black, toPixel(widthHairLine)/factor, LineStyle())); this->setPen(QPen(Qt::black, qApp->toPixel(widthHairLine)/factor, LineStyle()));
if (typeCreation == Valentina::FromGui) if (typeCreation == Valentina::FromGui)
{ {
@ -142,7 +142,7 @@ void VToolLine::ChangedActivDraw(const QString &newName)
selectable = false; selectable = false;
currentColor = Qt::gray; currentColor = Qt::gray;
} }
this->setPen(QPen(currentColor, toPixel(widthHairLine)/factor, LineStyle())); this->setPen(QPen(currentColor, qApp->toPixel(widthHairLine)/factor, LineStyle()));
this->setAcceptHoverEvents (selectable); this->setAcceptHoverEvents (selectable);
VDrawTool::ChangedActivDraw(newName); VDrawTool::ChangedActivDraw(newName);
} }
@ -177,13 +177,13 @@ void VToolLine::RefreshDataInFile()
void VToolLine::hoverMoveEvent(QGraphicsSceneHoverEvent *event) void VToolLine::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
this->setPen(QPen(currentColor, toPixel(widthMainLine)/factor, LineStyle())); this->setPen(QPen(currentColor, qApp->toPixel(widthMainLine)/factor, LineStyle()));
} }
void VToolLine::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) void VToolLine::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
this->setPen(QPen(currentColor, toPixel(widthHairLine)/factor, LineStyle())); this->setPen(QPen(currentColor, qApp->toPixel(widthHairLine)/factor, LineStyle()));
} }
void VToolLine::RemoveReferens() void VToolLine::RemoveReferens()
@ -245,5 +245,5 @@ void VToolLine::RefreshGeometry()
const VPointF *first = VAbstractTool::data.GeometricObject<const VPointF *>(firstPoint); const VPointF *first = VAbstractTool::data.GeometricObject<const VPointF *>(firstPoint);
const VPointF *second = VAbstractTool::data.GeometricObject<const VPointF *>(secondPoint); const VPointF *second = VAbstractTool::data.GeometricObject<const VPointF *>(secondPoint);
this->setLine(QLineF(first->toQPointF(), second->toQPointF())); this->setLine(QLineF(first->toQPointF(), second->toQPointF()));
this->setPen(QPen(currentColor, toPixel(widthHairLine)/factor, LineStyle())); this->setPen(QPen(currentColor, qApp->toPixel(widthHairLine)/factor, LineStyle()));
} }

View File

@ -168,8 +168,8 @@ void VToolLineIntersect::AddToFile()
doc->SetAttribute(domElement, AttrId, id); doc->SetAttribute(domElement, AttrId, id);
doc->SetAttribute(domElement, AttrType, ToolType); doc->SetAttribute(domElement, AttrType, ToolType);
doc->SetAttribute(domElement, AttrName, point->name()); doc->SetAttribute(domElement, AttrName, point->name());
doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx()));
doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my()));
doc->SetAttribute(domElement, AttrP1Line1, p1Line1); doc->SetAttribute(domElement, AttrP1Line1, p1Line1);
doc->SetAttribute(domElement, AttrP2Line1, p2Line1); doc->SetAttribute(domElement, AttrP2Line1, p2Line1);
@ -186,8 +186,8 @@ void VToolLineIntersect::RefreshDataInFile()
if (domElement.isElement()) if (domElement.isElement())
{ {
doc->SetAttribute(domElement, AttrName, point->name()); doc->SetAttribute(domElement, AttrName, point->name());
doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx()));
doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my()));
doc->SetAttribute(domElement, AttrP1Line1, p1Line1); doc->SetAttribute(domElement, AttrP1Line1, p1Line1);
doc->SetAttribute(domElement, AttrP2Line1, p2Line1); doc->SetAttribute(domElement, AttrP2Line1, p2Line1);
doc->SetAttribute(domElement, AttrP1Line2, p1Line2); doc->SetAttribute(domElement, AttrP1Line2, p1Line2);

View File

@ -39,7 +39,7 @@ VToolLinePoint::VToolLinePoint(VPattern *doc, VContainer *data, const quint32 &i
QPointF point1 = data->GeometricObject<const VPointF *>(basePointId)->toQPointF(); QPointF point1 = data->GeometricObject<const VPointF *>(basePointId)->toQPointF();
QPointF point2 = data->GeometricObject<const VPointF *>(id)->toQPointF(); QPointF point2 = data->GeometricObject<const VPointF *>(id)->toQPointF();
mainLine = new QGraphicsLineItem(QLineF(point1 - point2, QPointF()), this); mainLine = new QGraphicsLineItem(QLineF(point1 - point2, QPointF()), this);
mainLine->setPen(QPen(Qt::black, toPixel(widthHairLine)/factor, LineStyle())); mainLine->setPen(QPen(Qt::black, qApp->toPixel(widthHairLine)/factor, LineStyle()));
mainLine->setFlag(QGraphicsItem::ItemStacksBehindParent, true); mainLine->setFlag(QGraphicsItem::ItemStacksBehindParent, true);
} }
@ -53,13 +53,13 @@ void VToolLinePoint::ChangedActivDraw(const QString &newName)
{ {
currentColor = Qt::gray; currentColor = Qt::gray;
} }
mainLine->setPen(QPen(currentColor, toPixel(widthHairLine)/factor, LineStyle())); mainLine->setPen(QPen(currentColor, qApp->toPixel(widthHairLine)/factor, LineStyle()));
VToolPoint::ChangedActivDraw(newName); VToolPoint::ChangedActivDraw(newName);
} }
void VToolLinePoint::RefreshGeometry() void VToolLinePoint::RefreshGeometry()
{ {
mainLine->setPen(QPen(currentColor, toPixel(widthHairLine)/factor, LineStyle())); mainLine->setPen(QPen(currentColor, qApp->toPixel(widthHairLine)/factor, LineStyle()));
VToolPoint::RefreshPointGeometry(*VDrawTool::data.GeometricObject<const VPointF *>(id)); VToolPoint::RefreshPointGeometry(*VDrawTool::data.GeometricObject<const VPointF *>(id));
QPointF point = VDrawTool::data.GeometricObject<const VPointF *>(id)->toQPointF(); QPointF point = VDrawTool::data.GeometricObject<const VPointF *>(id)->toQPointF();
QPointF basePoint = VDrawTool::data.GeometricObject<const VPointF *>(basePointId)->toQPointF(); QPointF basePoint = VDrawTool::data.GeometricObject<const VPointF *>(basePointId)->toQPointF();

View File

@ -92,7 +92,7 @@ void VToolNormal::Create(const quint32 _id, const QString &formula, const quint3
if (errorMsg.isEmpty()) if (errorMsg.isEmpty())
{ {
QPointF fPoint = VToolNormal::FindPoint(firstPoint->toQPointF(), secondPoint->toQPointF(), QPointF fPoint = VToolNormal::FindPoint(firstPoint->toQPointF(), secondPoint->toQPointF(),
toPixel(result), angle); qApp->toPixel(result), angle);
quint32 id = _id; quint32 id = _id;
if (typeCreation == Valentina::FromGui) if (typeCreation == Valentina::FromGui)
{ {
@ -171,8 +171,8 @@ void VToolNormal::AddToFile()
doc->SetAttribute(domElement, AttrId, id); doc->SetAttribute(domElement, AttrId, id);
doc->SetAttribute(domElement, AttrType, ToolType); doc->SetAttribute(domElement, AttrType, ToolType);
doc->SetAttribute(domElement, AttrName, point->name()); doc->SetAttribute(domElement, AttrName, point->name());
doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx()));
doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my()));
doc->SetAttribute(domElement, AttrTypeLine, typeLine); doc->SetAttribute(domElement, AttrTypeLine, typeLine);
doc->SetAttribute(domElement, AttrLength, formula); doc->SetAttribute(domElement, AttrLength, formula);
@ -190,8 +190,8 @@ void VToolNormal::RefreshDataInFile()
if (domElement.isElement()) if (domElement.isElement())
{ {
doc->SetAttribute(domElement, AttrName, point->name()); doc->SetAttribute(domElement, AttrName, point->name());
doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx()));
doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my()));
doc->SetAttribute(domElement, AttrTypeLine, typeLine); doc->SetAttribute(domElement, AttrTypeLine, typeLine);
doc->SetAttribute(domElement, AttrLength, formula); doc->SetAttribute(domElement, AttrLength, formula);
doc->SetAttribute(domElement, AttrAngle, angle); doc->SetAttribute(domElement, AttrAngle, angle);

View File

@ -31,7 +31,7 @@
const QString VToolPoint::TagName = QStringLiteral("point"); const QString VToolPoint::TagName = QStringLiteral("point");
VToolPoint::VToolPoint(VPattern *doc, VContainer *data, quint32 id, QGraphicsItem *parent):VDrawTool(doc, data, id), VToolPoint::VToolPoint(VPattern *doc, VContainer *data, quint32 id, QGraphicsItem *parent):VDrawTool(doc, data, id),
QGraphicsEllipseItem(parent), radius(toPixel(2)), namePoint(0), lineName(0) QGraphicsEllipseItem(parent), radius(qApp->toPixel(2)), namePoint(0), lineName(0)
{ {
namePoint = new VGraphicsSimpleTextItem(this); namePoint = new VGraphicsSimpleTextItem(this);
connect(namePoint, &VGraphicsSimpleTextItem::ShowContextMenu, this, &VToolPoint::ShowContextMenu); connect(namePoint, &VGraphicsSimpleTextItem::ShowContextMenu, this, &VToolPoint::ShowContextMenu);
@ -62,8 +62,8 @@ void VToolPoint::UpdateNamePosition(qreal mx, qreal my)
QDomElement domElement = doc->elementById(QString().setNum(id)); QDomElement domElement = doc->elementById(QString().setNum(id));
if (domElement.isElement()) if (domElement.isElement())
{ {
doc->SetAttribute(domElement, AttrMx, fromPixel(mx)); doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(mx));
doc->SetAttribute(domElement, AttrMy, fromPixel(my)); doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(my));
emit toolhaveChange(); emit toolhaveChange();
} }
} }
@ -81,7 +81,7 @@ void VToolPoint::ChangedActivDraw(const QString &newName)
selectable = false; selectable = false;
currentColor = Qt::gray; currentColor = Qt::gray;
} }
this->setPen(QPen(currentColor, toPixel(widthHairLine)/factor)); this->setPen(QPen(currentColor, qApp->toPixel(widthHairLine)/factor));
this->setFlag(QGraphicsItem::ItemIsSelectable, selectable); this->setFlag(QGraphicsItem::ItemIsSelectable, selectable);
this->setAcceptHoverEvents (selectable); this->setAcceptHoverEvents (selectable);
namePoint->setFlag(QGraphicsItem::ItemIsMovable, selectable); namePoint->setFlag(QGraphicsItem::ItemIsMovable, selectable);
@ -89,7 +89,7 @@ void VToolPoint::ChangedActivDraw(const QString &newName)
namePoint->setFlag(QGraphicsItem::ItemSendsGeometryChanges, selectable); namePoint->setFlag(QGraphicsItem::ItemSendsGeometryChanges, selectable);
namePoint->setBrush(QBrush(currentColor)); namePoint->setBrush(QBrush(currentColor));
namePoint->setAcceptHoverEvents(selectable); namePoint->setAcceptHoverEvents(selectable);
lineName->setPen(QPen(currentColor, toPixel(widthHairLine)/factor)); lineName->setPen(QPen(currentColor, qApp->toPixel(widthHairLine)/factor));
VDrawTool::ChangedActivDraw(newName); VDrawTool::ChangedActivDraw(newName);
} }
@ -121,18 +121,18 @@ void VToolPoint::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
void VToolPoint::hoverMoveEvent(QGraphicsSceneHoverEvent *event) void VToolPoint::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
this->setPen(QPen(currentColor, toPixel(widthMainLine)/factor)); this->setPen(QPen(currentColor, qApp->toPixel(widthMainLine)/factor));
} }
void VToolPoint::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) void VToolPoint::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
this->setPen(QPen(currentColor, toPixel(widthHairLine)/factor)); this->setPen(QPen(currentColor, qApp->toPixel(widthHairLine)/factor));
} }
void VToolPoint::RefreshPointGeometry(const VPointF &point) void VToolPoint::RefreshPointGeometry(const VPointF &point)
{ {
this->setPen(QPen(currentColor, toPixel(widthHairLine)/factor)); this->setPen(QPen(currentColor, qApp->toPixel(widthHairLine)/factor));
QRectF rec = QRectF(0, 0, radius*2/factor, radius*2/factor); QRectF rec = QRectF(0, 0, radius*2/factor, radius*2/factor);
rec.translate(-rec.center().x(), -rec.center().y()); rec.translate(-rec.center().x(), -rec.center().y());
this->setRect(rec); this->setRect(rec);
@ -158,13 +158,13 @@ void VToolPoint::RefreshLine()
lineName->setLine(QLineF(p1, pRec - scenePos())); lineName->setLine(QLineF(p1, pRec - scenePos()));
if (currentColor == Qt::gray) if (currentColor == Qt::gray)
{ {
lineName->setPen(QPen(currentColor, toPixel(widthHairLine)/factor)); lineName->setPen(QPen(currentColor, qApp->toPixel(widthHairLine)/factor));
} }
else else
{ {
lineName->setPen(QPen(Qt::black, toPixel(widthHairLine)/factor)); lineName->setPen(QPen(Qt::black, qApp->toPixel(widthHairLine)/factor));
} }
if (QLineF(p1, pRec - scenePos()).length() <= toPixel(4)) if (QLineF(p1, pRec - scenePos()).length() <= qApp->toPixel(4))
{ {
lineName->setVisible(false); lineName->setVisible(false);
} }

View File

@ -117,7 +117,7 @@ void VToolPointOfContact::Create(const quint32 _id, const QString &radius, const
qreal result = cal.eval(radius, &errorMsg); qreal result = cal.eval(radius, &errorMsg);
if (errorMsg.isEmpty()) if (errorMsg.isEmpty())
{ {
QPointF fPoint = VToolPointOfContact::FindPoint(toPixel(result), centerP->toQPointF(), QPointF fPoint = VToolPointOfContact::FindPoint(qApp->toPixel(result), centerP->toQPointF(),
firstP->toQPointF(), secondP->toQPointF()); firstP->toQPointF(), secondP->toQPointF());
quint32 id = _id; quint32 id = _id;
if (typeCreation == Valentina::FromGui) if (typeCreation == Valentina::FromGui)
@ -191,8 +191,8 @@ void VToolPointOfContact::AddToFile()
doc->SetAttribute(domElement, AttrId, id); doc->SetAttribute(domElement, AttrId, id);
doc->SetAttribute(domElement, AttrType, ToolType); doc->SetAttribute(domElement, AttrType, ToolType);
doc->SetAttribute(domElement, AttrName, point->name()); doc->SetAttribute(domElement, AttrName, point->name());
doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx()));
doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my()));
doc->SetAttribute(domElement, AttrRadius, arcRadius); doc->SetAttribute(domElement, AttrRadius, arcRadius);
doc->SetAttribute(domElement, AttrCenter, center); doc->SetAttribute(domElement, AttrCenter, center);
@ -209,8 +209,8 @@ void VToolPointOfContact::RefreshDataInFile()
if (domElement.isElement()) if (domElement.isElement())
{ {
doc->SetAttribute(domElement, AttrName, point->name()); doc->SetAttribute(domElement, AttrName, point->name());
doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx()));
doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my()));
doc->SetAttribute(domElement, AttrRadius, arcRadius); doc->SetAttribute(domElement, AttrRadius, arcRadius);
doc->SetAttribute(domElement, AttrCenter, center); doc->SetAttribute(domElement, AttrCenter, center);
doc->SetAttribute(domElement, AttrFirstPoint, firstPointId); doc->SetAttribute(domElement, AttrFirstPoint, firstPointId);

View File

@ -141,8 +141,8 @@ void VToolPointOfIntersection::AddToFile()
doc->SetAttribute(domElement, AttrId, id); doc->SetAttribute(domElement, AttrId, id);
doc->SetAttribute(domElement, AttrType, ToolType); doc->SetAttribute(domElement, AttrType, ToolType);
doc->SetAttribute(domElement, AttrName, point->name()); doc->SetAttribute(domElement, AttrName, point->name());
doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx()));
doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my()));
doc->SetAttribute(domElement, AttrFirstPoint, firstPointId); doc->SetAttribute(domElement, AttrFirstPoint, firstPointId);
doc->SetAttribute(domElement, AttrSecondPoint, secondPointId); doc->SetAttribute(domElement, AttrSecondPoint, secondPointId);
@ -157,8 +157,8 @@ void VToolPointOfIntersection::RefreshDataInFile()
if (domElement.isElement()) if (domElement.isElement())
{ {
doc->SetAttribute(domElement, AttrName, point->name()); doc->SetAttribute(domElement, AttrName, point->name());
doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx()));
doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my()));
doc->SetAttribute(domElement, AttrFirstPoint, firstPointId); doc->SetAttribute(domElement, AttrFirstPoint, firstPointId);
doc->SetAttribute(domElement, AttrSecondPoint, secondPointId); doc->SetAttribute(domElement, AttrSecondPoint, secondPointId);
} }

View File

@ -120,7 +120,7 @@ void VToolShoulderPoint::Create(const quint32 _id, const QString &formula, const
if (errorMsg.isEmpty()) if (errorMsg.isEmpty())
{ {
QPointF fPoint = VToolShoulderPoint::FindPoint(firstPoint->toQPointF(), secondPoint->toQPointF(), QPointF fPoint = VToolShoulderPoint::FindPoint(firstPoint->toQPointF(), secondPoint->toQPointF(),
shoulderPoint->toQPointF(), toPixel(result)); shoulderPoint->toQPointF(), qApp->toPixel(result));
quint32 id = _id; quint32 id = _id;
if (typeCreation == Valentina::FromGui) if (typeCreation == Valentina::FromGui)
{ {
@ -193,8 +193,8 @@ void VToolShoulderPoint::AddToFile()
doc->SetAttribute(domElement, AttrId, id); doc->SetAttribute(domElement, AttrId, id);
doc->SetAttribute(domElement, AttrType, ToolType); doc->SetAttribute(domElement, AttrType, ToolType);
doc->SetAttribute(domElement, AttrName, point->name()); doc->SetAttribute(domElement, AttrName, point->name());
doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx()));
doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my()));
doc->SetAttribute(domElement, AttrTypeLine, typeLine); doc->SetAttribute(domElement, AttrTypeLine, typeLine);
doc->SetAttribute(domElement, AttrLength, formula); doc->SetAttribute(domElement, AttrLength, formula);
@ -212,8 +212,8 @@ void VToolShoulderPoint::RefreshDataInFile()
if (domElement.isElement()) if (domElement.isElement())
{ {
doc->SetAttribute(domElement, AttrName, point->name()); doc->SetAttribute(domElement, AttrName, point->name());
doc->SetAttribute(domElement, AttrName, fromPixel(point->mx())); doc->SetAttribute(domElement, AttrName, qApp->fromPixel(point->mx()));
doc->SetAttribute(domElement, AttrName, fromPixel(point->my())); doc->SetAttribute(domElement, AttrName, qApp->fromPixel(point->my()));
doc->SetAttribute(domElement, AttrTypeLine, typeLine); doc->SetAttribute(domElement, AttrTypeLine, typeLine);
doc->SetAttribute(domElement, AttrLength, formula); doc->SetAttribute(domElement, AttrLength, formula);
doc->SetAttribute(domElement, AttrP1Line, basePointId); doc->SetAttribute(domElement, AttrP1Line, basePointId);

View File

@ -69,10 +69,10 @@ void VToolSinglePoint::AddToFile()
doc->SetAttribute(domElement, AttrId, id); doc->SetAttribute(domElement, AttrId, id);
doc->SetAttribute(domElement, AttrType, ToolType); doc->SetAttribute(domElement, AttrType, ToolType);
doc->SetAttribute(domElement, AttrName, point->name()); doc->SetAttribute(domElement, AttrName, point->name());
doc->SetAttribute(domElement, AttrX, fromPixel(point->x())); doc->SetAttribute(domElement, AttrX, qApp->fromPixel(point->x()));
doc->SetAttribute(domElement, AttrY, fromPixel(point->y())); doc->SetAttribute(domElement, AttrY, qApp->fromPixel(point->y()));
doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx()));
doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my()));
AddToCalculation(domElement); AddToCalculation(domElement);
} }
@ -84,10 +84,10 @@ void VToolSinglePoint::RefreshDataInFile()
if (domElement.isElement()) if (domElement.isElement())
{ {
doc->SetAttribute(domElement, AttrName, point->name()); doc->SetAttribute(domElement, AttrName, point->name());
doc->SetAttribute(domElement, AttrX, QString().setNum(fromPixel(point->x()))); doc->SetAttribute(domElement, AttrX, QString().setNum(qApp->fromPixel(point->x())));
doc->SetAttribute(domElement, AttrY, QString().setNum(fromPixel(point->y()))); doc->SetAttribute(domElement, AttrY, QString().setNum(qApp->fromPixel(point->y())));
doc->SetAttribute(domElement, AttrMx, QString().setNum(fromPixel(point->mx()))); doc->SetAttribute(domElement, AttrMx, QString().setNum(qApp->fromPixel(point->mx())));
doc->SetAttribute(domElement, AttrMy, QString().setNum(fromPixel(point->my()))); doc->SetAttribute(domElement, AttrMy, QString().setNum(qApp->fromPixel(point->my())));
} }
} }
@ -113,8 +113,8 @@ QVariant VToolSinglePoint::itemChange(QGraphicsItem::GraphicsItemChange change,
QDomElement domElement = doc->elementById(QString().setNum(id)); QDomElement domElement = doc->elementById(QString().setNum(id));
if (domElement.isElement()) if (domElement.isElement())
{ {
doc->SetAttribute(domElement, AttrX, QString().setNum(fromPixel(newPos.x()))); doc->SetAttribute(domElement, AttrX, QString().setNum(qApp->fromPixel(newPos.x())));
doc->SetAttribute(domElement, AttrY, QString().setNum(fromPixel(newPos.y()))); doc->SetAttribute(domElement, AttrY, QString().setNum(qApp->fromPixel(newPos.y())));
QList<QGraphicsView*> list = this->scene()->views(); QList<QGraphicsView*> list = this->scene()->views();
VAbstractTool::NewSceneRect(this->scene(), list[0]); VAbstractTool::NewSceneRect(this->scene(), list[0]);
@ -143,14 +143,14 @@ void VToolSinglePoint::SaveDialog(QDomElement &domElement)
QPointF p = dialogTool->getPoint(); QPointF p = dialogTool->getPoint();
QString name = dialogTool->getName(); QString name = dialogTool->getName();
doc->SetAttribute(domElement, AttrName, name); doc->SetAttribute(domElement, AttrName, name);
doc->SetAttribute(domElement, AttrX, QString().setNum(fromPixel(p.x()))); doc->SetAttribute(domElement, AttrX, QString().setNum(qApp->fromPixel(p.x())));
doc->SetAttribute(domElement, AttrY, QString().setNum(fromPixel(p.y()))); doc->SetAttribute(domElement, AttrY, QString().setNum(qApp->fromPixel(p.y())));
} }
void VToolSinglePoint::setColorLabel(const Qt::GlobalColor &color) void VToolSinglePoint::setColorLabel(const Qt::GlobalColor &color)
{ {
namePoint->setBrush(color); namePoint->setBrush(color);
lineName->setPen(QPen(color, toPixel(widthHairLine)/factor)); lineName->setPen(QPen(color, qApp->toPixel(widthHairLine)/factor));
} }
void VToolSinglePoint::contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) void VToolSinglePoint::contextMenuEvent ( QGraphicsSceneContextMenuEvent * event )

View File

@ -40,7 +40,7 @@ VToolSpline::VToolSpline(VPattern *doc, VContainer *data, quint32 id, const Vale
path.addPath(spl->GetPath()); path.addPath(spl->GetPath());
path.setFillRule( Qt::WindingFill ); path.setFillRule( Qt::WindingFill );
this->setPath(path); this->setPath(path);
this->setPen(QPen(Qt::black, toPixel(widthHairLine)/factor)); this->setPen(QPen(Qt::black, qApp->toPixel(widthHairLine)/factor));
this->setFlag(QGraphicsItem::ItemIsSelectable, true); this->setFlag(QGraphicsItem::ItemIsSelectable, true);
this->setFlag(QGraphicsItem::ItemIsFocusable, true); this->setFlag(QGraphicsItem::ItemIsFocusable, true);
this->setAcceptHoverEvents(true); this->setAcceptHoverEvents(true);
@ -115,12 +115,12 @@ void VToolSpline::Create(const quint32 _id, const quint32 &p1, const quint32 &p4
if (typeCreation == Valentina::FromGui) if (typeCreation == Valentina::FromGui)
{ {
id = data->AddGObject(spline); id = data->AddGObject(spline);
data->AddLengthSpline(spline->name(), fromPixel(spline->GetLength())); data->AddLengthSpline(spline->name(), qApp->fromPixel(spline->GetLength()));
} }
else else
{ {
data->UpdateGObject(id, spline); data->UpdateGObject(id, spline);
data->AddLengthSpline(spline->name(), fromPixel(spline->GetLength())); data->AddLengthSpline(spline->name(), qApp->fromPixel(spline->GetLength()));
if (parse != Document::FullParse) if (parse != Document::FullParse)
{ {
doc->UpdateToolData(id, data); doc->UpdateToolData(id, data);
@ -256,7 +256,7 @@ void VToolSpline::SaveDialog(QDomElement &domElement)
void VToolSpline::RefreshGeometry() void VToolSpline::RefreshGeometry()
{ {
this->setPen(QPen(currentColor, toPixel(widthHairLine)/factor)); this->setPen(QPen(currentColor, qApp->toPixel(widthHairLine)/factor));
const VSpline *spl = VAbstractTool::data.GeometricObject<const VSpline *>(id); const VSpline *spl = VAbstractTool::data.GeometricObject<const VSpline *>(id);
QPainterPath path; QPainterPath path;
path.addPath(spl->GetPath()); path.addPath(spl->GetPath());

View File

@ -39,7 +39,7 @@ VToolSplinePath::VToolSplinePath(VPattern *doc, VContainer *data, quint32 id, co
path.addPath(splPath->GetPath()); path.addPath(splPath->GetPath());
path.setFillRule( Qt::WindingFill ); path.setFillRule( Qt::WindingFill );
this->setPath(path); this->setPath(path);
this->setPen(QPen(Qt::black, toPixel(widthHairLine)/factor)); this->setPen(QPen(Qt::black, qApp->toPixel(widthHairLine)/factor));
this->setFlag(QGraphicsItem::ItemIsSelectable, true); this->setFlag(QGraphicsItem::ItemIsSelectable, true);
this->setFlag(QGraphicsItem::ItemIsFocusable, true); this->setFlag(QGraphicsItem::ItemIsFocusable, true);
this->setAcceptHoverEvents(true); this->setAcceptHoverEvents(true);
@ -102,12 +102,12 @@ void VToolSplinePath::Create(const quint32 _id, VSplinePath *path, VMainGraphics
if (typeCreation == Valentina::FromGui) if (typeCreation == Valentina::FromGui)
{ {
id = data->AddGObject(path); id = data->AddGObject(path);
data->AddLengthSpline(path->name(), fromPixel(path->GetLength())); data->AddLengthSpline(path->name(), qApp->fromPixel(path->GetLength()));
} }
else else
{ {
data->UpdateGObject(id, path); data->UpdateGObject(id, path);
data->AddLengthSpline(path->name(), fromPixel(path->GetLength())); data->AddLengthSpline(path->name(), qApp->fromPixel(path->GetLength()));
if (parse != Document::FullParse) if (parse != Document::FullParse)
{ {
doc->UpdateToolData(id, data); doc->UpdateToolData(id, data);
@ -284,7 +284,7 @@ void VToolSplinePath::SaveDialog(QDomElement &domElement)
void VToolSplinePath::RefreshGeometry() void VToolSplinePath::RefreshGeometry()
{ {
this->setPen(QPen(currentColor, toPixel(widthHairLine)/factor)); this->setPen(QPen(currentColor, qApp->toPixel(widthHairLine)/factor));
const VSplinePath *splPath = VAbstractTool::data.GeometricObject<const VSplinePath *>(id); const VSplinePath *splPath = VAbstractTool::data.GeometricObject<const VSplinePath *>(id);
QPainterPath path; QPainterPath path;
path.addPath(splPath->GetPath()); path.addPath(splPath->GetPath());

View File

@ -197,8 +197,8 @@ void VToolTriangle::AddToFile()
doc->SetAttribute(domElement, AttrId, id); doc->SetAttribute(domElement, AttrId, id);
doc->SetAttribute(domElement, AttrType, ToolType); doc->SetAttribute(domElement, AttrType, ToolType);
doc->SetAttribute(domElement, AttrName, point->name()); doc->SetAttribute(domElement, AttrName, point->name());
doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx()));
doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my()));
doc->SetAttribute(domElement, AttrAxisP1, axisP1Id); doc->SetAttribute(domElement, AttrAxisP1, axisP1Id);
doc->SetAttribute(domElement, AttrAxisP2, axisP2Id); doc->SetAttribute(domElement, AttrAxisP2, axisP2Id);
@ -215,8 +215,8 @@ void VToolTriangle::RefreshDataInFile()
if (domElement.isElement()) if (domElement.isElement())
{ {
doc->SetAttribute(domElement, AttrName, point->name()); doc->SetAttribute(domElement, AttrName, point->name());
doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx()));
doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my()));
doc->SetAttribute(domElement, AttrAxisP1, axisP1Id); doc->SetAttribute(domElement, AttrAxisP1, axisP1Id);
doc->SetAttribute(domElement, AttrAxisP2, axisP2Id); doc->SetAttribute(domElement, AttrAxisP2, axisP2Id);
doc->SetAttribute(domElement, AttrFirstPoint, firstPointId); doc->SetAttribute(domElement, AttrFirstPoint, firstPointId);

View File

@ -29,6 +29,7 @@
#include "vnodearc.h" #include "vnodearc.h"
#include <QtWidgets> #include <QtWidgets>
#include "../../widgets/vapplication.h"
const QString VNodeArc::TagName = QStringLiteral("arc"); const QString VNodeArc::TagName = QStringLiteral("arc");
const QString VNodeArc::ToolType = QStringLiteral("modeling"); const QString VNodeArc::ToolType = QStringLiteral("modeling");
@ -38,7 +39,7 @@ VNodeArc::VNodeArc(VPattern *doc, VContainer *data, quint32 id, quint32 idArc, c
:VAbstractNode(doc, data, id, idArc, idTool, qoParent), QGraphicsPathItem(parent) :VAbstractNode(doc, data, id, idArc, idTool, qoParent), QGraphicsPathItem(parent)
{ {
RefreshGeometry(); RefreshGeometry();
this->setPen(QPen(baseColor, toPixel(widthHairLine))); this->setPen(QPen(baseColor, qApp->toPixel(widthHairLine)));
if (typeCreation == Valentina::FromGui) if (typeCreation == Valentina::FromGui)
{ {
@ -128,13 +129,13 @@ void VNodeArc::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
void VNodeArc::hoverMoveEvent(QGraphicsSceneHoverEvent *event) void VNodeArc::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
this->setPen(QPen(currentColor, toPixel(widthMainLine))); this->setPen(QPen(currentColor, qApp->toPixel(widthMainLine)));
} }
void VNodeArc::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) void VNodeArc::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
this->setPen(QPen(currentColor, toPixel(widthHairLine))); this->setPen(QPen(currentColor, qApp->toPixel(widthHairLine)));
} }
void VNodeArc::RefreshGeometry() void VNodeArc::RefreshGeometry()

View File

@ -29,6 +29,7 @@
#include "vnodepoint.h" #include "vnodepoint.h"
#include <QtWidgets> #include <QtWidgets>
#include "../../widgets/vapplication.h"
const QString VNodePoint::TagName = QStringLiteral("point"); const QString VNodePoint::TagName = QStringLiteral("point");
const QString VNodePoint::ToolType = QStringLiteral("modeling"); const QString VNodePoint::ToolType = QStringLiteral("modeling");
@ -36,14 +37,14 @@ const QString VNodePoint::ToolType = QStringLiteral("modeling");
VNodePoint::VNodePoint(VPattern *doc, VContainer *data, quint32 id, quint32 idPoint, VNodePoint::VNodePoint(VPattern *doc, VContainer *data, quint32 id, quint32 idPoint,
const Valentina::Sources &typeCreation, const quint32 &idTool, QObject *qoParent, const Valentina::Sources &typeCreation, const quint32 &idTool, QObject *qoParent,
QGraphicsItem *parent) QGraphicsItem *parent)
:VAbstractNode(doc, data, id, idPoint, idTool, qoParent), QGraphicsEllipseItem(parent), radius(toPixel(1.5)), :VAbstractNode(doc, data, id, idPoint, idTool, qoParent), QGraphicsEllipseItem(parent), radius(qApp->toPixel(1.5)),
namePoint(nullptr), lineName(nullptr) namePoint(nullptr), lineName(nullptr)
{ {
namePoint = new VGraphicsSimpleTextItem(this); namePoint = new VGraphicsSimpleTextItem(this);
lineName = new QGraphicsLineItem(this); lineName = new QGraphicsLineItem(this);
connect(namePoint, &VGraphicsSimpleTextItem::NameChangePosition, this, connect(namePoint, &VGraphicsSimpleTextItem::NameChangePosition, this,
&VNodePoint::NameChangePosition); &VNodePoint::NameChangePosition);
this->setPen(QPen(Qt::black, toPixel(widthHairLine))); this->setPen(QPen(Qt::black, qApp->toPixel(widthHairLine)));
this->setBrush(QBrush(Qt::NoBrush)); this->setBrush(QBrush(Qt::NoBrush));
this->setFlag(QGraphicsItem::ItemIsSelectable, true); this->setFlag(QGraphicsItem::ItemIsSelectable, true);
this->setAcceptHoverEvents(true); this->setAcceptHoverEvents(true);
@ -107,8 +108,8 @@ void VNodePoint::AddToFile()
doc->SetAttribute(domElement, AttrId, id); doc->SetAttribute(domElement, AttrId, id);
doc->SetAttribute(domElement, AttrType, ToolType); doc->SetAttribute(domElement, AttrType, ToolType);
doc->SetAttribute(domElement, AttrIdObject, idNode); doc->SetAttribute(domElement, AttrIdObject, idNode);
doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx()));
doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my()));
if (idTool != 0) if (idTool != 0)
{ {
doc->SetAttribute(domElement, AttrIdTool, idTool); doc->SetAttribute(domElement, AttrIdTool, idTool);
@ -124,8 +125,8 @@ void VNodePoint::RefreshDataInFile()
if (domElement.isElement()) if (domElement.isElement())
{ {
doc->SetAttribute(domElement, AttrIdObject, idNode); doc->SetAttribute(domElement, AttrIdObject, idNode);
doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx()));
doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my()));
if (idTool != 0) if (idTool != 0)
{ {
doc->SetAttribute(domElement, AttrIdTool, idTool); doc->SetAttribute(domElement, AttrIdTool, idTool);
@ -145,13 +146,13 @@ void VNodePoint::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
void VNodePoint::hoverMoveEvent(QGraphicsSceneHoverEvent *event) void VNodePoint::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
this->setPen(QPen(currentColor, toPixel(widthMainLine))); this->setPen(QPen(currentColor, qApp->toPixel(widthMainLine)));
} }
void VNodePoint::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) void VNodePoint::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
this->setPen(QPen(currentColor, toPixel(widthHairLine))); this->setPen(QPen(currentColor, qApp->toPixel(widthHairLine)));
} }
@ -171,8 +172,8 @@ void VNodePoint::UpdateNamePosition(qreal mx, qreal my)
QDomElement domElement = doc->elementById(QString().setNum(id)); QDomElement domElement = doc->elementById(QString().setNum(id));
if (domElement.isElement()) if (domElement.isElement())
{ {
doc->SetAttribute(domElement, AttrMx, QString().setNum(fromPixel(mx))); doc->SetAttribute(domElement, AttrMx, QString().setNum(qApp->fromPixel(mx)));
doc->SetAttribute(domElement, AttrMy, QString().setNum(fromPixel(my))); doc->SetAttribute(domElement, AttrMy, QString().setNum(qApp->fromPixel(my)));
emit toolhaveChange(); emit toolhaveChange();
} }
} }
@ -200,7 +201,7 @@ void VNodePoint::RefreshLine()
LineIntersectCircle(QPointF(), radius, QLineF(QPointF(), nameRec.center()- scenePos()), p1, p2); LineIntersectCircle(QPointF(), radius, QLineF(QPointF(), nameRec.center()- scenePos()), p1, p2);
QPointF pRec = LineIntersectRect(nameRec, QLineF(scenePos(), nameRec.center())); QPointF pRec = LineIntersectRect(nameRec, QLineF(scenePos(), nameRec.center()));
lineName->setLine(QLineF(p1, pRec - scenePos())); lineName->setLine(QLineF(p1, pRec - scenePos()));
if (QLineF(p1, pRec - scenePos()).length() <= toPixel(4)) if (QLineF(p1, pRec - scenePos()).length() <= qApp->toPixel(4))
{ {
lineName->setVisible(false); lineName->setVisible(false);
} }

View File

@ -29,6 +29,7 @@
#include "vnodespline.h" #include "vnodespline.h"
#include <QtWidgets> #include <QtWidgets>
#include "../../widgets/vapplication.h"
const QString VNodeSpline::TagName = QStringLiteral("spline"); const QString VNodeSpline::TagName = QStringLiteral("spline");
const QString VNodeSpline::ToolType = QStringLiteral("modelingSpline"); const QString VNodeSpline::ToolType = QStringLiteral("modelingSpline");
@ -39,7 +40,7 @@ VNodeSpline::VNodeSpline(VPattern *doc, VContainer *data, quint32 id, quint32 id
:VAbstractNode(doc, data, id, idSpline, idTool, qoParent), QGraphicsPathItem(parent) :VAbstractNode(doc, data, id, idSpline, idTool, qoParent), QGraphicsPathItem(parent)
{ {
RefreshGeometry(); RefreshGeometry();
this->setPen(QPen(baseColor, toPixel(widthHairLine))); this->setPen(QPen(baseColor, qApp->toPixel(widthHairLine)));
if (typeCreation == Valentina::FromGui) if (typeCreation == Valentina::FromGui)
{ {
@ -132,13 +133,13 @@ void VNodeSpline::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
void VNodeSpline::hoverMoveEvent(QGraphicsSceneHoverEvent *event) void VNodeSpline::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
this->setPen(QPen(currentColor, toPixel(widthMainLine))); this->setPen(QPen(currentColor, qApp->toPixel(widthMainLine)));
} }
void VNodeSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) void VNodeSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
this->setPen(QPen(currentColor, toPixel(widthHairLine))); this->setPen(QPen(currentColor, qApp->toPixel(widthHairLine)));
} }
void VNodeSpline::RefreshGeometry() void VNodeSpline::RefreshGeometry()

View File

@ -29,6 +29,7 @@
#include "vnodesplinepath.h" #include "vnodesplinepath.h"
#include <QtWidgets> #include <QtWidgets>
#include "../../widgets/vapplication.h"
const QString VNodeSplinePath::TagName = QStringLiteral("spline"); const QString VNodeSplinePath::TagName = QStringLiteral("spline");
const QString VNodeSplinePath::ToolType = QStringLiteral("modelingPath"); const QString VNodeSplinePath::ToolType = QStringLiteral("modelingPath");
@ -39,7 +40,7 @@ VNodeSplinePath::VNodeSplinePath(VPattern *doc, VContainer *data, quint32 id, qu
:VAbstractNode(doc, data, id, idSpline, idTool, qoParent), QGraphicsPathItem(parent) :VAbstractNode(doc, data, id, idSpline, idTool, qoParent), QGraphicsPathItem(parent)
{ {
RefreshGeometry(); RefreshGeometry();
this->setPen(QPen(baseColor, toPixel(widthHairLine))); this->setPen(QPen(baseColor, qApp->toPixel(widthHairLine)));
if (typeCreation == Valentina::FromGui) if (typeCreation == Valentina::FromGui)
{ {
@ -135,13 +136,13 @@ void VNodeSplinePath::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
void VNodeSplinePath::hoverMoveEvent(QGraphicsSceneHoverEvent *event) void VNodeSplinePath::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
this->setPen(QPen(currentColor, toPixel(widthMainLine))); this->setPen(QPen(currentColor, qApp->toPixel(widthMainLine)));
} }
void VNodeSplinePath::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) void VNodeSplinePath::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
this->setPen(QPen(currentColor, toPixel(widthHairLine))); this->setPen(QPen(currentColor, qApp->toPixel(widthHairLine)));
} }
void VNodeSplinePath::RefreshGeometry() void VNodeSplinePath::RefreshGeometry()

View File

@ -230,8 +230,8 @@ void VToolDetail::AddToFile()
doc->SetAttribute(domElement, AttrId, id); doc->SetAttribute(domElement, AttrId, id);
doc->SetAttribute(domElement, AttrName, detail.getName()); doc->SetAttribute(domElement, AttrName, detail.getName());
doc->SetAttribute(domElement, AttrMx, fromPixel(detail.getMx())); doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(detail.getMx()));
doc->SetAttribute(domElement, AttrMy, fromPixel(detail.getMy())); doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(detail.getMy()));
doc->SetAttribute(domElement, AttrSupplement, detail.getSeamAllowance()); doc->SetAttribute(domElement, AttrSupplement, detail.getSeamAllowance());
doc->SetAttribute(domElement, AttrClosed, detail.getClosed()); doc->SetAttribute(domElement, AttrClosed, detail.getClosed());
doc->SetAttribute(domElement, AttrWidth, detail.getWidth()); doc->SetAttribute(domElement, AttrWidth, detail.getWidth());
@ -277,8 +277,8 @@ QVariant VToolDetail::itemChange(QGraphicsItem::GraphicsItemChange change, const
QDomElement domElement = doc->elementById(QString().setNum(id)); QDomElement domElement = doc->elementById(QString().setNum(id));
if (domElement.isElement()) if (domElement.isElement())
{ {
doc->SetAttribute(domElement, AttrMx, QString().setNum(fromPixel(newPos.x()))); doc->SetAttribute(domElement, AttrMx, QString().setNum(qApp->fromPixel(newPos.x())));
doc->SetAttribute(domElement, AttrMy, QString().setNum(fromPixel(newPos.y()))); doc->SetAttribute(domElement, AttrMy, QString().setNum(qApp->fromPixel(newPos.y())));
QList<QGraphicsView*> list = this->scene()->views(); QList<QGraphicsView*> list = this->scene()->views();
VAbstractTool::NewSceneRect(this->scene(), list[0]); VAbstractTool::NewSceneRect(this->scene(), list[0]);
@ -370,8 +370,8 @@ void VToolDetail::AddNode(QDomElement &domElement, const VNodeDetail &node)
QDomElement nod = doc->createElement(TagNode); QDomElement nod = doc->createElement(TagNode);
doc->SetAttribute(nod, AttrIdObject, node.getId()); doc->SetAttribute(nod, AttrIdObject, node.getId());
doc->SetAttribute(nod, AttrMx, fromPixel(node.getMx())); doc->SetAttribute(nod, AttrMx, qApp->fromPixel(node.getMx()));
doc->SetAttribute(nod, AttrMy, fromPixel(node.getMy())); doc->SetAttribute(nod, AttrMy, qApp->fromPixel(node.getMy()));
if (node.getTypeNode() == NodeDetail::Contour) if (node.getTypeNode() == NodeDetail::Contour)
{ {
doc->SetAttribute(nod, AttrNodeType, NodeTypeContour); doc->SetAttribute(nod, AttrNodeType, NodeTypeContour);

View File

@ -579,8 +579,8 @@ QVector<VDetail> VToolUnionDetails::GetDetailFromFile(VPattern *doc, const QDomE
if (element.tagName() == VToolUnionDetails::TagNode) if (element.tagName() == VToolUnionDetails::TagNode)
{ {
quint32 id = doc->GetParametrUInt(element, VToolDetail::AttrIdObject, "0"); quint32 id = doc->GetParametrUInt(element, VToolDetail::AttrIdObject, "0");
qreal mx = toPixel(doc->GetParametrDouble(element, VAbstractTool::AttrMx, "0.0")); qreal mx = qApp->toPixel(doc->GetParametrDouble(element, VAbstractTool::AttrMx, "0.0"));
qreal my = toPixel(doc->GetParametrDouble(element, VAbstractTool::AttrMy, "0.0")); qreal my = qApp->toPixel(doc->GetParametrDouble(element, VAbstractTool::AttrMy, "0.0"));
Valentina::Tools tool; Valentina::Tools tool;
NodeDetail::NodeDetails nodeType = NodeDetail::Contour; NodeDetail::NodeDetails nodeType = NodeDetail::Contour;
QString t = doc->GetParametrString(element, "type", "NodePoint"); QString t = doc->GetParametrString(element, "type", "NodePoint");
@ -657,8 +657,8 @@ void VToolUnionDetails::AddNode(QDomElement &domElement, const VNodeDetail &node
QDomElement nod = doc->createElement(TagNode); QDomElement nod = doc->createElement(TagNode);
doc->SetAttribute(nod, AttrIdObject, node.getId()); doc->SetAttribute(nod, AttrIdObject, node.getId());
doc->SetAttribute(nod, AttrMx, fromPixel(node.getMx())); doc->SetAttribute(nod, AttrMx, qApp->fromPixel(node.getMx()));
doc->SetAttribute(nod, AttrMy, fromPixel(node.getMy())); doc->SetAttribute(nod, AttrMy, qApp->fromPixel(node.getMy()));
if (node.getTypeNode() == NodeDetail::Contour) if (node.getTypeNode() == NodeDetail::Contour)
{ {
doc->SetAttribute(nod, AttrNodeType, NodeTypeContour); doc->SetAttribute(nod, AttrNodeType, NodeTypeContour);

View File

@ -36,12 +36,20 @@
#include <QMessageBox> #include <QMessageBox>
#include <QDebug> #include <QDebug>
const qreal VApplication::PrintDPI = 96.0;
// reimplemented from QApplication so we can throw exceptions in slots // reimplemented from QApplication so we can throw exceptions in slots
VApplication::VApplication(int &argc, char **argv)
: QApplication(argc, argv), _patternUnit(Valentina::Cm), _patternType(Pattern::Individual)
{
}
bool VApplication::notify(QObject *receiver, QEvent *event) bool VApplication::notify(QObject *receiver, QEvent *event)
{ {
try try
{ {
return QApplication::notify(receiver, event); return QApplication::notify(receiver, event);
} }
catch (const VExceptionObjectError &e) catch (const VExceptionObjectError &e)
{ {
@ -79,3 +87,83 @@ bool VApplication::notify(QObject *receiver, QEvent *event)
} }
return false; return false;
} }
double VApplication::toPixel(double unit) const
{
double result = 0;
switch (_patternUnit)
{
case Valentina::Mm:
result = (unit / 25.4) * PrintDPI;
break;
case Valentina::Cm:
result = ((unit * 10.0) / 25.4) * PrintDPI;
break;
case Valentina::In:
result = unit * PrintDPI;
break;
default:
break;
}
return result;
}
double VApplication::fromPixel(double pix) const
{
double result = 0;
switch (_patternUnit)
{
case Valentina::Mm:
result = (pix / PrintDPI) * 25.4;
break;
case Valentina::Cm:
result = ((pix / PrintDPI) * 25.4) / 10.0;
break;
case Valentina::In:
result = pix / PrintDPI;
break;
default:
break;
}
return result;
}
QString VApplication::pathToTables() const
{
if (_patternType == Pattern::Individual)
{
#ifdef Q_OS_WIN
return QStringLiteral("/tables/individual");
#else
#ifdef QT_DEBUG
return QStringLiteral("/tables/individual");
#else
return QStringLiteral("/usr/share/valentina/tables/individual");
#endif
#endif
}
else
{
#ifdef Q_OS_WIN
return QStringLiteral("/tables/standard");
#else
#ifdef QT_DEBUG
return QStringLiteral("/tables/standard");
#else
return QStringLiteral("/usr/share/valentina/tables/standard");
#endif
#endif
}
}
QString VApplication::translationsPath() const
{
#ifdef Q_OS_WIN
return QStringLiteral("/translations");
#else
#ifdef QT_DEBUG
return QStringLiteral("/translations");
#else
return QStringLiteral("/usr/share/valentina/translations");
#endif
#endif
}

View File

@ -30,6 +30,14 @@
#define VAPPLICATION_H #define VAPPLICATION_H
#include <QApplication> #include <QApplication>
#include "../options.h"
class VApplication;
#if defined(qApp)
#undef qApp
#endif
#define qApp (static_cast<VApplication*>(QCoreApplication::instance()))
/** /**
* @brief The VApplication class reimplamentation QApplication class. * @brief The VApplication class reimplamentation QApplication class.
@ -43,7 +51,7 @@ public:
* @param argc number arguments. * @param argc number arguments.
* @param argv command line. * @param argv command line.
*/ */
VApplication(int &argc, char ** argv): QApplication(argc, argv){} VApplication(int &argc, char ** argv);
virtual ~VApplication() {} virtual ~VApplication() {}
/** /**
* @brief notify Reimplemented from QApplication::notify(). * @brief notify Reimplemented from QApplication::notify().
@ -52,6 +60,39 @@ public:
* @return value that is returned from the receiver's event handler. * @return value that is returned from the receiver's event handler.
*/ */
virtual bool notify(QObject * receiver, QEvent * event); virtual bool notify(QObject * receiver, QEvent * event);
Valentina::Units patternUnit() const;
void setPatternUnit(const Valentina::Units &patternUnit);
Pattern::Measurements patternType() const;
void setPatternType(const Pattern::Measurements &patternType);
double toPixel(double unit) const;
double fromPixel(double pix) const;
static const qreal PrintDPI;
QString translationsPath() const;
QString pathToTables() const;
private:
Valentina::Units _patternUnit;
Pattern::Measurements _patternType;
}; };
inline Valentina::Units VApplication::patternUnit() const
{
return _patternUnit;
}
inline void VApplication::setPatternUnit(const Valentina::Units &patternUnit)
{
_patternUnit = patternUnit;
}
inline Pattern::Measurements VApplication::patternType() const
{
return _patternType;
}
inline void VApplication::setPatternType(const Pattern::Measurements &patternType)
{
_patternType = patternType;
}
#endif // VAPPLICATION_H #endif // VAPPLICATION_H

View File

@ -30,18 +30,19 @@
#include "../tools/vabstracttool.h" #include "../tools/vabstracttool.h"
#include <QPen> #include <QPen>
#include "../widgets/vapplication.h"
VControlPointSpline::VControlPointSpline(const qint32 &indexSpline, SplinePoint::Position position, VControlPointSpline::VControlPointSpline(const qint32 &indexSpline, SplinePoint::Position position,
const QPointF &controlPoint, const QPointF &splinePoint, const QPointF &controlPoint, const QPointF &splinePoint,
QGraphicsItem *parent) QGraphicsItem *parent)
:QGraphicsEllipseItem(parent), radius(toPixel(1.5)), controlLine(nullptr), indexSpline(indexSpline), :QGraphicsEllipseItem(parent), radius(qApp->toPixel(1.5)), controlLine(nullptr), indexSpline(indexSpline),
position(position) position(position)
{ {
//create circle //create circle
QRectF rec = QRectF(0, 0, radius*2, radius*2); QRectF rec = QRectF(0, 0, radius*2, radius*2);
rec.translate(-rec.center().x(), -rec.center().y()); rec.translate(-rec.center().x(), -rec.center().y());
this->setRect(rec); this->setRect(rec);
this->setPen(QPen(Qt::black, toPixel(widthHairLine))); this->setPen(QPen(Qt::black, qApp->toPixel(widthHairLine)));
this->setBrush(QBrush(Qt::NoBrush)); this->setBrush(QBrush(Qt::NoBrush));
this->setFlag(QGraphicsItem::ItemIsSelectable, true); this->setFlag(QGraphicsItem::ItemIsSelectable, true);
this->setFlag(QGraphicsItem::ItemIsMovable, true); this->setFlag(QGraphicsItem::ItemIsMovable, true);
@ -52,20 +53,20 @@ VControlPointSpline::VControlPointSpline(const qint32 &indexSpline, SplinePoint:
QPointF p1, p2; QPointF p1, p2;
VAbstractTool::LineIntersectCircle(QPointF(), radius, QLineF( QPointF(), splinePoint-controlPoint), p1, p2); VAbstractTool::LineIntersectCircle(QPointF(), radius, QLineF( QPointF(), splinePoint-controlPoint), p1, p2);
controlLine = new QGraphicsLineItem(QLineF(splinePoint-controlPoint, p1), this); controlLine = new QGraphicsLineItem(QLineF(splinePoint-controlPoint, p1), this);
controlLine->setPen(QPen(Qt::red, toPixel(widthHairLine))); controlLine->setPen(QPen(Qt::red, qApp->toPixel(widthHairLine)));
controlLine->setFlag(QGraphicsItem::ItemStacksBehindParent, true); controlLine->setFlag(QGraphicsItem::ItemStacksBehindParent, true);
} }
void VControlPointSpline::hoverMoveEvent(QGraphicsSceneHoverEvent *event) void VControlPointSpline::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
this->setPen(QPen(Qt::black, toPixel(widthMainLine))); this->setPen(QPen(Qt::black, qApp->toPixel(widthMainLine)));
} }
void VControlPointSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) void VControlPointSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
this->setPen(QPen(Qt::black, toPixel(widthHairLine))); this->setPen(QPen(Qt::black, qApp->toPixel(widthHairLine)));
} }
QVariant VControlPointSpline::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value) QVariant VControlPointSpline::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value)
@ -94,14 +95,14 @@ void VControlPointSpline::setEnabledPoint(bool enable)
{ {
if (enable == true) if (enable == true)
{ {
this->setPen(QPen(Qt::black, toPixel(widthHairLine))); this->setPen(QPen(Qt::black, qApp->toPixel(widthHairLine)));
this->setFlag(QGraphicsItem::ItemIsSelectable, true); this->setFlag(QGraphicsItem::ItemIsSelectable, true);
this->setFlag(QGraphicsItem::ItemIsMovable, true); this->setFlag(QGraphicsItem::ItemIsMovable, true);
this->setAcceptHoverEvents(true); this->setAcceptHoverEvents(true);
} }
else else
{ {
this->setPen(QPen(Qt::gray, toPixel(widthHairLine))); this->setPen(QPen(Qt::gray, qApp->toPixel(widthHairLine)));
this->setFlag(QGraphicsItem::ItemIsSelectable, false); this->setFlag(QGraphicsItem::ItemIsSelectable, false);
this->setFlag(QGraphicsItem::ItemIsMovable, false); this->setFlag(QGraphicsItem::ItemIsMovable, false);
this->setAcceptHoverEvents(false); this->setAcceptHoverEvents(false);

View File

@ -27,10 +27,10 @@
*************************************************************************/ *************************************************************************/
#include "vitem.h" #include "vitem.h"
#include "../options.h"
#include <QGraphicsScene> #include <QGraphicsScene>
#include <QDebug> #include <QDebug>
#include "../widgets/vapplication.h"
VItem::VItem (const QPainterPath & path, int numInList, QGraphicsItem * parent ) VItem::VItem (const QPainterPath & path, int numInList, QGraphicsItem * parent )
:QGraphicsPathItem ( path, parent ), numInOutList(numInList), paper(nullptr) :QGraphicsPathItem ( path, parent ), numInOutList(numInList), paper(nullptr)
@ -63,19 +63,19 @@ void VItem::checkItemChange()
QRectF myrect = sceneBoundingRect(); QRectF myrect = sceneBoundingRect();
if ( rect.contains( myrect )==true ) if ( rect.contains( myrect )==true )
{ {
setPen(QPen(Qt::black, toPixel(widthMainLine))); setPen(QPen(Qt::black, qApp->toPixel(widthMainLine)));
emit itemOut( numInOutList, false ); emit itemOut( numInOutList, false );
} }
else else
{ {
setPen(QPen(Qt::red, toPixel(widthMainLine))); setPen(QPen(Qt::red, qApp->toPixel(widthMainLine)));
emit itemOut( numInOutList, true ); emit itemOut( numInOutList, true );
} }
QList<QGraphicsItem *> list = QGraphicsItem::collidingItems (); QList<QGraphicsItem *> list = QGraphicsItem::collidingItems ();
if ( list.size() - 2 > 0 ) if ( list.size() - 2 > 0 )
{ {
list.append( this ); list.append( this );
setPen(QPen(Qt::red, toPixel(widthMainLine))); setPen(QPen(Qt::red, qApp->toPixel(widthMainLine)));
emit itemColliding( list, 1 );//Detail intersect with other details. emit itemColliding( list, 1 );//Detail intersect with other details.
} }
else else

View File

@ -27,17 +27,18 @@
*************************************************************************/ *************************************************************************/
#include "vsimplearc.h" #include "vsimplearc.h"
#include "../widgets/vapplication.h"
VSimpleArc::VSimpleArc(quint32 id, Qt::GlobalColor *currentColor, qreal *factor, QObject *parent) VSimpleArc::VSimpleArc(quint32 id, Qt::GlobalColor *currentColor, qreal *factor, QObject *parent)
:QObject(parent), QGraphicsPathItem(), id (id), factor(factor), currentColor(currentColor) :QObject(parent), QGraphicsPathItem(), id (id), factor(factor), currentColor(currentColor)
{ {
if (factor == nullptr) if (factor == nullptr)
{ {
setPen(QPen(Qt::black, toPixel(widthHairLine))); setPen(QPen(Qt::black, qApp->toPixel(widthHairLine)));
} }
else else
{ {
setPen(QPen(Qt::black, toPixel(widthHairLine)/ *factor)); setPen(QPen(Qt::black, qApp->toPixel(widthHairLine)/ *factor));
} }
setFlag(QGraphicsItem::ItemIsSelectable, true); setFlag(QGraphicsItem::ItemIsSelectable, true);
setAcceptHoverEvents(true); setAcceptHoverEvents(true);
@ -57,11 +58,11 @@ void VSimpleArc::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
Q_UNUSED(event); Q_UNUSED(event);
if (factor == nullptr) if (factor == nullptr)
{ {
this->setPen(QPen(*currentColor, toPixel(widthMainLine))); this->setPen(QPen(*currentColor, qApp->toPixel(widthMainLine)));
} }
else else
{ {
this->setPen(QPen(*currentColor, toPixel(widthMainLine)/ *factor)); this->setPen(QPen(*currentColor, qApp->toPixel(widthMainLine)/ *factor));
} }
} }
@ -70,10 +71,10 @@ void VSimpleArc::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
Q_UNUSED(event); Q_UNUSED(event);
if (factor == nullptr) if (factor == nullptr)
{ {
this->setPen(QPen(*currentColor, toPixel(widthHairLine))); this->setPen(QPen(*currentColor, qApp->toPixel(widthHairLine)));
} }
else else
{ {
this->setPen(QPen(*currentColor, toPixel(widthHairLine)/ *factor)); this->setPen(QPen(*currentColor, qApp->toPixel(widthHairLine)/ *factor));
} }
} }

View File

@ -27,18 +27,18 @@
*************************************************************************/ *************************************************************************/
#include "vsimplespline.h" #include "vsimplespline.h"
#include "../options.h" #include "../widgets/vapplication.h"
VSimpleSpline::VSimpleSpline(quint32 id, Qt::GlobalColor *currentColor, qreal *factor, QObject *parent) VSimpleSpline::VSimpleSpline(quint32 id, Qt::GlobalColor *currentColor, qreal *factor, QObject *parent)
:QObject(parent), QGraphicsPathItem(), id (id), factor(factor), currentColor(currentColor) :QObject(parent), QGraphicsPathItem(), id (id), factor(factor), currentColor(currentColor)
{ {
if (factor == nullptr) if (factor == nullptr)
{ {
setPen(QPen(Qt::black, toPixel(widthHairLine))); setPen(QPen(Qt::black, qApp->toPixel(widthHairLine)));
} }
else else
{ {
setPen(QPen(Qt::black, toPixel(widthHairLine)/ *factor)); setPen(QPen(Qt::black, qApp->toPixel(widthHairLine)/ *factor));
} }
setFlag(QGraphicsItem::ItemIsSelectable, true); setFlag(QGraphicsItem::ItemIsSelectable, true);
setAcceptHoverEvents(true); setAcceptHoverEvents(true);
@ -48,7 +48,7 @@ void VSimpleSpline::ChangedActivDraw(const bool &flag)
{ {
setFlag(QGraphicsItem::ItemIsSelectable, flag); setFlag(QGraphicsItem::ItemIsSelectable, flag);
setAcceptHoverEvents(flag); setAcceptHoverEvents(flag);
setPen(QPen(*currentColor, toPixel(widthHairLine)/ *factor)); setPen(QPen(*currentColor, qApp->toPixel(widthHairLine)/ *factor));
} }
void VSimpleSpline::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) void VSimpleSpline::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
@ -65,11 +65,11 @@ void VSimpleSpline::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
Q_UNUSED(event); Q_UNUSED(event);
if (factor == nullptr) if (factor == nullptr)
{ {
this->setPen(QPen(*currentColor, toPixel(widthMainLine))); this->setPen(QPen(*currentColor, qApp->toPixel(widthMainLine)));
} }
else else
{ {
this->setPen(QPen(*currentColor, toPixel(widthMainLine)/ *factor)); this->setPen(QPen(*currentColor, qApp->toPixel(widthMainLine)/ *factor));
} }
} }
@ -78,10 +78,10 @@ void VSimpleSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
Q_UNUSED(event); Q_UNUSED(event);
if (factor == nullptr) if (factor == nullptr)
{ {
this->setPen(QPen(*currentColor, toPixel(widthHairLine))); this->setPen(QPen(*currentColor, qApp->toPixel(widthHairLine)));
} }
else else
{ {
this->setPen(QPen(*currentColor, toPixel(widthHairLine)/ *factor)); this->setPen(QPen(*currentColor, qApp->toPixel(widthHairLine)/ *factor));
} }
} }

View File

@ -27,6 +27,7 @@
*************************************************************************/ *************************************************************************/
#include "vsimplesplinepath.h" #include "vsimplesplinepath.h"
#include "../widgets/vapplication.h"
VSimpleSplinePath::VSimpleSplinePath(VPattern *doc, VContainer *data, quint32 id, qreal *factor) VSimpleSplinePath::VSimpleSplinePath(VPattern *doc, VContainer *data, quint32 id, qreal *factor)
:VAbstractTool(doc, data, id), factor(factor) :VAbstractTool(doc, data, id), factor(factor)
@ -45,11 +46,11 @@ void VSimpleSplinePath::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
void VSimpleSplinePath::hoverMoveEvent(QGraphicsSceneHoverEvent *event) void VSimpleSplinePath::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
this->setPen(QPen(currentColor, toPixel(widthMainLine)/ *factor)); this->setPen(QPen(currentColor, qApp->toPixel(widthMainLine)/ *factor));
} }
void VSimpleSplinePath::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) void VSimpleSplinePath::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
this->setPen(QPen(currentColor, toPixel(widthHairLine)/ *factor)); this->setPen(QPen(currentColor, qApp->toPixel(widthHairLine)/ *factor));
} }

View File

@ -84,8 +84,8 @@ void VPattern::CreateEmptyFile(const QString &tablePath)
patternElement.appendChild(createElement(TagNotes)); patternElement.appendChild(createElement(TagNotes));
QDomElement measurements = createElement(TagMeasurements); QDomElement measurements = createElement(TagMeasurements);
SetAttribute(measurements, "unit", patternUnit); SetAttribute(measurements, "unit", qApp->patternUnit());
SetAttribute(measurements, "type", patternType); SetAttribute(measurements, "type", qApp->patternType());
SetAttribute(measurements, "path", tablePath); SetAttribute(measurements, "path", tablePath);
patternElement.appendChild(measurements); patternElement.appendChild(measurements);
@ -547,8 +547,8 @@ void VPattern::ParseDetailElement(VMainGraphicsScene *sceneDetail, const QDomEle
VDetail detail; VDetail detail;
const quint32 id = GetParametrId(domElement); const quint32 id = GetParametrId(domElement);
detail.setName(GetParametrString(domElement, VAbstractTool::AttrName, "")); detail.setName(GetParametrString(domElement, VAbstractTool::AttrName, ""));
detail.setMx(toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "0.0"))); detail.setMx(qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "0.0")));
detail.setMy(toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "0.0"))); detail.setMy(qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "0.0")));
detail.setSeamAllowance(GetParametrUInt(domElement, VToolDetail::AttrSupplement, "1")); detail.setSeamAllowance(GetParametrUInt(domElement, VToolDetail::AttrSupplement, "1"));
detail.setWidth(GetParametrDouble(domElement, VToolDetail::AttrWidth, "10.0")); detail.setWidth(GetParametrDouble(domElement, VToolDetail::AttrWidth, "10.0"));
detail.setClosed(GetParametrUInt(domElement, VToolDetail::AttrClosed, "1")); detail.setClosed(GetParametrUInt(domElement, VToolDetail::AttrClosed, "1"));
@ -563,8 +563,8 @@ void VPattern::ParseDetailElement(VMainGraphicsScene *sceneDetail, const QDomEle
if (element.tagName() == VToolDetail::TagNode) if (element.tagName() == VToolDetail::TagNode)
{ {
const quint32 id = GetParametrUInt(element, VToolDetail::AttrIdObject, "0"); const quint32 id = GetParametrUInt(element, VToolDetail::AttrIdObject, "0");
const qreal mx = toPixel(GetParametrDouble(element, VAbstractTool::AttrMx, "0.0")); const qreal mx = qApp->toPixel(GetParametrDouble(element, VAbstractTool::AttrMx, "0.0"));
const qreal my = toPixel(GetParametrDouble(element, VAbstractTool::AttrMy, "0.0")); const qreal my = qApp->toPixel(GetParametrDouble(element, VAbstractTool::AttrMy, "0.0"));
const NodeDetail::NodeDetails nodeType = NodeDetail::Contour; const NodeDetail::NodeDetails nodeType = NodeDetail::Contour;
const QString t = GetParametrString(element, AttrType, "NodePoint"); const QString t = GetParametrString(element, AttrType, "NodePoint");
@ -650,10 +650,10 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d
{ {
const quint32 id = GetParametrId(domElement); const quint32 id = GetParametrId(domElement);
const QString name = GetParametrString(domElement, VAbstractTool::AttrName, "A"); const QString name = GetParametrString(domElement, VAbstractTool::AttrName, "A");
const qreal x = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrX, "10.0")); const qreal x = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrX, "10.0"));
const qreal y = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrY, "10.0")); const qreal y = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrY, "10.0"));
const qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); const qreal mx = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0"));
const qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); const qreal my = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0"));
data->UpdateGObject(id, new VPointF(x, y, name, mx, my)); data->UpdateGObject(id, new VPointF(x, y, name, mx, my));
VDrawTool::AddRecord(id, Valentina::SinglePointTool, this); VDrawTool::AddRecord(id, Valentina::SinglePointTool, this);
@ -685,8 +685,8 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d
{ {
const quint32 id = GetParametrId(domElement); const quint32 id = GetParametrId(domElement);
const QString name = GetParametrString(domElement, VAbstractTool::AttrName, ""); const QString name = GetParametrString(domElement, VAbstractTool::AttrName, "");
const qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); const qreal mx = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0"));
const qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); const qreal my = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0"));
const QString typeLine = GetParametrString(domElement, VAbstractTool::AttrTypeLine, const QString typeLine = GetParametrString(domElement, VAbstractTool::AttrTypeLine,
VAbstractTool::TypeLineLine); VAbstractTool::TypeLineLine);
const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "100.0"); const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "100.0");
@ -708,8 +708,8 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d
{ {
const quint32 id = GetParametrId(domElement); const quint32 id = GetParametrId(domElement);
const QString name = GetParametrString(domElement, VAbstractTool::AttrName, ""); const QString name = GetParametrString(domElement, VAbstractTool::AttrName, "");
const qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); const qreal mx = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0"));
const qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); const qreal my = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0"));
const QString typeLine = GetParametrString(domElement, VAbstractTool::AttrTypeLine, const QString typeLine = GetParametrString(domElement, VAbstractTool::AttrTypeLine,
VAbstractTool::TypeLineLine); VAbstractTool::TypeLineLine);
const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "100.0"); const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "100.0");
@ -731,8 +731,8 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d
{ {
const quint32 id = GetParametrId(domElement); const quint32 id = GetParametrId(domElement);
const QString name = GetParametrString(domElement, VAbstractTool::AttrName, ""); const QString name = GetParametrString(domElement, VAbstractTool::AttrName, "");
const qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); const qreal mx = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0"));
const qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); const qreal my = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0"));
const QString typeLine = GetParametrString(domElement, VAbstractTool::AttrTypeLine, const QString typeLine = GetParametrString(domElement, VAbstractTool::AttrTypeLine,
VAbstractTool::TypeLineLine); VAbstractTool::TypeLineLine);
const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "100.0"); const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "100.0");
@ -755,8 +755,8 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d
{ {
const quint32 id = GetParametrId(domElement); const quint32 id = GetParametrId(domElement);
const QString name = GetParametrString(domElement, VAbstractTool::AttrName, ""); const QString name = GetParametrString(domElement, VAbstractTool::AttrName, "");
const qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); const qreal mx = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0"));
const qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); const qreal my = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0"));
const QString typeLine = GetParametrString(domElement, VAbstractTool::AttrTypeLine, const QString typeLine = GetParametrString(domElement, VAbstractTool::AttrTypeLine,
VAbstractTool::TypeLineLine); VAbstractTool::TypeLineLine);
const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "100.0"); const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "100.0");
@ -779,8 +779,8 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d
{ {
const quint32 id = GetParametrId(domElement); const quint32 id = GetParametrId(domElement);
const QString name = GetParametrString(domElement, VAbstractTool::AttrName, ""); const QString name = GetParametrString(domElement, VAbstractTool::AttrName, "");
const qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); const qreal mx = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0"));
const qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); const qreal my = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0"));
const QString typeLine = GetParametrString(domElement, VAbstractTool::AttrTypeLine, const QString typeLine = GetParametrString(domElement, VAbstractTool::AttrTypeLine,
VAbstractTool::TypeLineLine); VAbstractTool::TypeLineLine);
const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "100.0"); const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "100.0");
@ -803,8 +803,8 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d
{ {
const quint32 id = GetParametrId(domElement); const quint32 id = GetParametrId(domElement);
const QString name = GetParametrString(domElement, VAbstractTool::AttrName, ""); const QString name = GetParametrString(domElement, VAbstractTool::AttrName, "");
const qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); const qreal mx = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0"));
const qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); const qreal my = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0"));
const quint32 p1Line1Id = GetParametrUInt(domElement, VAbstractTool::AttrP1Line1, "0"); const quint32 p1Line1Id = GetParametrUInt(domElement, VAbstractTool::AttrP1Line1, "0");
const quint32 p2Line1Id = GetParametrUInt(domElement, VAbstractTool::AttrP2Line1, "0"); const quint32 p2Line1Id = GetParametrUInt(domElement, VAbstractTool::AttrP2Line1, "0");
const quint32 p1Line2Id = GetParametrUInt(domElement, VAbstractTool::AttrP1Line2, "0"); const quint32 p1Line2Id = GetParametrUInt(domElement, VAbstractTool::AttrP1Line2, "0");
@ -825,8 +825,8 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d
{ {
const quint32 id = GetParametrId(domElement); const quint32 id = GetParametrId(domElement);
const QString name = GetParametrString(domElement, VAbstractTool::AttrName, ""); const QString name = GetParametrString(domElement, VAbstractTool::AttrName, "");
const qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); const qreal mx = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0"));
const qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); const qreal my = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0"));
const QString radius = GetParametrString(domElement, VAbstractTool::AttrRadius, "0"); const QString radius = GetParametrString(domElement, VAbstractTool::AttrRadius, "0");
const quint32 center = GetParametrUInt(domElement, VAbstractTool::AttrCenter, "0"); const quint32 center = GetParametrUInt(domElement, VAbstractTool::AttrCenter, "0");
const quint32 firstPointId = GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0"); const quint32 firstPointId = GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0");
@ -849,8 +849,8 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d
const quint32 idObject = GetParametrUInt(domElement, VAbstractNode::AttrIdObject, "0"); const quint32 idObject = GetParametrUInt(domElement, VAbstractNode::AttrIdObject, "0");
const quint32 idTool = GetParametrUInt(domElement, VAbstractNode::AttrIdTool, "0"); const quint32 idTool = GetParametrUInt(domElement, VAbstractNode::AttrIdTool, "0");
const VPointF *point = data->GeometricObject<const VPointF *>(idObject ); const VPointF *point = data->GeometricObject<const VPointF *>(idObject );
const qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); const qreal mx = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0"));
const qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); const qreal my = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0"));
data->UpdateGObject(id, new VPointF(point->x(), point->y(), point->name(), mx, my, idObject, data->UpdateGObject(id, new VPointF(point->x(), point->y(), point->name(), mx, my, idObject,
Valentina::Modeling)); Valentina::Modeling));
VNodePoint::Create(this, data, id, idObject, parse, Valentina::FromFile, idTool); VNodePoint::Create(this, data, id, idObject, parse, Valentina::FromFile, idTool);
@ -867,8 +867,8 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d
{ {
const quint32 id = GetParametrId(domElement); const quint32 id = GetParametrId(domElement);
const QString name = GetParametrString(domElement, VAbstractTool::AttrName, ""); const QString name = GetParametrString(domElement, VAbstractTool::AttrName, "");
const qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); const qreal mx = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0"));
const qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); const qreal my = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0"));
const QString typeLine = GetParametrString(domElement, VAbstractTool::AttrTypeLine, const QString typeLine = GetParametrString(domElement, VAbstractTool::AttrTypeLine,
VAbstractTool::TypeLineLine); VAbstractTool::TypeLineLine);
const quint32 basePointId = GetParametrUInt(domElement, VAbstractTool::AttrBasePoint, "0"); const quint32 basePointId = GetParametrUInt(domElement, VAbstractTool::AttrBasePoint, "0");
@ -890,8 +890,8 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d
{ {
const quint32 id = GetParametrId(domElement); const quint32 id = GetParametrId(domElement);
const QString name = GetParametrString(domElement, VAbstractTool::AttrName, ""); const QString name = GetParametrString(domElement, VAbstractTool::AttrName, "");
const qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); const qreal mx = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0"));
const qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); const qreal my = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0"));
const quint32 axisP1Id = GetParametrUInt(domElement, VAbstractTool::AttrAxisP1, "0"); const quint32 axisP1Id = GetParametrUInt(domElement, VAbstractTool::AttrAxisP1, "0");
const quint32 axisP2Id = GetParametrUInt(domElement, VAbstractTool::AttrAxisP2, "0"); const quint32 axisP2Id = GetParametrUInt(domElement, VAbstractTool::AttrAxisP2, "0");
const quint32 firstPointId = GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0"); const quint32 firstPointId = GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0");
@ -912,8 +912,8 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d
{ {
const quint32 id = GetParametrId(domElement); const quint32 id = GetParametrId(domElement);
const QString name = GetParametrString(domElement, VAbstractTool::AttrName, ""); const QString name = GetParametrString(domElement, VAbstractTool::AttrName, "");
const qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); const qreal mx = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0"));
const qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); const qreal my = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0"));
const quint32 firstPointId = GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0"); const quint32 firstPointId = GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0");
const quint32 secondPointId = GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0"); const quint32 secondPointId = GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0");
@ -932,8 +932,8 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d
{ {
const quint32 id = GetParametrId(domElement); const quint32 id = GetParametrId(domElement);
const QString name = GetParametrString(domElement, VAbstractTool::AttrName, ""); const QString name = GetParametrString(domElement, VAbstractTool::AttrName, "");
const qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); const qreal mx = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0"));
const qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); const qreal my = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0"));
const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "0"); const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "0");
const quint32 splineId = GetParametrUInt(domElement, VToolCutSpline::AttrSpline, "0"); const quint32 splineId = GetParametrUInt(domElement, VToolCutSpline::AttrSpline, "0");
@ -951,8 +951,8 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d
{ {
const quint32 id = GetParametrId(domElement); const quint32 id = GetParametrId(domElement);
const QString name = GetParametrString(domElement, VAbstractTool::AttrName, ""); const QString name = GetParametrString(domElement, VAbstractTool::AttrName, "");
const qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); const qreal mx = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0"));
const qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); const qreal my = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0"));
const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "0"); const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "0");
const quint32 splinePathId = GetParametrUInt(domElement, VToolCutSplinePath::AttrSplinePath, "0"); const quint32 splinePathId = GetParametrUInt(domElement, VToolCutSplinePath::AttrSplinePath, "0");
@ -971,8 +971,8 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d
{ {
const quint32 id = GetParametrId(domElement); const quint32 id = GetParametrId(domElement);
const QString name = GetParametrString(domElement, VAbstractTool::AttrName, ""); const QString name = GetParametrString(domElement, VAbstractTool::AttrName, "");
const qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); const qreal mx = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0"));
const qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); const qreal my = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0"));
const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "0"); const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "0");
const quint32 arcId = GetParametrUInt(domElement, VToolCutArc::AttrArc, "0"); const quint32 arcId = GetParametrUInt(domElement, VToolCutArc::AttrArc, "0");
@ -1246,7 +1246,7 @@ void VPattern::ParseIncrementsElement(const QDomNode &node)
const qreal kgrowth = GetParametrDouble(domElement, IncrementKgrowth, "0"); const qreal kgrowth = GetParametrDouble(domElement, IncrementKgrowth, "0");
const QString desc = GetParametrString(domElement, IncrementDescription, "Description"); const QString desc = GetParametrString(domElement, IncrementDescription, "Description");
data->UpdateId(id); data->UpdateId(id);
data->AddIncrementTableRow(name, VIncrementTableRow(id, base, ksize, kgrowth, desc)); data->AddIncrement(name, VIncrement(id, base, ksize, kgrowth, desc));
} }
} }
} }