From: Jason Harris Date: Mon, 15 Sep 2003 21:23:59 +0000 (+0000) Subject: when drawing KPlotObject::LABEL items, the position of the label is now X-Git-Tag: v3.2.0~1 X-Git-Url: https://git.rmz.fi/?a=commitdiff_plain;h=5e422411ba011e8267ca4a88822269d74bc4865f;p=libqmvoc.git when drawing KPlotObject::LABEL items, the position of the label is now centered on the data point's X-coordinate, and slightly below the data point in Y. This is useful for (and in fact assumes that one is) plotting the labels next to KPlotObject::POINT items that have the same coordinates. (This change was implemented in order to add planet labels to the solar system plotter in KStars). TODO: make the vertical offset adjustable. Should be zero by default. (have to wait for after 3.2) svn path=/trunk/kdeedu/libkdeedu/; revision=251365 --- diff --git a/kdeeduplot/kplotwidget.cpp b/kdeeduplot/kplotwidget.cpp index f8d439c..bb281fc 100644 --- a/kdeeduplot/kplotwidget.cpp +++ b/kdeeduplot/kplotwidget.cpp @@ -191,10 +191,10 @@ void KPlotWidget::drawObjects( QPainter *p ) { break; } - case KPlotObject::LABEL : + case KPlotObject::LABEL : //draw label centered at point in x, and slightly below point in y. { QPoint q = po->points()->first()->qpoint( PixRect, DataRect ); - p->drawText( q, po->name() ); + p->drawText( q.x()-20, q.y()+6, 40, 10, Qt::AlignCenter | Qt::DontClip, po->name() ); break; }