OSDN Git Service

initialize QLabelPrivate members from its constructor
authorIvailo Monev <xakepa10@gmail.com>
Mon, 13 Jun 2022 05:55:01 +0000 (08:55 +0300)
committerIvailo Monev <xakepa10@gmail.com>
Mon, 13 Jun 2022 05:56:21 +0000 (08:56 +0300)
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
src/gui/widgets/qlabel.cpp
src/gui/widgets/qlabel_p.h

index 4432215..b3f63f7 100644 (file)
 
 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);
 }
 
index 8795570..749304f 100644 (file)
@@ -51,7 +51,7 @@ class QLabelPrivate : public QFramePrivate
 {
     Q_DECLARE_PUBLIC(QLabel)
 public:
-    QLabelPrivate() {}
+    QLabelPrivate();
 
     void init();
     void clearContents();