1 Star 0 Fork 19

Funda Wang/qt5-qtbase

forked from src-anolis-os/qt5-qtbase 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
QTBUG-89902-QComboBox-popup-menu-hide-when-press-arrow-button-more-than-double-click-time.patch 2.90 KB
一键复制 编辑 原始数据 按行查看 历史
xingwei-liu 提交于 2022-10-13 02:47 . !8 feature: add patchs for DDE
From: zhanghao <zhanghao@uniontech.com>
Date: Tue Jan 12 10:36:47 2021 +0800
Subject: Fix QComboBox popup menu will hide when press arrow button more than double click time.
---
Index: qtbase-opensource-src-5.11/src/widgets/widgets/qcombobox.cpp
===================================================================
--- qtbase-opensource-src-5.11.orig/src/widgets/widgets/qcombobox.cpp
+++ qtbase-opensource-src-5.11/src/widgets/widgets/qcombobox.cpp
@@ -744,6 +744,8 @@ bool QComboBoxPrivateContainer::eventFil
if (indexUnderMouse.isValid()
&& !QComboBoxDelegate::isSeparator(indexUnderMouse)) {
view->setCurrentIndex(indexUnderMouse);
+ if(maybeIgnoreMouseButtonRelease)
+ maybeIgnoreMouseButtonRelease = false;
}
}
break;
@@ -751,11 +753,9 @@ bool QComboBoxPrivateContainer::eventFil
maybeIgnoreMouseButtonRelease = false;
break;
case QEvent::MouseButtonRelease: {
- bool ignoreEvent = maybeIgnoreMouseButtonRelease && popupTimer.elapsed() < QApplication::doubleClickInterval();
-
QMouseEvent *m = static_cast<QMouseEvent *>(e);
if (isVisible() && view->rect().contains(m->pos()) && view->currentIndex().isValid()
- && !blockMouseReleaseTimer.isActive() && !ignoreEvent
+ && !blockMouseReleaseTimer.isActive() && !maybeIgnoreMouseButtonRelease
&& (view->currentIndex().flags() & Qt::ItemIsEnabled)
&& (view->currentIndex().flags() & Qt::ItemIsSelectable)) {
combo->hidePopup();
@@ -806,7 +806,8 @@ void QComboBoxPrivateContainer::mousePre
void QComboBoxPrivateContainer::mouseReleaseEvent(QMouseEvent *e)
{
Q_UNUSED(e);
- if (!blockMouseReleaseTimer.isActive()){
+ bool ignoreEvent = popupTimer.elapsed() > QApplication::doubleClickInterval();
+ if (!blockMouseReleaseTimer.isActive() && !ignoreEvent) {
combo->hidePopup();
emit resetButton();
}
@@ -2848,7 +2849,7 @@ void QComboBox::showPopup()
#endif
if (startTimer) {
container->popupTimer.start();
- container->maybeIgnoreMouseButtonRelease = true;
+ container->maybeIgnoreMouseButtonRelease = usePopup;
}
}
@@ -3161,13 +3161,6 @@ void QComboBoxPrivate::showPopupFromMouseEvent(QMouseEvent *e)
}
#endif
q->showPopup();
- // The code below ensures that regular mousepress and pick item still works
- // If it was not called the viewContainer would ignore event since it didn't have
- // a mousePressEvent first.
- if (viewContainer()) {
- viewContainer()->blockMouseReleaseTimer.start(QApplication::doubleClickInterval());
- viewContainer()->maybeIgnoreMouseButtonRelease = false;
- }
} else {
#ifdef QT_KEYPAD_NAVIGATION
if (QApplication::keypadNavigationEnabled() && sc == QStyle::SC_ComboBoxEditField && lineEdit) {
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/fundawang/qt5-qtbase.git
git@gitee.com:fundawang/qt5-qtbase.git
fundawang
qt5-qtbase
qt5-qtbase
a8

搜索帮助