summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2021-06-01 18:26:10 +0200
committerEdward Welbourne <edward.welbourne@qt.io>2021-06-03 16:14:00 +0200
commit5dff645db012fb6534cecaf659aadbd5c6be7bfd (patch)
tree34a3b76d89ef098d0b45ebce992ea05ce5be9a04 /src/widgets
parenta15a3fef0b5dae4e83bd94b23dd2418208159d05 (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/widgets')
-rw-r--r--src/widgets/widgets/qdatetimeedit.cpp14
-rw-r--r--src/widgets/widgets/qdatetimeedit_p.h12
2 files changed, 7 insertions, 19 deletions
diff --git a/src/widgets/widgets/qdatetimeedit.cpp b/src/widgets/widgets/qdatetimeedit.cpp
index ddab5ea762..5b3d0f3c2a 100644
--- a/src/widgets/widgets/qdatetimeedit.cpp
+++ b/src/widgets/widgets/qdatetimeedit.cpp
@@ -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 QtWidgets module of the Qt Toolkit.
@@ -1737,26 +1737,14 @@ QDateEdit::~QDateEdit()
QDateTimeEditPrivate::QDateTimeEditPrivate()
: QDateTimeParser(QMetaType::QDateTime, QDateTimeParser::DateTimeEdit, QCalendar())
{
- hasHadFocus = false;
- formatExplicitlySet = false;
- cacheGuard = false;
fixday = true;
type = QMetaType::QDateTime;
- sections = { };
- cachedDay = -1;
currentSectionIndex = FirstSectionIndex;
first.pos = 0;
- calendarPopup = false;
minimum = QDATETIMEEDIT_COMPAT_DATE_MIN.startOfDay();
maximum = QDATETIMEEDIT_DATE_MAX.endOfDay();
- arrowState = QStyle::State_None;
- monthCalendar = nullptr;
readLocaleSettings();
-
-#ifdef QT_KEYPAD_NAVIGATION
- focusOnButton = false;
-#endif
}
QDateTime QDateTimeEditPrivate::convertTimeSpec(const QDateTime &datetime)
diff --git a/src/widgets/widgets/qdatetimeedit_p.h b/src/widgets/widgets/qdatetimeedit_p.h
index 8414a89805..5830caaba3 100644
--- a/src/widgets/widgets/qdatetimeedit_p.h
+++ b/src/widgets/widgets/qdatetimeedit_p.h
@@ -140,17 +140,17 @@ public:
void initCalendarPopup(QCalendarWidget *cw = nullptr);
void positionCalendarPopup();
- QDateTimeEdit::Sections sections;
- mutable bool cacheGuard;
+ QDateTimeEdit::Sections sections = {};
+ mutable bool cacheGuard = false;
QString defaultDateFormat, defaultTimeFormat, defaultDateTimeFormat, unreversedFormat;
mutable QVariant conflictGuard;
- bool hasHadFocus, formatExplicitlySet, calendarPopup;
- QStyle::StateFlag arrowState;
- QCalendarPopup *monthCalendar;
+ bool hasHadFocus = false, formatExplicitlySet = false, calendarPopup = false;
+ QStyle::StateFlag arrowState = QStyle::State_None;
+ QCalendarPopup *monthCalendar = nullptr;
#ifdef QT_KEYPAD_NAVIGATION
- bool focusOnButton;
+ bool focusOnButton = false;
#endif
Qt::TimeSpec spec = Qt::LocalTime;