1 Star 0 Fork 19

Zhao Hang/qt5-qtbase

forked from src-anolis-os/qt5-qtbase 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
QTBUG-95607-Close-all-popup-windows-when-the-screen-is-rotated.patch 2.49 KB
一键复制 编辑 原始数据 按行查看 历史
xingwei-liu 提交于 2022-10-13 02:47 . !8 feature: add patchs for DDE
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"
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zhaohang_mskdxl/qt5-qtbase.git
[email protected]:zhaohang_mskdxl/qt5-qtbase.git
zhaohang_mskdxl
qt5-qtbase
qt5-qtbase
a8

搜索帮助