代码拉取完成,页面将自动刷新
同步操作将从 src-anolis-os/qt5-qtbase 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
Author: Tang Haixiang <[email protected]>
Date: Fri Aug 13 9:22:24 2021 +0800
Subject: Close all popup windows when the screen is rotated
Upstream: https://codereview.qt-project.org/c/qt/qtbase/+/363462
---
Index: qtbase-opensource-src/src/widgets/kernel/qapplication.cpp
===================================================================
--- qtbase-opensource-src.orig/src/widgets/kernel/qapplication.cpp
+++ qtbase-opensource-src/src/widgets/kernel/qapplication.cpp
@@ -3050,8 +3050,10 @@ bool QApplication::notify(QObject *recei
switch (e->type()) {
case QEvent::ApplicationDeactivate:
- // Close all popups (triggers when switching applications
- // by pressing ALT-TAB on Windows, which is not receive as key event.
+ case QEvent::OrientationChange:
+ // Close all popups (triggers when switching applications
+ // by pressing ALT-TAB on Windows, which is not receive as key event.
+ // triggers when the screen rotates.)
closeAllPopups();
break;
case QEvent::Wheel: // User input and window activation makes tooltips sleep
Index: qtbase-opensource-src/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
===================================================================
--- qtbase-opensource-src.orig/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
+++ qtbase-opensource-src/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
@@ -127,6 +127,7 @@ private slots:
void menuSize_Scrolling();
void tearOffMenuNotDisplayed();
void QTBUG_61039_menu_shortcuts();
+ void screenOrientationChangedCloseMenu();
protected slots:
void onActivated(QAction*);
@@ -1678,5 +1679,21 @@ void tst_QMenu::QTBUG_61039_menu_shortcu
QTRY_COMPARE(actionJoeSpy.count(), 1);
}
+void tst_QMenu::screenOrientationChangedCloseMenu()
+{
+ QMenu menu;
+ menu.addAction("action1");
+ menu.show();
+ menu.screen()->setOrientationUpdateMask(Qt::PortraitOrientation | Qt::LandscapeOrientation
+ | Qt::InvertedPortraitOrientation | Qt::InvertedLandscapeOrientation);
+ QTRY_COMPARE(menu.isVisible(),true);
+
+ Qt::ScreenOrientation orientation = menu.screen()->orientation() == Qt::PortraitOrientation ? Qt::LandscapeOrientation : Qt::PortraitOrientation;
+ QScreenOrientationChangeEvent event(menu.screen(), orientation);
+ QCoreApplication::sendEvent(QCoreApplication::instance(), &event);
+
+ QTRY_COMPARE(menu.isVisible(),false);
+}
+
QTEST_MAIN(tst_QMenu)
#include "tst_qmenu.moc"
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。