diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2021-06-01 18:26:10 +0200 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2021-06-03 16:14:00 +0200 |
commit | 5dff645db012fb6534cecaf659aadbd5c6be7bfd (patch) | |
tree | 34a3b76d89ef098d0b45ebce992ea05ce5be9a04 /src/corelib | |
parent | a15a3fef0b5dae4e83bd94b23dd2418208159d05 (diff) |
QDateTime{Parser,EditPrivate}: clean up initialization
Initialize members by assigning them where declared, where possible,
rather than duplicating initializations in constructors.
Change-Id: I35c398581ad649210aaec979ea7c6c2fc2cb0bca
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/time/qdatetimeparser_p.h | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/corelib/time/qdatetimeparser_p.h b/src/corelib/time/qdatetimeparser_p.h index 578da2df73..6f44c34949 100644 --- a/src/corelib/time/qdatetimeparser_p.h +++ b/src/corelib/time/qdatetimeparser_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2020 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtCore module of the Qt Toolkit. @@ -83,8 +83,7 @@ public: DateTimeEdit }; QDateTimeParser(QMetaType::Type t, Context ctx, const QCalendar &cal = QCalendar()) - : currentSectionIndex(-1), cachedDay(-1), parserType(t), - fixday(false), context(ctx), calendar(cal) + : parserType(t), context(ctx), calendar(cal) { defaultLocale = QLocale::system(); first.type = FirstSection; @@ -270,7 +269,7 @@ protected: // for the benefit of QDateTimeEditPrivate virtual int cursorPosition() const { return -1; } virtual QLocale locale() const { return defaultLocale; } - mutable int currentSectionIndex; + mutable int currentSectionIndex = int(NoSectionIndex); Sections display; /* This stores the most recently selected day. @@ -285,7 +284,7 @@ protected: // for the benefit of QDateTimeEditPrivate This is good for when users have selected their desired day and are scrolling up or down in the month or year section and do not want smaller months (or non-leap years) to alter the day that they chose. */ - mutable int cachedDay; + mutable int cachedDay = -1; mutable QString m_text; QList<SectionNode> sectionNodes; SectionNode first, last, none, popup; @@ -293,7 +292,7 @@ protected: // for the benefit of QDateTimeEditPrivate QString displayFormat; QLocale defaultLocale; QMetaType::Type parserType; - bool fixday; + bool fixday = false; Context context; QCalendar calendar; }; |