summaryrefslogtreecommitdiffstats
path: root/src/widgets/dialogs
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2019-09-23 14:38:13 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2019-09-24 09:50:14 +0200
commit27782af8219e244fb8cea60e3f22448d5d075446 (patch)
tree2071256b62a32e49a1cd897a3305aadce8438420 /src/widgets/dialogs
parentfdae0ccc5f624a1b30d4a57fa3d4b69a00f013d2 (diff)
QWizard: Use member initialization in private classes
Remove superfluous constructors. Task-number: QTBUG-78604 Change-Id: I8a422cfeaaedf89ce310e06d5db80907cd1102d4 Reviewed-by: Jesus Fernandez <jsfdez@gmail.com>
Diffstat (limited to 'src/widgets/dialogs')
-rw-r--r--src/widgets/dialogs/qwizard.cpp158
1 files changed, 57 insertions, 101 deletions
diff --git a/src/widgets/dialogs/qwizard.cpp b/src/widgets/dialogs/qwizard.cpp
index 7b26d9a67a..b4a5904779 100644
--- a/src/widgets/dialogs/qwizard.cpp
+++ b/src/widgets/dialogs/qwizard.cpp
@@ -232,31 +232,24 @@ void QWizardField::findProperty(const QWizardDefaultProperty *properties, int pr
class QWizardLayoutInfo
{
public:
- inline QWizardLayoutInfo()
- : topLevelMarginLeft(-1), topLevelMarginRight(-1), topLevelMarginTop(-1),
- topLevelMarginBottom(-1), childMarginLeft(-1), childMarginRight(-1),
- childMarginTop(-1), childMarginBottom(-1), hspacing(-1), vspacing(-1),
- wizStyle(QWizard::ClassicStyle), header(false), watermark(false), title(false),
- subTitle(false), extension(false), sideWidget(false) {}
-
- int topLevelMarginLeft;
- int topLevelMarginRight;
- int topLevelMarginTop;
- int topLevelMarginBottom;
- int childMarginLeft;
- int childMarginRight;
- int childMarginTop;
- int childMarginBottom;
- int hspacing;
- int vspacing;
- int buttonSpacing;
- QWizard::WizardStyle wizStyle;
- bool header;
- bool watermark;
- bool title;
- bool subTitle;
- bool extension;
- bool sideWidget;
+ int topLevelMarginLeft = -1;
+ int topLevelMarginRight = -1;
+ int topLevelMarginTop = -1;
+ int topLevelMarginBottom = -1;
+ int childMarginLeft = -1;
+ int childMarginRight = -1;
+ int childMarginTop = -1;
+ int childMarginBottom = -1;
+ int hspacing = -1;
+ int vspacing = -1;
+ int buttonSpacing = -1;
+ QWizard::WizardStyle wizStyle = QWizard::ClassicStyle;
+ bool header = false;
+ bool watermark = false;
+ bool title = false;
+ bool subTitle = false;
+ bool extension = false;
+ bool sideWidget = false;
bool operator==(const QWizardLayoutInfo &other);
inline bool operator!=(const QWizardLayoutInfo &other) { return !operator==(other); }
@@ -486,21 +479,18 @@ class QWizardPagePrivate : public QWidgetPrivate
public:
enum TriState { Tri_Unknown = -1, Tri_False, Tri_True };
- inline QWizardPagePrivate()
- : wizard(0), completeState(Tri_Unknown), explicitlyFinal(false), commit(false) {}
-
bool cachedIsComplete() const;
void _q_maybeEmitCompleteChanged();
void _q_updateCachedCompleteState();
- QWizard *wizard;
+ QWizard *wizard = nullptr;
QString title;
QString subTitle;
QPixmap pixmaps[QWizard::NPixmaps];
QVector<QWizardField> pendingFields;
- mutable TriState completeState;
- bool explicitlyFinal;
- bool commit;
+ mutable TriState completeState = Tri_Unknown;
+ bool explicitlyFinal = false;
+ bool commit = false;
bool initialized = false;
QMap<int, QString> buttonCustomTexts;
};
@@ -556,42 +546,6 @@ public:
Forward
};
- inline QWizardPrivate()
- : start(-1)
- , startSetByUser(false)
- , current(-1)
- , canContinue(false)
- , canFinish(false)
- , disableUpdatesCount(0)
- , wizStyle(QWizard::ClassicStyle)
- , opts(0)
- , buttonsHaveCustomLayout(false)
- , titleFmt(Qt::AutoText)
- , subTitleFmt(Qt::AutoText)
- , placeholderWidget1(0)
- , placeholderWidget2(0)
- , headerWidget(0)
- , watermarkLabel(0)
- , sideWidget(0)
- , pageFrame(0)
- , titleLabel(0)
- , subTitleLabel(0)
- , bottomRuler(0)
-#if QT_CONFIG(style_windowsvista)
- , vistaHelper(0)
- , vistaInitPending(true)
- , vistaState(QVistaHelper::Dirty)
- , vistaStateChanged(false)
- , inHandleAeroStyleChange(false)
-#endif
- , minimumWidth(0)
- , minimumHeight(0)
- , maximumWidth(QWIDGETSIZE_MAX)
- , maximumHeight(QWIDGETSIZE_MAX)
- {
- std::fill(btns, btns + QWizard::NButtons, static_cast<QAbstractButton *>(0));
- }
-
void init();
void reset();
void cleanupPagesNotInHistory();
@@ -631,21 +585,21 @@ public:
QMap<QString, int> fieldIndexMap;
QVector<QWizardDefaultProperty> defaultPropertyTable;
QList<int> history;
- int start;
- bool startSetByUser;
- int current;
- bool canContinue;
- bool canFinish;
+ int start = -1;
+ bool startSetByUser = false;
+ int current = -1;
+ bool canContinue = false;
+ bool canFinish = false;
QWizardLayoutInfo layoutInfo;
- int disableUpdatesCount;
+ int disableUpdatesCount = 0;
- QWizard::WizardStyle wizStyle;
+ QWizard::WizardStyle wizStyle = QWizard::ClassicStyle;
QWizard::WizardOptions opts;
QMap<int, QString> buttonCustomTexts;
- bool buttonsHaveCustomLayout;
+ bool buttonsHaveCustomLayout = false;
QList<QWizard::WizardButton> buttonsCustomLayout;
- Qt::TextFormat titleFmt;
- Qt::TextFormat subTitleFmt;
+ Qt::TextFormat titleFmt = Qt::AutoText;
+ Qt::TextFormat subTitleFmt = Qt::AutoText;
mutable QPixmap defaultPixmaps[QWizard::NPixmaps];
union {
@@ -660,32 +614,32 @@ public:
} btn;
mutable QAbstractButton *btns[QWizard::NButtons];
};
- QWizardAntiFlickerWidget *antiFlickerWidget;
- QWidget *placeholderWidget1;
- QWidget *placeholderWidget2;
- QWizardHeader *headerWidget;
- QWatermarkLabel *watermarkLabel;
- QWidget *sideWidget;
- QFrame *pageFrame;
- QLabel *titleLabel;
- QLabel *subTitleLabel;
- QWizardRuler *bottomRuler;
-
- QVBoxLayout *pageVBoxLayout;
- QHBoxLayout *buttonLayout;
- QGridLayout *mainLayout;
+ QWizardAntiFlickerWidget *antiFlickerWidget = nullptr;
+ QWidget *placeholderWidget1 = nullptr;
+ QWidget *placeholderWidget2 = nullptr;
+ QWizardHeader *headerWidget = nullptr;
+ QWatermarkLabel *watermarkLabel = nullptr;
+ QWidget *sideWidget = nullptr;
+ QFrame *pageFrame = nullptr;
+ QLabel *titleLabel = nullptr;
+ QLabel *subTitleLabel = nullptr;
+ QWizardRuler *bottomRuler = nullptr;
+
+ QVBoxLayout *pageVBoxLayout = nullptr;
+ QHBoxLayout *buttonLayout = nullptr;
+ QGridLayout *mainLayout = nullptr;
#if QT_CONFIG(style_windowsvista)
- QVistaHelper *vistaHelper;
- bool vistaInitPending;
- QVistaHelper::VistaState vistaState;
- bool vistaStateChanged;
- bool inHandleAeroStyleChange;
+ QVistaHelper *vistaHelper = nullptr;
+ bool vistaInitPending = true;
+ QVistaHelper::VistaState vistaState = QVistaHelper::Dirty;
+ bool vistaStateChanged = false;
+ bool inHandleAeroStyleChange = false;
#endif
- int minimumWidth;
- int minimumHeight;
- int maximumWidth;
- int maximumHeight;
+ int minimumWidth = 0;
+ int minimumHeight = 0;
+ int maximumWidth = QWIDGETSIZE_MAX;
+ int maximumHeight = QWIDGETSIZE_MAX;
};
static QString buttonDefaultText(int wstyle, int which, const QWizardPrivate *wizardPrivate)
@@ -720,6 +674,8 @@ void QWizardPrivate::init()
{
Q_Q(QWizard);
+ std::fill(btns, btns + QWizard::NButtons, nullptr);
+
antiFlickerWidget = new QWizardAntiFlickerWidget(q, this);
wizStyle = QWizard::WizardStyle(q->style()->styleHint(QStyle::SH_WizardStyle, 0, q));
if (wizStyle == QWizard::MacStyle) {