mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-19 14:25:27 +00:00
statistics: silence two Coverity warnings
Two warnings concerning division by zero and non-initialization of a member variable, respectively. Both are false positives. However, Coverity is excused because it probably doesn't understand std::vector<> and also can't know whether the object in question is generated in a different source file. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
402e7eaf97
commit
76d94eda23
1 changed files with 5 additions and 2 deletions
|
@ -32,7 +32,9 @@ Legend::Legend(QGraphicsWidget *chart, const std::vector<QString> &names) :
|
|||
e.width = fontHeight + 2.0 * legendBoxBorderSize +
|
||||
fm.size(Qt::TextSingleLine, e.text->text()).width();
|
||||
} else {
|
||||
fontHeight = 0.0;
|
||||
// Set to an arbitrary non-zero value, because Coverity doesn't understand
|
||||
// that we don't use the value as divisor below if entries is empty.
|
||||
fontHeight = 10.0;
|
||||
}
|
||||
setPen(QPen(legendBorderColor, legendBorderSize));
|
||||
setBrush(QBrush(legendColor));
|
||||
|
@ -42,7 +44,8 @@ Legend::Legend(QGraphicsWidget *chart, const std::vector<QString> &names) :
|
|||
|
||||
Legend::Entry::Entry(const QString &name, int idx, int numBins, QGraphicsItem *parent) :
|
||||
rect(new QGraphicsRectItem(parent)),
|
||||
text(new QGraphicsSimpleTextItem(name, parent))
|
||||
text(new QGraphicsSimpleTextItem(name, parent)),
|
||||
width(0)
|
||||
{
|
||||
rect->setZValue(ZValues::legend);
|
||||
rect->setPen(QPen(legendBorderColor, legendBoxBorderSize));
|
||||
|
|
Loading…
Add table
Reference in a new issue