Coverity Scan.
--HG-- branch : release
This commit is contained in:
parent
850d51adac
commit
8b0de7504f
|
@ -28,10 +28,13 @@
|
||||||
|
|
||||||
#include "vtoolpoint.h"
|
#include "vtoolpoint.h"
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
|
#include <QLoggingCategory>
|
||||||
#include "../../geometry/vpointf.h"
|
#include "../../geometry/vpointf.h"
|
||||||
#include "../../visualization/vgraphicssimpletextitem.h"
|
#include "../../visualization/vgraphicssimpletextitem.h"
|
||||||
#include "../../undocommands/movelabel.h"
|
#include "../../undocommands/movelabel.h"
|
||||||
|
|
||||||
|
Q_LOGGING_CATEGORY(vToolPoint, "v.toolPoint")
|
||||||
|
|
||||||
const QString VToolPoint::TagName = QStringLiteral("point");
|
const QString VToolPoint::TagName = QStringLiteral("point");
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -78,13 +81,22 @@ void VToolPoint::paint(QPainter *painter, const QStyleOptionGraphicsItem *option
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VToolPoint::name() const
|
QString VToolPoint::name() const
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
return VAbstractTool::data.GeometricObject<VPointF>(id)->name();
|
return VAbstractTool::data.GeometricObject<VPointF>(id)->name();
|
||||||
}
|
}
|
||||||
|
catch (const VExceptionBadId &e)
|
||||||
|
{
|
||||||
|
qCDebug(vToolPoint)<<"Error!"<<"Couldn't get point name."<<e.ErrorMessage()<<e.DetailedInformation();
|
||||||
|
return QString("");// Return empty string for property browser
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolPoint::setName(const QString &name)
|
void VToolPoint::setName(const QString &name)
|
||||||
{
|
{
|
||||||
|
// Don't know if need check name here.
|
||||||
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(id);
|
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(id);
|
||||||
obj->setName(name);
|
obj->setName(name);
|
||||||
SaveOption(obj);
|
SaveOption(obj);
|
||||||
|
|
|
@ -239,16 +239,9 @@ QLineF VContour::GlobalEdge(int i) const
|
||||||
return QLineF();
|
return QLineF();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (n <= 0)
|
|
||||||
{
|
|
||||||
return axis;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
const qreal nShift = axis.length()/n;
|
const qreal nShift = axis.length()/n;
|
||||||
return QLineF(nShift*(i-1), 0, nShift*i, 0);
|
return QLineF(nShift*(i-1), 0, nShift*i, 0);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (i < 1 || i > EdgesCount())
|
if (i < 1 || i > EdgesCount())
|
||||||
|
|
|
@ -580,7 +580,8 @@ QVector<QPointF> VPosition::CutEdge(const QLineF &edge, unsigned int shift)
|
||||||
points.append(edge.p1());
|
points.append(edge.p1());
|
||||||
points.append(edge.p2());
|
points.append(edge.p2());
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
const int n = qFloor(edge.length()/shift);
|
const int n = qFloor(edge.length()/shift);
|
||||||
|
|
||||||
if (n <= 0)
|
if (n <= 0)
|
||||||
|
@ -598,6 +599,7 @@ QVector<QPointF> VPosition::CutEdge(const QLineF &edge, unsigned int shift)
|
||||||
points.append(l1.p2());
|
points.append(l1.p2());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return points;
|
return points;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user