QLabel: create the text control when getting polished, if necessary

This amends 7bee4e9cb3750be4573e1872f52023081b014500, and makes sure
that the text control is created even if the attributes that define
whether it's needed are changed after a call to setText or
setTextInteractionFlags, where it is otherwise created.

Task-number: QTBUG-84080
Pick-to: 5.15
Change-Id: I3be27f35bc83944948027345535d1202a7b97163
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
This commit is contained in:
Volker Hilsheimer 2020-05-26 15:10:00 +02:00
parent 37b132cd4e
commit c7b457e287

View File

@ -1025,6 +1025,9 @@ bool QLabel::event(QEvent *e)
) {
d->setLayoutItemMargins(QStyle::SE_LabelLayoutItem);
d->updateLabel();
} else if (type == QEvent::Polish) {
if (d->needTextControl())
d->ensureTextControl();
}
return QFrame::event(e);