From 5e422411ba011e8267ca4a88822269d74bc4865f Mon Sep 17 00:00:00 2001 From: Jason Harris Date: Mon, 15 Sep 2003 21:23:59 +0000 Subject: [PATCH] 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 --- kdeeduplot/kplotwidget.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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; } -- 2.47.3