summaryrefslogtreecommitdiffstats
path: root/src/widgets/widgets/qdatetimeedit.cpp
diff options
context:
space:
mode:
authorWang Yu <wangyu@uniontech.com>2020-11-26 16:22:10 +0800
committerWang Yu <wangyu@uniontech.com>2020-12-02 17:26:37 +0800
commit9341f2e3d0a877b50ba851ff22b0d6ce192faf84 (patch)
tree001c053f47b4ad962ada0a62b394791924aca36f /src/widgets/widgets/qdatetimeedit.cpp
parent21e77772309df0f2c3fc15f16f9a95214d13f91c (diff)
Reduce the scope of variable in focusInEvent()
The scope of the variable 'frm' can be reduced if the variable 'd->formatExplicitlySet' is true. So declare the variable when the variable 'd->formatExplicitlySet' is false. Change-Id: I27cea412af827d30ad9188106b7f14025e5ddb68 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/widgets/widgets/qdatetimeedit.cpp')
-rw-r--r--src/widgets/widgets/qdatetimeedit.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/widgets/widgets/qdatetimeedit.cpp b/src/widgets/widgets/qdatetimeedit.cpp
index e57d1f9db5..ddab5ea762 100644
--- a/src/widgets/widgets/qdatetimeedit.cpp
+++ b/src/widgets/widgets/qdatetimeedit.cpp
@@ -1295,9 +1295,9 @@ void QDateTimeEdit::focusInEvent(QFocusEvent *event)
{
Q_D(QDateTimeEdit);
QAbstractSpinBox::focusInEvent(event);
- QString *frm = nullptr;
const int oldPos = d->edit->cursorPosition();
if (!d->formatExplicitlySet) {
+ QString *frm = nullptr;
if (d->displayFormat == d->defaultTimeFormat) {
frm = &d->defaultTimeFormat;
} else if (d->displayFormat == d->defaultDateFormat) {