From 6e51a2bc2e4c5df15f21ea22538a99490a2c7099 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Thu, 10 Jun 2010 21:42:26 +0000 Subject: [PATCH] fix text cutting here too BUG:241330 svn path=/trunk/KDE/kdelibs/; revision=1136835 --- widgets/meter.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/widgets/meter.cpp b/widgets/meter.cpp index 5ed4b46af..0bec03406 100644 --- a/widgets/meter.cpp +++ b/widgets/meter.cpp @@ -72,6 +72,7 @@ void MeterPrivate::text(QPainter *p, int index) QRectF elementRect = image->elementRect(elementID); Qt::Alignment align = Qt::AlignCenter; + if (colors.count() > index) { p->setPen(QPen(colors[index])); } else { @@ -80,6 +81,15 @@ void MeterPrivate::text(QPainter *p, int index) if (fonts.count() > index) { p->setFont(fonts[index]); } + + QFontMetricsF fm(p->font()); + // If the height is too small increase the Height of the button to shall the whole text #192988 + if (elementRect.height() < fm.height()) { + QPointF oldCenter = elementRect.center(); + elementRect.setHeight(fm.height()); + elementRect.moveCenter(oldCenter); + } + if (alignments.count() > index) { align = alignments[index]; }