Mailinglist Archive: yast-commit (819 mails)

< Previous Next >
[yast-commit] r54876 - /trunk/qt-graph/src/QGraph.cc
  • From: aschnell@xxxxxxxxxxxxxxxx
  • Date: Wed, 21 Jan 2009 19:31:16 -0000
  • Message-id: <E1LPinE-0008B7-Ub@xxxxxxxxxxxxxxxx>
Author: aschnell
Date: Wed Jan 21 20:31:16 2009
New Revision: 54876

URL: http://svn.opensuse.org/viewcvs/yast?rev=54876&view=rev
Log:
- improved node label drawing

Modified:
trunk/qt-graph/src/QGraph.cc

Modified: trunk/qt-graph/src/QGraph.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/qt-graph/src/QGraph.cc?rev=54876&r1=54875&r2=54876&view=diff
==============================================================================
--- trunk/qt-graph/src/QGraph.cc (original)
+++ trunk/qt-graph/src/QGraph.cc Wed Jan 21 20:31:16 2009
@@ -248,9 +248,15 @@
{
painter->setPen(textlabel->fontcolor);

- QRectF rect(-100, -100, 100, 100); // TODO
+ QFont font(painter->font());
+ font.setPixelSize(textlabel->fontsize);
+ painter->setFont(font);
+
+ QString text(textlabel->text);
+ QFontMetrics fm(painter->fontMetrics());
+ QRectF rect(fm.boundingRect(text));
rect.moveCenter(gToQ(textlabel->p, false));
- painter->drawText(rect, Qt::AlignCenter | Qt::AlignHCenter,
textlabel->text);
+ painter->drawText(rect, Qt::AlignCenter | Qt::AlignHCenter, text);
}



--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages