From af2daafde72db02454d24b7d691aa6861525ab99 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 18 Nov 2019 17:01:26 +0100 Subject: Deprecate constructing QFlags from a pointer This was used to support QFlags f = 0 initialization, but with 0 used as a pointer literal now considered bad form, it had been changed many places to QFlags f = nullptr, which is meaningless and confusing. Change-Id: I4bc592151c255dc5cab1a232615caecc520f02e8 Reviewed-by: Thiago Macieira --- src/widgets/kernel/qformlayout.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/widgets/kernel/qformlayout.cpp') diff --git a/src/widgets/kernel/qformlayout.cpp b/src/widgets/kernel/qformlayout.cpp index 6f7527c013..1c8b997dcb 100644 --- a/src/widgets/kernel/qformlayout.cpp +++ b/src/widgets/kernel/qformlayout.cpp @@ -1696,7 +1696,7 @@ Qt::Orientations QFormLayout::expandingDirections() const QFormLayoutPrivate *e = const_cast(d); e->updateSizes(); - Qt::Orientations o = 0; + Qt::Orientations o; if (e->expandHorizontal) o = Qt::Horizontal; if (e->expandVertical) @@ -2326,7 +2326,7 @@ void QFormLayout::resetRowWrapPolicy() void QFormLayout::resetFormAlignment() { Q_D(QFormLayout); - d->formAlignment = 0; + d->formAlignment = { }; } /*! @@ -2336,7 +2336,7 @@ void QFormLayout::resetFormAlignment() void QFormLayout::resetLabelAlignment() { Q_D(QFormLayout); - d->labelAlignment = 0; + d->labelAlignment = { }; } #if 0 -- cgit v1.2.3 From 2c871dfd38d89d6415c2c25d47b4a0e9c8b2ef11 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 22 Nov 2019 15:34:38 +0100 Subject: Avoid initializing QFlags with 0 or nullptr in further cases Amends qtbase/af2daafde72db02454d24b7d691aa6861525ab99. Where applicable, port over to member initialization, thus also fixing nullptr warnings. Change-Id: Iaaf2dbbbcf2952253390b8839fd15a1b17be32c0 Reviewed-by: Allan Sandfeld Jensen --- src/widgets/kernel/qformlayout.cpp | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) (limited to 'src/widgets/kernel/qformlayout.cpp') diff --git a/src/widgets/kernel/qformlayout.cpp b/src/widgets/kernel/qformlayout.cpp index 1c8b997dcb..c2838083f3 100644 --- a/src/widgets/kernel/qformlayout.cpp +++ b/src/widgets/kernel/qformlayout.cpp @@ -199,18 +199,17 @@ public: ItemMatrix m_matrix; QList m_things; - int layoutWidth; // the last width that we called setupVerticalLayoutData on (for vLayouts) + int layoutWidth = -1; // the last width that we called setupVerticalLayoutData on (for vLayouts) - int hfw_width; // the last width we calculated HFW for - int hfw_height; // what that height was - int hfw_minheight; // what that minheight was + int hfw_width = -1; // the last width we calculated HFW for + int hfw_height = -1; // what that height was - int hfw_sh_height; // the hfw for sh_width - int hfw_sh_minheight; // the minhfw for sh_width + int hfw_sh_height = -1; // the hfw for sh_width + int hfw_sh_minheight = -1; // the minhfw for sh_width - int min_width; // the width that gets turned into minSize (from updateSizes) - int sh_width; // the width that gets turned into prefSize (from updateSizes) - int thresh_width; // the width that we start splitting label/field pairs at (from updateSizes) + int min_width = -1; // the width that gets turned into minSize (from updateSizes) + int sh_width = -1; // the width that gets turned into prefSize (from updateSizes) + int thresh_width = QLAYOUTSIZE_MAX; // the width that we start splitting label/field pairs at (from updateSizes) QSize minSize; QSize prefSize; int formMaxWidth; @@ -222,17 +221,15 @@ public: QVector hfwLayouts; - int hSpacing; - int vSpacing; + int hSpacing = -1; + int vSpacing = -1; QLayoutItem* replaceAt(int index, QLayoutItem*) override; }; QFormLayoutPrivate::QFormLayoutPrivate() : fieldGrowthPolicy(DefaultFieldGrowthPolicy), rowWrapPolicy(DefaultRowWrapPolicy), has_hfw(false), dirty(true), sizesDirty(true), - expandVertical(0), expandHorizontal(0), labelAlignment(0), formAlignment(0), - layoutWidth(-1), hfw_width(-1), hfw_sh_height(-1), min_width(-1), - sh_width(-1), thresh_width(QLAYOUTSIZE_MAX), hSpacing(-1), vSpacing(-1) + expandVertical(0), expandHorizontal(0) { } @@ -481,7 +478,6 @@ void QFormLayoutPrivate::recalcHFW(int w) } else { hfw_width = w; hfw_height = qMin(QLAYOUTSIZE_MAX, h); - hfw_minheight = qMin(QLAYOUTSIZE_MAX, mh); } } -- cgit v1.2.3