diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2018-05-03 11:23:56 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2018-05-04 12:53:00 +0000 |
commit | aea55d29d2555c5649c13d3bc11bde4799c6bac5 (patch) | |
tree | 52434edff3041005f98b6899566fce119855efae /src/quicktemplates2/qquickapplicationwindow.cpp | |
parent | a5d2731b1ec56580a79784759307d3b3c21ab87f (diff) |
Templates: use C++11 default member initialization
The code is more readable and less error-prone (this patch caught a few
uninitialized members) when the members are initialized in the same
place where they are declared. In many cases, empty default destructors
can be entirely removed, and we get faster implicitly declared inline
default constructors defined by the compiler.
Change-Id: I14c5448afc901f9b2ac5965f28c1c26c0b646c08
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/quicktemplates2/qquickapplicationwindow.cpp')
-rw-r--r-- | src/quicktemplates2/qquickapplicationwindow.cpp | 38 |
1 files changed, 10 insertions, 28 deletions
diff --git a/src/quicktemplates2/qquickapplicationwindow.cpp b/src/quicktemplates2/qquickapplicationwindow.cpp index 77cf5465..be28cb2a 100644 --- a/src/quicktemplates2/qquickapplicationwindow.cpp +++ b/src/quicktemplates2/qquickapplicationwindow.cpp @@ -123,18 +123,6 @@ class QQuickApplicationWindowPrivate : public QQuickItemChangeListener Q_DECLARE_PUBLIC(QQuickApplicationWindow) public: - QQuickApplicationWindowPrivate() - : complete(true), - background(nullptr), - contentItem(nullptr), - menuBar(nullptr), - header(nullptr), - footer(nullptr), - overlay(nullptr), - activeFocusControl(nullptr) - { - } - static QQuickApplicationWindowPrivate *get(QQuickApplicationWindow *window) { return window->d_func(); @@ -171,18 +159,18 @@ public: void cancelBackground(); void executeBackground(bool complete = false); - bool complete; + bool complete = true; QQuickDeferredPointer<QQuickItem> background; - QQuickItem *contentItem; - QQuickItem *menuBar; - QQuickItem *header; - QQuickItem *footer; - QQuickOverlay *overlay; + QQuickItem *contentItem = nullptr; + QQuickItem *menuBar = nullptr; + QQuickItem *header = nullptr; + QQuickItem *footer = nullptr; + QQuickOverlay *overlay = nullptr; QFont font; QLocale locale; QPalette palette; - QQuickItem *activeFocusControl; - QQuickApplicationWindow *q_ptr; + QQuickItem *activeFocusControl = nullptr; + QQuickApplicationWindow *q_ptr = nullptr; }; static void layoutItem(QQuickItem *item, qreal y, qreal width) @@ -862,17 +850,11 @@ class QQuickApplicationWindowAttachedPrivate : public QObjectPrivate Q_DECLARE_PUBLIC(QQuickApplicationWindowAttached) public: - QQuickApplicationWindowAttachedPrivate() - : window(nullptr), - activeFocusControl(nullptr) - { - } - void windowChange(QQuickWindow *wnd); void activeFocusChange(); - QQuickWindow *window; - QQuickItem *activeFocusControl; + QQuickWindow *window = nullptr; + QQuickItem *activeFocusControl = nullptr; }; void QQuickApplicationWindowAttachedPrivate::windowChange(QQuickWindow *wnd) |