-a size hint. hardcoded because here we can't really have infos but is already better than nothing
-if the alignment of lablels is left, paint with a point instead of a rect, so won't clip away the text svn path=/trunk/KDE/kdelibs/; revision=1083230
This commit is contained in:
parent
1ae27ef35f
commit
989df58b2b
@ -82,7 +82,11 @@ void MeterPrivate::text(QPainter *p, int index)
|
||||
align = alignments[index];
|
||||
}
|
||||
if (elementRect.width() > elementRect.height()) {
|
||||
p->drawText(elementRect, align, text);
|
||||
if (align&Qt::AlignLeft) {
|
||||
p->drawText(elementRect.bottomLeft(), text);
|
||||
} else {
|
||||
p->drawText(elementRect, align, text);
|
||||
}
|
||||
} else {
|
||||
p->save();
|
||||
QPointF rotateCenter(
|
||||
@ -521,6 +525,15 @@ void Meter::paint(QPainter *p,
|
||||
}
|
||||
}
|
||||
|
||||
QSizeF Meter::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
|
||||
{return QGraphicsWidget::sizeHint(which, constraint);
|
||||
if (which == Qt::PreferredSize) {
|
||||
return QSizeF(200, 32);
|
||||
} else {
|
||||
return QGraphicsWidget::sizeHint(which, constraint);
|
||||
}
|
||||
}
|
||||
|
||||
} // End of namepace
|
||||
|
||||
#include "meter.moc"
|
||||
|
@ -208,6 +208,7 @@ protected:
|
||||
virtual void paint(QPainter *p,
|
||||
const QStyleOptionGraphicsItem *option,
|
||||
QWidget *widget = 0);
|
||||
QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
|
||||
|
||||
private:
|
||||
MeterPrivate *const d;
|
||||
|
Loading…
Reference in New Issue
Block a user