Hello, Uwe...
I want to ask U about background of label. I do smth like this:
const QSizeF labelSize
= label
().
textSize(painter
->font
());
const QRectF rect
= labelGeometry
(pos, labelSize
);
painter->save();
painter->setPen(Qt::magenta);
painter->setBrush(Qt::yellow);
label().draw(painter, rect);
painter->restore();
const QSizeF labelSize = label().textSize(painter->font());
const QRectF rect = labelGeometry(pos, labelSize);
painter->save();
painter->setPen(Qt::magenta);
painter->setBrush(Qt::yellow);
label().draw(painter, rect);
painter->restore();
To copy to clipboard, switch view to plain text mode
I also try to do smth like this instead of painter->set...(...):
label().setBackgroundBrush(Qt::yellow);
label().setBackgroundBrush(Qt::yellow);
To copy to clipboard, switch view to plain text mode
But text is shown correctly ( color = magenta ), but background - no ( background is white, not as I want f.e. yellow).
Can U tell me why? What I am doing wrong?
If i do smth like this, it is ok:
painter->fillRect(rect, m_labelBackgroundColor);
painter->fillRect(rect, m_labelBackgroundColor);
To copy to clipboard, switch view to plain text mode
But is it good way?
carhun
Bookmarks