From dc193277513d72c00fdee015bb75d5b8c844a785 Mon Sep 17 00:00:00 2001 From: Christian Heimlich Date: Wed, 7 Oct 2020 04:07:36 -0400 Subject: [PATCH] Member initialization and default constructor for QProgressDialogPrivate Change QProgressDialogPrivate to use default member initializers, allowing its constructor to be explicitly defaulted since it was only used for its member initializer list. Reduces #ifdefery. Change-Id: Id3885e6d520cde47de96f3b475f6a6bba1ed001f Reviewed-by: Friedemann Kleint --- src/widgets/dialogs/qprogressdialog.cpp | 44 +++++++++---------------- 1 file changed, 15 insertions(+), 29 deletions(-) diff --git a/src/widgets/dialogs/qprogressdialog.cpp b/src/widgets/dialogs/qprogressdialog.cpp index d0645a4e8a7..645ca1013ad 100644 --- a/src/widgets/dialogs/qprogressdialog.cpp +++ b/src/widgets/dialogs/qprogressdialog.cpp @@ -68,21 +68,7 @@ class QProgressDialogPrivate : public QDialogPrivate Q_DECLARE_PUBLIC(QProgressDialog) public: - QProgressDialogPrivate() : label(nullptr), cancel(nullptr), bar(nullptr), - #ifndef QT_NO_SHORTCUT - escapeShortcut(nullptr), - #endif - showTime(defaultShowTime), - processingEvents(false), - shownOnce(false), - autoClose(true), - autoReset(true), - forceHide(false), - cancellationFlag(false), - setValueCalled(false), - useDefaultCancelText(false) - { - } + QProgressDialogPrivate() = default; void init(const QString &labelText, const QString &cancelText, int min, int max); void layout(); @@ -92,25 +78,25 @@ public: void ensureSizeIsAtLeastSizeHint(); void _q_disconnectOnClose(); - QLabel *label; - QPushButton *cancel; - QProgressBar *bar; - QTimer *forceTimer; + QLabel *label = nullptr; + QPushButton *cancel = nullptr; + QProgressBar *bar = nullptr; + QTimer *forceTimer = nullptr; #ifndef QT_NO_SHORTCUT - QShortcut *escapeShortcut; + QShortcut *escapeShortcut = nullptr; #endif QPointer receiverToDisconnectOnClose; QElapsedTimer starttime; QByteArray memberToDisconnectOnClose; - int showTime; - bool processingEvents; - bool shownOnce; - bool autoClose; - bool autoReset; - bool forceHide; - bool cancellationFlag; - bool setValueCalled; - bool useDefaultCancelText; + int showTime = defaultShowTime; + bool processingEvents = false; + bool shownOnce = false; + bool autoClose = true; + bool autoReset = true; + bool forceHide = false; + bool cancellationFlag = false; + bool setValueCalled = false; + bool useDefaultCancelText = false; }; void QProgressDialogPrivate::init(const QString &labelText, const QString &cancelText,