Android: simplify/refactor QAndroidPlatformWindow::setVisible()

Simplify the if condidions in this function for better readability.

Task-number: QTBUG-132716
Change-Id: I4a4eee61d4b9111d82272205133d7719b7be4a9e
Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io>
This commit is contained in:
Assam Boudjelthia 2025-01-11 02:18:26 +02:00
parent 483768fb8e
commit 8047d2ec89

View File

@ -163,10 +163,11 @@ void QAndroidPlatformWindow::setVisible(bool visible)
{
if (isEmbeddingContainer())
return;
m_nativeQtWindow.callMethod<void>("setVisible", visible);
if (visible) {
if (window()->isTopLevel()) {
if (window()->isTopLevel()) {
if (!visible && window() == qGuiApp->focusWindow()) {
platformScreen()->topVisibleWindowChanged();
} else {
updateSystemUiVisibility();
if ((m_windowState & Qt::WindowFullScreen)
|| (window()->flags() & Qt::ExpandedClientAreaHint)) {
@ -176,13 +177,14 @@ void QAndroidPlatformWindow::setVisible(bool visible)
}
requestActivateWindow();
}
} else if (window()->isTopLevel() && window() == qGuiApp->focusWindow()) {
platformScreen()->topVisibleWindowChanged();
}
QRect availableGeometry = screen()->availableGeometry();
if (geometry().width() > 0 && geometry().height() > 0 && availableGeometry.width() > 0 && availableGeometry.height() > 0)
QPlatformWindow::setVisible(visible);
m_nativeQtWindow.callMethod<void>("setVisible", visible);
if (geometry().isEmpty() || screen()->availableGeometry().isEmpty())
return;
QPlatformWindow::setVisible(visible);
}
void QAndroidPlatformWindow::setWindowState(Qt::WindowStates state)