Beautify QGuiApplication::event()
Replace if/elseif with a switch. Task-number: QTBUG-112479 Task-number: QTBUG-119032 Pick-to: 6.5 Change-Id: Iff29fde6a9b9a16357b26cf90009fec7c9826349 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> (cherry picked from commit b3958d26caffaa90193e649024ff2c0bf953fc2d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
99cda97844
commit
5363ac342d
@ -1997,7 +1997,8 @@ bool QGuiApplication::notify(QObject *object, QEvent *event)
|
|||||||
*/
|
*/
|
||||||
bool QGuiApplication::event(QEvent *e)
|
bool QGuiApplication::event(QEvent *e)
|
||||||
{
|
{
|
||||||
if (e->type() == QEvent::LanguageChange) {
|
switch (e->type()) {
|
||||||
|
case QEvent::LanguageChange:
|
||||||
// if the layout direction was set explicitly, then don't override it here
|
// if the layout direction was set explicitly, then don't override it here
|
||||||
if (layout_direction == Qt::LayoutDirectionAuto)
|
if (layout_direction == Qt::LayoutDirectionAuto)
|
||||||
setLayoutDirection(layout_direction);
|
setLayoutDirection(layout_direction);
|
||||||
@ -2005,13 +2006,15 @@ bool QGuiApplication::event(QEvent *e)
|
|||||||
if (topLevelWindow->flags() != Qt::Desktop)
|
if (topLevelWindow->flags() != Qt::Desktop)
|
||||||
postEvent(topLevelWindow, new QEvent(QEvent::LanguageChange));
|
postEvent(topLevelWindow, new QEvent(QEvent::LanguageChange));
|
||||||
}
|
}
|
||||||
} else if (e->type() == QEvent::ApplicationFontChange ||
|
break;
|
||||||
e->type() == QEvent::ApplicationPaletteChange) {
|
case QEvent::ApplicationFontChange:
|
||||||
|
case QEvent::ApplicationPaletteChange:
|
||||||
for (auto *topLevelWindow : QGuiApplication::topLevelWindows()) {
|
for (auto *topLevelWindow : QGuiApplication::topLevelWindows()) {
|
||||||
if (topLevelWindow->flags() != Qt::Desktop)
|
if (topLevelWindow->flags() != Qt::Desktop)
|
||||||
postEvent(topLevelWindow, new QEvent(e->type()));
|
postEvent(topLevelWindow, new QEvent(e->type()));
|
||||||
}
|
}
|
||||||
} else if (e->type() == QEvent::Quit) {
|
break;
|
||||||
|
case QEvent::Quit:
|
||||||
// Close open windows. This is done in order to deliver de-expose
|
// Close open windows. This is done in order to deliver de-expose
|
||||||
// events while the event loop is still running.
|
// events while the event loop is still running.
|
||||||
for (QWindow *topLevelWindow : QGuiApplication::topLevelWindows()) {
|
for (QWindow *topLevelWindow : QGuiApplication::topLevelWindows()) {
|
||||||
@ -2023,8 +2026,9 @@ bool QGuiApplication::event(QEvent *e)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return QCoreApplication::event(e);
|
return QCoreApplication::event(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user