Coverity Scan.

--HG--
branch : release
This commit is contained in:
Roman Telezhynskyi 2015-03-02 21:20:09 +02:00
parent 850d51adac
commit 8b0de7504f
3 changed files with 30 additions and 23 deletions

View File

@ -28,10 +28,13 @@
#include "vtoolpoint.h"
#include <QKeyEvent>
#include <QLoggingCategory>
#include "../../geometry/vpointf.h"
#include "../../visualization/vgraphicssimpletextitem.h"
#include "../../undocommands/movelabel.h"
Q_LOGGING_CATEGORY(vToolPoint, "v.toolPoint")
const QString VToolPoint::TagName = QStringLiteral("point");
//---------------------------------------------------------------------------------------------------------------------
@ -78,13 +81,22 @@ void VToolPoint::paint(QPainter *painter, const QStyleOptionGraphicsItem *option
//---------------------------------------------------------------------------------------------------------------------
QString VToolPoint::name() const
{
try
{
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)
{
// Don't know if need check name here.
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(id);
obj->setName(name);
SaveOption(obj);

View File

@ -239,16 +239,9 @@ QLineF VContour::GlobalEdge(int i) const
return QLineF();
}
if (n <= 0)
{
return axis;
}
else
{
const qreal nShift = axis.length()/n;
return QLineF(nShift*(i-1), 0, nShift*i, 0);
}
}
else
{
if (i < 1 || i > EdgesCount())

View File

@ -580,7 +580,8 @@ QVector<QPointF> VPosition::CutEdge(const QLineF &edge, unsigned int shift)
points.append(edge.p1());
points.append(edge.p2());
}
else
{
const int n = qFloor(edge.length()/shift);
if (n <= 0)
@ -598,6 +599,7 @@ QVector<QPointF> VPosition::CutEdge(const QLineF &edge, unsigned int shift)
points.append(l1.p2());
}
}
}
return points;
}