mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-03-31 11:08:16 -04:00
draw bottom legend after data curves in RSGraphWidget
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8255 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
0e16733ce0
commit
fd992161e1
@ -310,12 +310,15 @@ void RSGraphWidget::paintEvent(QPaintEvent *)
|
||||
_painter->drawRect(_rec);
|
||||
|
||||
/* Paint the scale */
|
||||
paintScale();
|
||||
paintScale1();
|
||||
/* Plot the rsDHT/allDHT data */
|
||||
paintData();
|
||||
/* Paint the rsDHT/allDHT totals */
|
||||
paintTotals();
|
||||
|
||||
// part of the scale that needs to write over the data curves.
|
||||
paintScale2();
|
||||
|
||||
if(_flags & RSGRAPH_FLAGS_SHOW_LEGEND)
|
||||
paintLegend() ;
|
||||
|
||||
@ -504,7 +507,7 @@ QString RSGraphWidget::totalToStr(qreal total)
|
||||
}
|
||||
|
||||
/** Paints the scale on the graph. */
|
||||
void RSGraphWidget::paintScale()
|
||||
void RSGraphWidget::paintScale1()
|
||||
{
|
||||
int top = _rec.y();
|
||||
int bottom = _rec.height();
|
||||
@ -535,21 +538,25 @@ void RSGraphWidget::paintScale()
|
||||
|
||||
/* Draw vertical separator */
|
||||
_painter->drawLine(SCALE_WIDTH, top, SCALE_WIDTH, bottom);
|
||||
}
|
||||
|
||||
// draw time below the graph
|
||||
void RSGraphWidget::paintScale2()
|
||||
{
|
||||
// draw time below the graph
|
||||
|
||||
static const int npix = 100 ;
|
||||
int bottom = _rec.height();
|
||||
static const int npix = 100 ;
|
||||
|
||||
for(int i=_rec.width();i>SCALE_WIDTH;i-=npix)
|
||||
{
|
||||
pos = bottom - FONT_SIZE;
|
||||
for(int i=_rec.width();i>SCALE_WIDTH;i-=npix)
|
||||
{
|
||||
qreal pos = bottom - FONT_SIZE;
|
||||
|
||||
int seconds = (_rec.width()-i)/_time_scale ; // pixels / (pixels per second) => seconds
|
||||
QString text = QString::number(seconds)+ " secs";
|
||||
int seconds = (_rec.width()-i)/_time_scale ; // pixels / (pixels per second) => seconds
|
||||
QString text = QString::number(seconds)+ " secs";
|
||||
|
||||
_painter->setPen(SCALE_COLOR);
|
||||
_painter->drawText(QPointF(i, _rec.height()-0.5*FONT_SIZE), text);
|
||||
}
|
||||
_painter->setPen(SCALE_COLOR);
|
||||
_painter->drawText(QPointF(i, _rec.height()-0.5*FONT_SIZE), text);
|
||||
}
|
||||
}
|
||||
|
||||
void RSGraphWidget::wheelEvent(QWheelEvent *e)
|
||||
|
@ -172,7 +172,8 @@ class RSGraphWidget: public QFrame
|
||||
/** Paints the scale in the graph. */
|
||||
void paintLegend();
|
||||
/** Paints the scale in the graph. */
|
||||
void paintScale();
|
||||
void paintScale1();
|
||||
void paintScale2();
|
||||
|
||||
QColor getColor(int i) ;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user