From 3d788fc0f1adab960446ef9074ccfcda964a8391 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Tue, 26 May 2015 22:48:15 +0200 Subject: [PATCH] QLabelPrivate: de-inline ctor ...and move most of the init() code into the ctor-init-list. Saves 176B of text size on Linux AMD64 GCC 4.9 optimized C++11 builds. Change-Id: I6cd42e19c40a031456eaf626e32619aed1758a6c Reviewed-by: Thiago Macieira Reviewed-by: Friedemann Kleint --- src/widgets/widgets/qlabel.cpp | 76 +++++++++++++++++++--------------- src/widgets/widgets/qlabel_p.h | 2 +- 2 files changed, 44 insertions(+), 34 deletions(-) diff --git a/src/widgets/widgets/qlabel.cpp b/src/widgets/widgets/qlabel.cpp index 409e4a34f9..905c5ce7ef 100644 --- a/src/widgets/widgets/qlabel.cpp +++ b/src/widgets/widgets/qlabel.cpp @@ -53,6 +53,49 @@ QT_BEGIN_NAMESPACE +QLabelPrivate::QLabelPrivate() + : QFramePrivate(), + sh(), + msh(), + valid_hints(false), + sizePolicy(), + margin(0), + text(), + pixmap(Q_NULLPTR), + scaledpixmap(Q_NULLPTR), + cachedimage(Q_NULLPTR), +#ifndef QT_NO_PICTURE + picture(Q_NULLPTR), +#endif +#ifndef QT_NO_MOVIE + movie(), +#endif +#ifndef QT_NO_SHORTCUT + buddy(), + shortcutId(0), +#endif + align(Qt::AlignLeft | Qt::AlignVCenter | Qt::TextExpandTabs), + indent(-1), + scaledcontents(false), + textLayoutDirty(false), + textDirty(false), + isRichText(false), + isTextLabel(false), + hasShortcut(/*???*/), + textformat(Qt::AutoText), + control(Q_NULLPTR), + shortcutCursor(), + textInteractionFlags(Qt::LinksAccessibleByMouse), + openExternalLinks(false) +#ifndef QT_NO_CURSOR + , + validCursor(false), + onAnchor(false), + cursor() +#endif +{ +} + QLabelPrivate::~QLabelPrivate() { } @@ -206,41 +249,8 @@ 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; -#ifndef QT_NO_PICTURE - picture = 0; -#endif - align = Qt::AlignLeft | Qt::AlignVCenter | Qt::TextExpandTabs; - 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); } diff --git a/src/widgets/widgets/qlabel_p.h b/src/widgets/widgets/qlabel_p.h index 2eb4ff9fc6..d3ad25be6f 100644 --- a/src/widgets/widgets/qlabel_p.h +++ b/src/widgets/widgets/qlabel_p.h @@ -64,7 +64,7 @@ class QLabelPrivate : public QFramePrivate { Q_DECLARE_PUBLIC(QLabel) public: - QLabelPrivate() {} + QLabelPrivate(); ~QLabelPrivate(); void init();