void StyledLabel::layout() {
qreal h = 0;
- qreal w = frameRect().width() - 2*frameWidth();
+ qreal w = contentsRect().width();
_layout.beginLayout();
forever {
update();
}
-void StyledLabel::paintEvent(QPaintEvent *) {
+void StyledLabel::paintEvent(QPaintEvent *e) {
+ QFrame::paintEvent(e);
QPainter painter(this);
- qreal y = (frameRect().height() - _layout.boundingRect().height()) / 2;
- _layout.draw(&painter, QPointF(0, y), _extraLayoutList);
+ qreal y = contentsRect().y() + (contentsRect().height() - _layout.boundingRect().height()) / 2;
+ _layout.draw(&painter, QPointF(contentsRect().x(), y), _extraLayoutList);
}
int StyledLabel::posToCursor(const QPointF &pos) {