1
0
forked from pool/libqt5-qtbase

Accepting request 809283 from home:Vogtinator:qt5.15

OBS-URL: https://build.opensuse.org/request/show/809283
OBS-URL: https://build.opensuse.org/package/show/KDE:Qt:5.15/libqt5-qtbase?expand=0&rev=10
This commit is contained in:
Christophe Giboudeaux 2020-05-27 09:57:19 +00:00 committed by Git OBS Bridge
parent e67dc8d213
commit 41a0ed5f3f
3 changed files with 146 additions and 0 deletions

View File

@ -0,0 +1,139 @@
From 9928d66764337494d0e99208a3418fcd01ac3e66 Mon Sep 17 00:00:00 2001
From: Fabian Vogt <fabian@ritter-vogt.de>
Date: Wed, 27 May 2020 10:48:45 +0200
Subject: [PATCH] Revert "QMenu: hide when a QWidgetAction fires the trigged
signal"
This reverts commit b4669b919048c1dbdac2b3e9b2e79f3d023aa078.
---
src/widgets/widgets/qmenu.cpp | 9 +--
.../auto/widgets/widgets/qmenu/tst_qmenu.cpp | 79 -------------------
2 files changed, 4 insertions(+), 84 deletions(-)
diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp
index 865e3b2fb6..2878344f07 100644
--- a/src/widgets/widgets/qmenu.cpp
+++ b/src/widgets/widgets/qmenu.cpp
@@ -1470,9 +1470,6 @@ void QMenuPrivate::_q_actionTriggered()
}
}
activateCausedStack(list, action, QAction::Trigger, false);
- // if a widget action fires, we need to hide the menu explicitly
- if (qobject_cast<QWidgetAction*>(action))
- hideUpToMenuBar();
}
}
}
@@ -1640,8 +1637,10 @@ void QMenu::initStyleOption(QStyleOptionMenuItem *option, const QAction *action)
Widgets can be inserted into menus with the QWidgetAction class.
Instances of this class are used to hold widgets, and are inserted
- into menus with the addAction() overload that takes a QAction. If the
- QWidgetAction fires the triggered() signal, the menu will close.
+ into menus with the addAction() overload that takes a QAction.
+
+ Conversely, actions can be added to widgets with the addAction(),
+ addActions() and insertAction() functions.
\warning To make QMenu visible on the screen, exec() or popup() should be
used instead of show().
diff --git a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
index 5a24995caf..22494f3d24 100644
--- a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
+++ b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
@@ -116,7 +116,6 @@ private slots:
void QTBUG20403_nested_popup_on_shortcut_trigger();
void QTBUG47515_widgetActionEnterLeave();
void QTBUG8122_widgetActionCrashOnClose();
- void widgetActionTriggerClosesMenu();
void QTBUG_10735_crashWithDialog();
#ifdef Q_OS_MAC
@@ -1408,84 +1407,6 @@ void tst_QMenu::QTBUG8122_widgetActionCrashOnClose()
QTRY_VERIFY(menu->isHidden());
}
-/*!
- Test that a QWidgetAction that fires closes the menus that it is in.
-*/
-void tst_QMenu::widgetActionTriggerClosesMenu()
-{
- class ButtonAction : public QWidgetAction
- {
- public:
- ButtonAction()
- : QWidgetAction(nullptr)
- {}
-
- void click()
- {
- if (pushButton)
- pushButton->click();
- }
-
- protected:
- QWidget *createWidget(QWidget *parent)
- {
- QPushButton *button = new QPushButton(QLatin1String("Button"), parent);
- connect(button, &QPushButton::clicked, this, &QAction::trigger);
-
- if (!pushButton)
- pushButton = button;
- return button;
- }
-
- private:
- QPointer<QPushButton> pushButton;
- };
-
- QMenu menu;
- QMenu submenu;
-
- int menuTriggeredCount = 0;
- int menuAboutToHideCount = 0;
- QAction *actionTriggered = nullptr;
-
- connect(&menu, &QMenu::triggered, this, [&](QAction *action){
- ++menuTriggeredCount;
- actionTriggered = action;
- });
- connect (&menu, &QMenu::aboutToHide, this, [&](){
- ++menuAboutToHideCount;
- });
-
- QAction regularAction(QLatin1String("Action"));
- ButtonAction widgetAction;
-
- submenu.addAction(&regularAction);
- submenu.addAction(&widgetAction);
-
- menu.addMenu(&submenu);
- menu.addAction(&regularAction);
- menu.addAction(&widgetAction);
-
- menu.popup(QPoint(200,200));
- submenu.popup(QPoint(250,250));
- if (!QTest::qWaitForWindowExposed(&menu) || !QTest::qWaitForWindowExposed(&submenu))
- QSKIP("Failed to show menus, aborting test");
-
- regularAction.trigger();
- QVERIFY(menu.isVisible());
- QVERIFY(submenu.isVisible());
- QCOMPARE(menuTriggeredCount, 1);
- QCOMPARE(actionTriggered, &regularAction);
- menuTriggeredCount = 0;
- actionTriggered = nullptr;
-
- widgetAction.click();
- QVERIFY(!menu.isVisible());
- QVERIFY(!submenu.isVisible());
- QCOMPARE(menuTriggeredCount, 1);
- QCOMPARE(menuAboutToHideCount, 1);
- QCOMPARE(actionTriggered, &widgetAction);
-}
class MyMenu : public QMenu
{
--
2.25.1

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Wed May 27 08:48:52 UTC 2020 - Fabian Vogt <fvogt@suse.com>
- Add patch to avoid behaviour change causing crashes (kde#419526):
* 0001-Revert-QMenu-hide-when-a-QWidgetAction-fires-the-tri.patch
------------------------------------------------------------------- -------------------------------------------------------------------
Tue May 26 09:44:55 UTC 2020 - Callum Farmer <callumjfarmer13@gmail.com> Tue May 26 09:44:55 UTC 2020 - Callum Farmer <callumjfarmer13@gmail.com>

View File

@ -55,6 +55,7 @@ Source99: libqt5-qtbase-rpmlintrc
# patches 0-1000 are openSUSE and/or non-upstream(able) patches # # patches 0-1000 are openSUSE and/or non-upstream(able) patches #
Patch1: 0001-Lower-required-version-of-OpenSSL-to-1.1.0.patch Patch1: 0001-Lower-required-version-of-OpenSSL-to-1.1.0.patch
Patch2: fix-build-openssl-1.1.0.patch Patch2: fix-build-openssl-1.1.0.patch
Patch3: 0001-Revert-QMenu-hide-when-a-QWidgetAction-fires-the-tri.patch
# PATCH-FIX-OPENSUSE disable-rc4-ciphers-bnc865241.diff bnc#865241-- Exclude rc4 ciphers from being used by default # PATCH-FIX-OPENSUSE disable-rc4-ciphers-bnc865241.diff bnc#865241-- Exclude rc4 ciphers from being used by default
Patch6: disable-rc4-ciphers-bnc865241.diff Patch6: disable-rc4-ciphers-bnc865241.diff
Patch8: tell-the-truth-about-private-api.patch Patch8: tell-the-truth-about-private-api.patch