diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2014-11-05 16:02:06 +0100 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2014-11-05 16:04:28 +0100 |
commit | d064f7f3ee1b80c7e9ca1f149cae8aca4a071230 (patch) | |
tree | 875069ce3902c3cb5899cda63e224b3688c71559 | |
parent | 4e0e5e4bc8da2811754534bd5faee20afaa50b5c (diff) | |
parent | 93a3f0e7fea8699fca7e062156d7a22293d533b8 (diff) |
Merge pull request #5215
93a3f0e Qt: Network-Traffic-Graph: make some distance between line and text (Jonas Schnelli)
-rw-r--r-- | src/qt/trafficgraphwidget.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/qt/trafficgraphwidget.cpp b/src/qt/trafficgraphwidget.cpp index 74565bb6d0..5f14b80797 100644 --- a/src/qt/trafficgraphwidget.cpp +++ b/src/qt/trafficgraphwidget.cpp @@ -76,10 +76,12 @@ void TrafficGraphWidget::paintEvent(QPaintEvent *) int base = floor(log10(fMax)); float val = pow(10.0f, base); - const QString units = tr("KB/s"); + const QString units = tr("KB/s"); + const float yMarginText = 2.0; + // draw lines painter.setPen(axisCol); - painter.drawText(XMARGIN, YMARGIN + h - h * val / fMax, QString("%1 %2").arg(val).arg(units)); + painter.drawText(XMARGIN, YMARGIN + h - h * val / fMax-yMarginText, QString("%1 %2").arg(val).arg(units)); for(float y = val; y < fMax; y += val) { int yy = YMARGIN + h - h * y / fMax; painter.drawLine(XMARGIN, yy, width() - XMARGIN, yy); @@ -89,7 +91,7 @@ void TrafficGraphWidget::paintEvent(QPaintEvent *) axisCol = axisCol.darker(); val = pow(10.0f, base - 1); painter.setPen(axisCol); - painter.drawText(XMARGIN, YMARGIN + h - h * val / fMax, QString("%1 %2").arg(val).arg(units)); + painter.drawText(XMARGIN, YMARGIN + h - h * val / fMax-yMarginText, QString("%1 %2").arg(val).arg(units)); int count = 1; for(float y = val; y < fMax; y += val, count++) { // don't overwrite lines drawn above |