From c7b457e287232d235cd56fcb0dd106f4617d96f0 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Tue, 26 May 2020 15:10:00 +0200 Subject: [PATCH] QLabel: create the text control when getting polished, if necessary MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/widgets/widgets/qlabel.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/widgets/widgets/qlabel.cpp b/src/widgets/widgets/qlabel.cpp index 152c250f69f..7ab7083a132 100644 --- a/src/widgets/widgets/qlabel.cpp +++ b/src/widgets/widgets/qlabel.cpp @@ -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);