initialize QLabelPrivate members from its constructor

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2022-06-13 08:55:01 +03:00
parent 6b1e04dbd5
commit 27f4145e79
2 changed files with 33 additions and 32 deletions

View file

@ -36,6 +36,38 @@
QT_BEGIN_NAMESPACE
QLabelPrivate::QLabelPrivate()
: valid_hints(false),
margin(0),
pixmap(nullptr),
scaledpixmap(nullptr),
cachedimage(nullptr),
align(Qt::AlignLeft | Qt::AlignVCenter),
indent(-1),
scaledcontents(false),
textLayoutDirty(false),
textDirty(false),
isRichText(false),
isTextLabel(false),
textformat(Qt::AutoText),
control(nullptr),
textInteractionFlags(Qt::LinksAccessibleByMouse),
openExternalLinks(false)
{
#ifndef QT_NO_MOVIE
movie = nullptr;
#endif
#ifndef QT_NO_SHORTCUT
shortcutId = 0;
#endif
#ifndef QT_NO_CURSOR
validCursor = false;
onAnchor = false;
#endif
}
/*!
\class QLabel
\brief The QLabel widget provides a text or image display.
@ -153,8 +185,6 @@ QLabel::QLabel(const QString &text, QWidget *parent, Qt::WindowFlags f)
setText(text);
}
/*!
Destroys the label.
*/
@ -169,38 +199,9 @@ void QLabelPrivate::init()
{
Q_Q(QLabel);
valid_hints = false;
margin = 0;
#ifndef QT_NO_MOVIE
movie = 0;
#endif
#ifndef QT_NO_SHORTCUT
shortcutId = 0;
#endif
pixmap = 0;
scaledpixmap = 0;
cachedimage = 0;
align = Qt::AlignLeft | Qt::AlignVCenter;
indent = -1;
scaledcontents = false;
textLayoutDirty = false;
textDirty = false;
textformat = Qt::AutoText;
control = 0;
textInteractionFlags = Qt::LinksAccessibleByMouse;
isRichText = false;
isTextLabel = false;
q->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred,
QSizePolicy::Label));
#ifndef QT_NO_CURSOR
validCursor = false;
onAnchor = false;
#endif
openExternalLinks = false;
setLayoutItemMargins(QStyle::SE_LabelLayoutItem);
}

View file

@ -51,7 +51,7 @@ class QLabelPrivate : public QFramePrivate
{
Q_DECLARE_PUBLIC(QLabel)
public:
QLabelPrivate() {}
QLabelPrivate();
void init();
void clearContents();