Merged from develop
--HG-- branch : feature
This commit is contained in:
commit
b48ac019d7
|
@ -5,7 +5,7 @@ Valentina Web page: http://www.valentina-project.org/
|
|||
Wiki: https://wiki.valentinaproject.org
|
||||
Valentina user manual https://bitbucket.org/dismine/valentina/wiki/manual/Content
|
||||
Valentina main repository: https://bitbucket.org/dismine/valentina/overview
|
||||
Valentina mail list (forum) https://groups.google.com/forum/#!forum/valentina-project-list
|
||||
Forum http://forum.valentina-project.org/
|
||||
PPA for Ubuntu (develop): https://launchpad.net/~dismine/+archive/valentina-dev
|
||||
Help translate https://www.transifex.com/organization/valentina
|
||||
IRC channel: #valentina on irc.freenode.net.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
image: gcc
|
||||
image: dismine/docker-valentina
|
||||
pipelines:
|
||||
default:
|
||||
- step:
|
||||
|
@ -12,8 +12,6 @@ pipelines:
|
|||
- uname -a
|
||||
- grep -i processor /proc/cpuinfo | wc -l
|
||||
- gcc --version
|
||||
- apt-get update # required to install qt
|
||||
- apt-get install -y xvfb qtbase5-dev libqt5svg5-dev qt5-default qttools5-dev-tools libqt5xmlpatterns5-dev libqt5core5a libqt5gui5 libqt5printsupport5 libqt5svg5 libqt5widgets5 libqt5xml5 libqt5xmlpatterns5 xpdf
|
||||
- mkdir build
|
||||
- cd build
|
||||
- qmake --version
|
||||
|
|
|
@ -228,7 +228,6 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
// cppcheck-suppress uninitMemberVar
|
||||
MApplication::MApplication(int &argc, char **argv)
|
||||
:VAbstractApplication(argc, argv),
|
||||
mainWindows(),
|
||||
|
|
|
@ -574,8 +574,7 @@ void TMainWindow::FileSave()
|
|||
else
|
||||
{
|
||||
QString error;
|
||||
bool result = SaveMeasurements(curFile, error);
|
||||
if (not result)
|
||||
if (not SaveMeasurements(curFile, error))
|
||||
{
|
||||
QMessageBox messageBox;
|
||||
messageBox.setIcon(QMessageBox::Warning);
|
||||
|
@ -1534,9 +1533,7 @@ void TMainWindow::SaveMValue()
|
|||
return;
|
||||
}
|
||||
|
||||
const bool ok = EvalFormula(text, true, meash->GetData(), ui->labelCalculatedValue);
|
||||
|
||||
if (not ok)
|
||||
if (not EvalFormula(text, true, meash->GetData(), ui->labelCalculatedValue))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -615,9 +615,7 @@ void DialogIncrements::SaveIncrFormula()
|
|||
}
|
||||
|
||||
QSharedPointer<VIncrement> incr = data->GetVariable<VIncrement>(nameField->text());
|
||||
const bool ok = EvalIncrementFormula(text, true, incr->GetData(), ui->labelCalculatedValue);
|
||||
|
||||
if (not ok)
|
||||
if (not EvalIncrementFormula(text, true, incr->GetData(), ui->labelCalculatedValue))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -284,7 +284,7 @@ bool DialogSaveLayout::TestPdf()
|
|||
#else
|
||||
proc.start(PDFTOPS); // Seek pdftops in standard path
|
||||
#endif
|
||||
if (proc.waitForFinished(15000))
|
||||
if (proc.waitForFinished(15000) || proc.state() == QProcess::NotRunning)
|
||||
{
|
||||
res = true;
|
||||
}
|
||||
|
|
|
@ -1021,7 +1021,7 @@ void VPattern::ParseToolBasePoint(VMainGraphicsScene *scene, const QDomElement &
|
|||
SCASSERT(scene != nullptr);
|
||||
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
||||
|
||||
VToolBasePoint *spoint = 0;
|
||||
VToolBasePoint *spoint = nullptr;
|
||||
try
|
||||
{
|
||||
quint32 id = 0;
|
||||
|
@ -1034,7 +1034,7 @@ void VPattern::ParseToolBasePoint(VMainGraphicsScene *scene, const QDomElement &
|
|||
const qreal y = qApp->toPixel(GetParametrDouble(domElement, AttrY, "10.0"));
|
||||
|
||||
VPointF *point = new VPointF(x, y, name, mx, my);
|
||||
VToolBasePoint::Create(id, nameActivPP, point, scene, this, data, parse, Source::FromFile);
|
||||
spoint = VToolBasePoint::Create(id, nameActivPP, point, scene, this, data, parse, Source::FromFile);
|
||||
}
|
||||
catch (const VExceptionBadId &e)
|
||||
{
|
||||
|
|
|
@ -262,7 +262,7 @@ void VAbstractConverter::ValidateInputFile(const QString ¤tSchema) const
|
|||
{
|
||||
if (ver < MinVer())
|
||||
{ // Version less than minimally supported version. Can't do anything.
|
||||
throw e;
|
||||
throw;
|
||||
}
|
||||
else if (ver > MaxVer())
|
||||
{ // Version bigger than maximum supported version. We still have a chance to open the file.
|
||||
|
@ -278,7 +278,7 @@ void VAbstractConverter::ValidateInputFile(const QString ¤tSchema) const
|
|||
}
|
||||
else
|
||||
{ // Unexpected version. Most time mean that we do not catch all versions between min and max.
|
||||
throw e;
|
||||
throw;
|
||||
}
|
||||
|
||||
return; // All is fine and we can try to convert to current max version.
|
||||
|
|
|
@ -1218,30 +1218,19 @@ QDomElement VAbstractPattern::CheckTagExists(const QString &tag)
|
|||
switch (tags.indexOf(tag))
|
||||
{
|
||||
case 0: //TagUnit
|
||||
{
|
||||
return QDomElement();
|
||||
break;// Mandatory tag
|
||||
}
|
||||
return QDomElement();// Mandatory tag
|
||||
case 1: //TagImage
|
||||
{
|
||||
element = createElement(TagImage);
|
||||
break;
|
||||
}
|
||||
case 2: //TagAuthor
|
||||
{
|
||||
element = createElement(TagAuthor);
|
||||
break;
|
||||
}
|
||||
case 3: //TagDescription
|
||||
{
|
||||
element = createElement(TagDescription);
|
||||
break;
|
||||
}
|
||||
case 4: //TagNotes
|
||||
{
|
||||
element = createElement(TagNotes);
|
||||
break;
|
||||
}
|
||||
case 5: //TagGradation
|
||||
{
|
||||
element = createElement(TagGradation);
|
||||
|
@ -1256,46 +1245,28 @@ QDomElement VAbstractPattern::CheckTagExists(const QString &tag)
|
|||
break;
|
||||
}
|
||||
case 6: // TagPatternName
|
||||
{
|
||||
element = createElement(TagPatternName);
|
||||
break;
|
||||
}
|
||||
case 7: // TagPatternNum
|
||||
{
|
||||
element = createElement(TagPatternNum);
|
||||
break;
|
||||
}
|
||||
case 8: // TagCompanyName
|
||||
{
|
||||
element = createElement(TagCompanyName);
|
||||
break;
|
||||
}
|
||||
case 9: // TagCustomerName
|
||||
{
|
||||
element = createElement(TagCustomerName);
|
||||
break;
|
||||
}
|
||||
case 10: // TagSize
|
||||
{
|
||||
element = createElement(TagSize);
|
||||
break;
|
||||
}
|
||||
case 11: // TagShowDate
|
||||
{
|
||||
element = createElement(TagShowDate);
|
||||
break;
|
||||
}
|
||||
case 12: // TagShowMeasurements
|
||||
{
|
||||
element = createElement(TagShowMeasurements);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
return QDomElement();
|
||||
break;
|
||||
}
|
||||
}
|
||||
InsertTag(tags, element);
|
||||
return element;
|
||||
|
|
|
@ -351,13 +351,13 @@ quint32 VDomDocument::GetParametrId(const QDomElement &domElement) const
|
|||
{
|
||||
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
||||
|
||||
quint32 id = 0;
|
||||
quint32 id = NULL_ID;
|
||||
|
||||
QString message = tr("Got wrong parameter id. Need only id > 0.");
|
||||
const QString message = tr("Got wrong parameter id. Need only id > 0.");
|
||||
try
|
||||
{
|
||||
id = GetParametrUInt(domElement, VDomDocument::AttrId, NULL_ID_STR);
|
||||
if (id <= 0)
|
||||
if (id == NULL_ID)
|
||||
{
|
||||
throw VExceptionWrongId(message, domElement);
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ class QMUPARSERSHARED_EXPORT QmuParserTester : public QObject // final
|
|||
public:
|
||||
typedef int ( QmuParserTester::*testfun_type ) ();
|
||||
|
||||
QmuParserTester(QObject *parent = nullptr);
|
||||
explicit QmuParserTester(QObject *parent = nullptr);
|
||||
|
||||
private slots:
|
||||
void Run();
|
||||
|
|
|
@ -172,12 +172,12 @@ bool DL_Dxf::in(std::stringstream& stream,
|
|||
*/
|
||||
bool DL_Dxf::readDxfGroups(FILE *fp, DL_CreationInterface* creationInterface)
|
||||
{
|
||||
static int line = 1;
|
||||
|
||||
// Read one group of the DXF file and strip the lines:
|
||||
if (DL_Dxf::getStrippedLine(groupCodeTmp, DL_DXF_MAXLINE, fp) &&
|
||||
DL_Dxf::getStrippedLine(groupValue, DL_DXF_MAXLINE, fp, false) )
|
||||
{
|
||||
static int line = 1;
|
||||
|
||||
groupCode = static_cast<quint32>(toInt(groupCodeTmp));
|
||||
|
||||
creationInterface->processCodeValuePair(groupCode, groupValue);
|
||||
|
@ -196,12 +196,11 @@ bool DL_Dxf::readDxfGroups(FILE *fp, DL_CreationInterface* creationInterface)
|
|||
bool DL_Dxf::readDxfGroups(std::stringstream& stream,
|
||||
DL_CreationInterface* creationInterface)
|
||||
{
|
||||
static int line = 1;
|
||||
|
||||
// Read one group of the DXF file and chop the lines:
|
||||
if (DL_Dxf::getStrippedLine(groupCodeTmp, DL_DXF_MAXLINE, stream) &&
|
||||
DL_Dxf::getStrippedLine(groupValue, DL_DXF_MAXLINE, stream, false) )
|
||||
{
|
||||
static int line = 1;
|
||||
|
||||
groupCode = static_cast<quint32>(toInt(groupCodeTmp));
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ class VArcData : public QSharedData
|
|||
public:
|
||||
VArcData();
|
||||
VArcData(qreal radius, QString formulaRadius);
|
||||
VArcData(qreal radius);
|
||||
explicit VArcData(qreal radius);
|
||||
VArcData(const VArcData &arc);
|
||||
virtual ~VArcData();
|
||||
|
||||
|
|
|
@ -81,6 +81,7 @@ protected:
|
|||
private:
|
||||
QSharedDataPointer<VEllipticalArcData> d;
|
||||
|
||||
// cppcheck-suppress unusedPrivateFunction
|
||||
QVector<qreal> GetAngles () const;
|
||||
qreal MaxLength() const;
|
||||
QPointF GetPoint (qreal angle) const;
|
||||
|
|
|
@ -681,7 +681,7 @@ void VLayoutDetail::SetMirror(bool value)
|
|||
* @param dAng angle of rotation
|
||||
* @return position of point pt after rotating it around the center for dAng radians
|
||||
*/
|
||||
QPointF VLayoutDetail::RotatePoint(const QPointF &ptCenter, const QPointF& pt, qreal dAng) const
|
||||
QPointF VLayoutDetail::RotatePoint(const QPointF &ptCenter, const QPointF& pt, qreal dAng)
|
||||
{
|
||||
QPointF ptDest;
|
||||
QPointF ptRel = pt - ptCenter;
|
||||
|
@ -723,10 +723,10 @@ QVector<QPointF> VLayoutDetail::Mirror(const QVector<QPointF> &points) const
|
|||
* @param pt2 second point
|
||||
* @return Euclidian distance between the two points
|
||||
*/
|
||||
qreal VLayoutDetail::GetDistance(const QPointF &pt1, const QPointF &pt2) const
|
||||
qreal VLayoutDetail::GetDistance(const QPointF &pt1, const QPointF &pt2)
|
||||
{
|
||||
qreal dX = pt1.x() - pt2.x();
|
||||
qreal dY = pt1.y() - pt2.y();
|
||||
const qreal dX = pt1.x() - pt2.x();
|
||||
const qreal dY = pt1.y() - pt2.y();
|
||||
|
||||
return qSqrt(dX*dX + dY*dY);
|
||||
}
|
||||
|
|
|
@ -100,9 +100,9 @@ private:
|
|||
QVector<QPointF> Map(const QVector<QPointF> &points) const;
|
||||
static QVector<QPointF> RoundPoints(const QVector<QPointF> &points);
|
||||
|
||||
QPointF RotatePoint(const QPointF& ptCenter, const QPointF& pt, qreal dAng) const;
|
||||
static QPointF RotatePoint(const QPointF& ptCenter, const QPointF& pt, qreal dAng);
|
||||
QVector<QPointF> Mirror(const QVector<QPointF>& points) const;
|
||||
qreal GetDistance(const QPointF& pt1, const QPointF& pt2) const;
|
||||
static qreal GetDistance(const QPointF& pt1, const QPointF& pt2);
|
||||
};
|
||||
|
||||
Q_DECLARE_TYPEINFO(VLayoutDetail, Q_MOVABLE_TYPE);
|
||||
|
|
|
@ -18,7 +18,7 @@ TextLine::TextLine()
|
|||
* @brief VTextManager::VTextManager constructor
|
||||
*/
|
||||
VTextManager::VTextManager()
|
||||
:m_font(), m_liLines(), m_liOutput()
|
||||
:m_font(), m_liLines(), m_liOutput()
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -327,7 +327,7 @@ QStringList VTextManager::SplitString(const QString &qs, qreal fW, const QFontMe
|
|||
{
|
||||
if (qsCurrent.length() > 0)
|
||||
{
|
||||
qsCurrent += QLatin1Literal(" ");
|
||||
qsCurrent += QLatin1String(" ");
|
||||
}
|
||||
// check if another word can be added into current line
|
||||
if (fm.width(qsCurrent + qslWords[i]) > fW)
|
||||
|
|
|
@ -51,7 +51,7 @@ public:
|
|||
void Update(const VAbstractPattern* pDoc);
|
||||
|
||||
protected:
|
||||
QStringList SplitString(const QString& qs, qreal fW, const QFontMetrics& fm);
|
||||
static QStringList SplitString(const QString& qs, qreal fW, const QFontMetrics& fm);
|
||||
|
||||
private:
|
||||
QFont m_font;
|
||||
|
|
|
@ -88,8 +88,9 @@ QString compilerString()
|
|||
{
|
||||
return QLatin1String("MSVC ") + QString::number(2008 + 2 * ((_MSC_VER / 100) - 15));
|
||||
}
|
||||
#else
|
||||
return QStringLiteral("<unknown compiler>");
|
||||
#endif
|
||||
return QLatin1String("<unknown compiler>");
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -90,7 +90,7 @@ QxtCsvModel::QxtCsvModel(QIODevice *file, QObject *parent, bool withHeader, QCha
|
|||
|
||||
\sa setSource
|
||||
*/
|
||||
QxtCsvModel::QxtCsvModel(const QString filename, QObject *parent, bool withHeader, QChar separator)
|
||||
QxtCsvModel::QxtCsvModel(const QString &filename, QObject *parent, bool withHeader, QChar separator)
|
||||
: QAbstractTableModel(parent)
|
||||
{
|
||||
QXT_INIT_PRIVATE(QxtCsvModel);
|
||||
|
@ -176,7 +176,7 @@ QVariant QxtCsvModel::headerData(int section, Qt::Orientation orientation, int r
|
|||
|
||||
Reads in a CSV file from the provided \a file using \a codec.
|
||||
*/
|
||||
void QxtCsvModel::setSource(const QString filename, bool withHeader, QChar separator, QTextCodec* codec)
|
||||
void QxtCsvModel::setSource(const QString &filename, bool withHeader, QChar separator, QTextCodec* codec)
|
||||
{
|
||||
QFile src(filename);
|
||||
setSource(&src, withHeader, separator, codec);
|
||||
|
@ -194,6 +194,7 @@ void QxtCsvModel::setSource(const QString filename, bool withHeader, QChar separ
|
|||
void QxtCsvModel::setSource(QIODevice *file, bool withHeader, QChar separator, QTextCodec* codec)
|
||||
{
|
||||
QxtCsvModelPrivate* d_ptr = &qxt_d();
|
||||
// cppcheck-suppress unreadVariable
|
||||
bool headerSet = !withHeader;
|
||||
if (not file->isOpen())
|
||||
{
|
||||
|
@ -653,7 +654,7 @@ void QxtCsvModel::toCSV(QIODevice* dest, bool withHeader, QChar separator, QText
|
|||
Fields in the output file will be separated by \a separator. Set \a withHeader to true
|
||||
to output a row of headers at the top of the file.
|
||||
*/
|
||||
void QxtCsvModel::toCSV(const QString filename, bool withHeader, QChar separator, QTextCodec* codec) const
|
||||
void QxtCsvModel::toCSV(const QString &filename, bool withHeader, QChar separator, QTextCodec* codec) const
|
||||
{
|
||||
QFile dest(filename);
|
||||
toCSV(&dest, withHeader, separator, codec);
|
||||
|
@ -695,6 +696,7 @@ void QxtCsvModel::setQuoteMode(QuoteMode mode)
|
|||
*/
|
||||
void QxtCsvModel::setText(int row, int column, const QString& value)
|
||||
{
|
||||
// cppcheck-suppress indexCalled
|
||||
setData(index(row, column), value);
|
||||
}
|
||||
|
||||
|
@ -705,6 +707,7 @@ void QxtCsvModel::setText(int row, int column, const QString& value)
|
|||
*/
|
||||
QString QxtCsvModel::text(int row, int column) const
|
||||
{
|
||||
// cppcheck-suppress indexCalled
|
||||
return data(index(row, column)).toString();
|
||||
}
|
||||
|
||||
|
|
|
@ -46,9 +46,9 @@ class QxtCsvModel : public QAbstractTableModel
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QxtCsvModel(QObject *parent = nullptr);
|
||||
explicit QxtCsvModel(QObject *parent = nullptr);
|
||||
explicit QxtCsvModel(QIODevice *file, QObject *parent = nullptr, bool withHeader = false, QChar separator = ',');
|
||||
explicit QxtCsvModel(const QString filename, QObject *parent = nullptr, bool withHeader = false,
|
||||
explicit QxtCsvModel(const QString &filename, QObject *parent = nullptr, bool withHeader = false,
|
||||
QChar separator = ',');
|
||||
virtual ~QxtCsvModel();
|
||||
|
||||
|
@ -82,10 +82,11 @@ public:
|
|||
virtual bool removeColumns(int col, int count, const QModelIndex& parent = QModelIndex()) Q_DECL_OVERRIDE;
|
||||
|
||||
void setSource(QIODevice *file, bool withHeader = false, QChar separator = ',', QTextCodec* codec = nullptr);
|
||||
void setSource(const QString filename, bool withHeader = false, QChar separator = ',', QTextCodec* codec = nullptr);
|
||||
void setSource(const QString &filename, bool withHeader = false, QChar separator = ',',
|
||||
QTextCodec* codec = nullptr);
|
||||
|
||||
void toCSV(QIODevice *file, bool withHeader = false, QChar separator = ',', QTextCodec* codec = nullptr) const;
|
||||
void toCSV(const QString filename, bool withHeader = false, QChar separator = ',',
|
||||
void toCSV(const QString &filename, bool withHeader = false, QChar separator = ',',
|
||||
QTextCodec* codec = nullptr) const;
|
||||
|
||||
enum QuoteOption { NoQuotes = 0,
|
||||
|
|
|
@ -80,11 +80,13 @@ VAbstractApplication::VAbstractApplication(int &argc, char **argv)
|
|||
Settings()->sync();
|
||||
});
|
||||
|
||||
#if !defined(V_NO_ASSERT)
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 4, 1)
|
||||
#if defined(V_NO_ASSERT)
|
||||
// Ignore SSL-related warnings
|
||||
// See issue #528: Error: QSslSocket: cannot resolve SSLv2_client_method.
|
||||
qputenv("QT_LOGGING_RULES", "qt.network.ssl.warning=false");
|
||||
#endif //!defined(V_NO_ASSERT)
|
||||
#endif //defined(V_NO_ASSERT)
|
||||
#endif // QT_VERSION >= QT_VERSION_CHECK(5, 4, 1)
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -134,6 +134,7 @@ static point2d_t* point_alloc()
|
|||
|
||||
p = (point2d_t*)malloc(sizeof(point2d_t));
|
||||
assert( p != NULL );
|
||||
// cppcheck-suppress memsetClassFloat
|
||||
memset(p, 0, sizeof(point2d_t));
|
||||
|
||||
return p;
|
||||
|
|
|
@ -784,7 +784,7 @@ QString VTranslateVars::FormulaFromUser(const QString &formula, bool osSeparator
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString VTranslateVars::TryFormulaFromUser(const QString &formula, bool osSeparator) const
|
||||
QString VTranslateVars::TryFormulaFromUser(const QString &formula, bool osSeparator)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
|
@ -54,7 +54,7 @@ public:
|
|||
QString PostfixOperator(const QString &name) const;
|
||||
|
||||
QString FormulaFromUser(const QString &formula, bool osSeparator) const;
|
||||
QString TryFormulaFromUser(const QString &formula, bool osSeparator) const;
|
||||
static QString TryFormulaFromUser(const QString &formula, bool osSeparator);
|
||||
QString FormulaToUser(const QString &formula, bool osSeparator) const;
|
||||
|
||||
virtual void Retranslate() Q_DECL_OVERRIDE;
|
||||
|
|
|
@ -599,6 +599,7 @@ bool VToolSplinePath::IsMovable(int index) const
|
|||
const auto splPath = VAbstractTool::data.GeometricObject<VSplinePath>(id);
|
||||
|
||||
//index == -1 - can delete, but decided to left
|
||||
// cppcheck-suppress redundantCondition
|
||||
if (index == -1 || index < 1 || index > splPath->CountSubSpl())
|
||||
{
|
||||
return false;
|
||||
|
|
|
@ -46,10 +46,9 @@ VToolLinePoint::VToolLinePoint(VAbstractPattern *doc, VContainer *data, const qu
|
|||
const QString &lineColor, const QString &formula, const quint32 &basePointId,
|
||||
const qreal &angle, QGraphicsItem *parent)
|
||||
:VToolSinglePoint(doc, data, id, parent), formulaLength(formula), angle(angle), basePointId(basePointId),
|
||||
mainLine(nullptr), lineColor(ColorBlack)
|
||||
mainLine(nullptr), lineColor(lineColor)
|
||||
{
|
||||
this->typeLine = typeLine;
|
||||
this->lineColor = lineColor;
|
||||
Q_ASSERT_X(basePointId != 0, Q_FUNC_INFO, "basePointId == 0"); //-V654 //-V712
|
||||
QPointF point1 = *data->GeometricObject<VPointF>(basePointId);
|
||||
QPointF point2 = *data->GeometricObject<VPointF>(id);
|
||||
|
|
|
@ -49,10 +49,9 @@ VToolLine::VToolLine(VAbstractPattern *doc, VContainer *data, quint32 id, quint3
|
|||
const QString &typeLine, const QString &lineColor, const Source &typeCreation,
|
||||
QGraphicsItem *parent)
|
||||
:VDrawTool(doc, data, id), QGraphicsLineItem(parent), firstPoint(firstPoint), secondPoint(secondPoint),
|
||||
lineColor(ColorBlack)
|
||||
lineColor(lineColor)
|
||||
{
|
||||
this->typeLine = typeLine;
|
||||
this->lineColor = lineColor;
|
||||
//Line
|
||||
const QSharedPointer<VPointF> first = data->GeometricObject<VPointF>(firstPoint);
|
||||
const QSharedPointer<VPointF> second = data->GeometricObject<VPointF>(secondPoint);
|
||||
|
|
|
@ -306,7 +306,7 @@ void VAbstractTool::AddRecord(const quint32 id, const Tool &toolType, VAbstractP
|
|||
}
|
||||
|
||||
quint32 cursor = doc->getCursor();
|
||||
if (cursor <= 0)
|
||||
if (cursor == NULL_ID)
|
||||
{
|
||||
history->append(record);
|
||||
}
|
||||
|
|
|
@ -91,21 +91,19 @@ void VTextGraphicsItem::paint(QPainter *painter, const QStyleOptionGraphicsItem
|
|||
painter->fillRect(option->rect, QColor(251, 251, 175));
|
||||
painter->setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing);
|
||||
|
||||
// draw text lines
|
||||
int iY = 0;
|
||||
int iH = 0;
|
||||
painter->setPen(Qt::black);
|
||||
QFont fnt = m_tm.GetFont();
|
||||
// draw text lines
|
||||
int iY = 0;
|
||||
for (int i = 0; i < m_tm.GetCount(); ++i)
|
||||
{
|
||||
const TextLine& tl = m_tm.GetLine(i);
|
||||
iH = tl.m_iHeight;
|
||||
fnt.setPixelSize(m_tm.GetFont().pixelSize() + tl.m_iFontSize);
|
||||
fnt.setWeight(tl.m_eFontWeight);
|
||||
fnt.setStyle(tl.m_eStyle);
|
||||
painter->setFont(fnt);
|
||||
painter->drawText(0, iY, qRound(boundingRect().width()), iH, tl.m_eAlign, tl.m_qsText);
|
||||
iY += iH + m_tm.GetSpacing();
|
||||
painter->drawText(0, iY, qRound(boundingRect().width()), tl.m_iHeight, tl.m_eAlign, tl.m_qsText);
|
||||
iY += tl.m_iHeight + m_tm.GetSpacing();
|
||||
}
|
||||
|
||||
// now draw the features specific to non-normal modes
|
||||
|
@ -562,7 +560,7 @@ QRectF VTextGraphicsItem::GetBoundingRect(QRectF rectBB, qreal dRot) const
|
|||
qreal dY1 = 0;
|
||||
qreal dY2 = 0;
|
||||
|
||||
double dAng = qDegreesToRadians(dRot);
|
||||
double dAng = qDegreesToRadians(dRot);
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
QPointF pt = apt[i] - ptCenter;
|
||||
|
|
|
@ -52,8 +52,8 @@ class VTextGraphicsItem : public QGraphicsObject
|
|||
};
|
||||
|
||||
public:
|
||||
VTextGraphicsItem(QGraphicsItem* pParent = 0);
|
||||
~VTextGraphicsItem();
|
||||
explicit VTextGraphicsItem(QGraphicsItem* pParent = nullptr);
|
||||
virtual ~VTextGraphicsItem();
|
||||
|
||||
void SetFont(const QFont& fnt);
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
||||
|
|
|
@ -525,7 +525,6 @@ VToolUnionDetails* VToolUnionDetails::Create(const quint32 _id, const VDetail &d
|
|||
VContainer *data, const Document &parse, const Source &typeCreation,
|
||||
bool retainPieces)
|
||||
{
|
||||
VToolUnionDetails *unionDetails = 0;
|
||||
quint32 id = _id;
|
||||
QString drawName;
|
||||
if (typeCreation == Source::FromGui)
|
||||
|
@ -546,10 +545,12 @@ VToolUnionDetails* VToolUnionDetails::Create(const quint32 _id, const VDetail &d
|
|||
if (parse == Document::FullParse)
|
||||
{
|
||||
//Scene doesn't show this tool, so doc will destroy this object.
|
||||
unionDetails = new VToolUnionDetails(doc, data, id, d1, d2, indexD1, indexD2, typeCreation, drawName, doc);
|
||||
VToolUnionDetails *unionDetails = new VToolUnionDetails(doc, data, id, d1, d2, indexD1, indexD2, typeCreation,
|
||||
drawName, doc);
|
||||
doc->AddTool(id, unionDetails);
|
||||
// Unfortunatelly doc will destroy all objects only in the end, but we should delete them before each FullParse
|
||||
doc->AddToolOnRemove(unionDetails);
|
||||
return unionDetails;
|
||||
}
|
||||
//Then create new details
|
||||
VNodeDetail det1p1;
|
||||
|
|
|
@ -89,7 +89,7 @@ void AddToCalc::redo()
|
|||
QDomElement calcElement;
|
||||
if (doc->GetActivNodeElement(VAbstractPattern::TagCalculation, calcElement))
|
||||
{
|
||||
if (cursor <= 0)
|
||||
if (cursor == NULL_ID)
|
||||
{
|
||||
calcElement.appendChild(xml);
|
||||
}
|
||||
|
|
|
@ -93,15 +93,16 @@ bool AbstractTest::Run(bool showWarn, int exit, int &exitCode, const QString &pr
|
|||
return false;
|
||||
}
|
||||
|
||||
QProcess *process = new QProcess(this);
|
||||
QScopedPointer<QProcess> process(new QProcess());
|
||||
process->setWorkingDirectory(info.absoluteDir().absolutePath());
|
||||
process->start(program, arguments);
|
||||
|
||||
if (not process->waitForFinished(msecs))
|
||||
if (not process->waitForFinished(msecs) && process->state() != QProcess::NotRunning)
|
||||
{
|
||||
const QString msg = QString("The operation timed out or an error occurred.\n%1").arg(parameters);
|
||||
QWARN(qUtf8Printable(msg));
|
||||
exitCode = TST_EX_TIME_OUT;
|
||||
process->kill();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -126,7 +127,6 @@ bool AbstractTest::Run(bool showWarn, int exit, int &exitCode, const QString &pr
|
|||
}
|
||||
|
||||
exitCode = process->exitCode();
|
||||
delete process;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user