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>
bb10
Wang Yu 2020-11-26 16:22:10 +08:00
parent 21e7777230
commit 9341f2e3d0
1 changed files with 1 additions and 1 deletions

View File

@ -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) {