Fix: don't override the new non-cosmetic default pen in qwidget
As QWidget initializes any painter created in paintevent handler to have the pen color of the palette's foreground, setting it to 0 width, i.e. cosmetic, it negated the effect of the recent change to default 1-width non-cosmetic, ref. I04d910e9700baf7f13a8aac07a3633014bb9283e This caused scaled painting with default pen on QImage and QWidget to yield different results. Change-Id: I930b64bf7c0a8c84b9ea3edb49adc813370fed0e Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
This commit is contained in:
parent
de58eb64bc
commit
52ccbd8911
@ -11237,7 +11237,7 @@ void QWidget::ungrabGesture(Qt::GestureType gesture)
|
||||
void QWidget::initPainter(QPainter *painter) const
|
||||
{
|
||||
const QPalette &pal = palette();
|
||||
painter->d_func()->state->pen = QPen(pal.brush(foregroundRole()), 0);
|
||||
painter->d_func()->state->pen = QPen(pal.brush(foregroundRole()), 1);
|
||||
painter->d_func()->state->bgBrush = pal.brush(backgroundRole());
|
||||
QFont f(font(), const_cast<QWidget *>(this));
|
||||
painter->d_func()->state->deviceFont = f;
|
||||
|
@ -2508,8 +2508,8 @@ public:
|
||||
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
|
||||
{
|
||||
dirtyPainter = (painter->pen().width() != 0);
|
||||
painter->setPen(QPen(Qt::black, 1.0));
|
||||
dirtyPainter = (painter->pen().color() != Qt::black);
|
||||
painter->setPen(Qt::red);
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user