]> Git trees. - libqmvoc.git/commitdiff
when drawing KPlotObject::LABEL items, the position of the label is now
authorJason Harris <kstars@30doradus.org>
Mon, 15 Sep 2003 21:23:59 +0000 (21:23 +0000)
committerJason Harris <kstars@30doradus.org>
Mon, 15 Sep 2003 21:23:59 +0000 (21:23 +0000)
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

index f8d439cdf8f2c98cba0d850dc46ad3a3fc659972..bb281fcf8670ab75f21f68aa025fc0b9e3196bb5 100644 (file)
@@ -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;
                                }