Don't close tags menu when toggling items (#15098)

The issue was resolved by using QAction::toggled signal instead of
QAction::triggered. In QT 5.15+ the latter signal causes a QMenu
to close, whereas the former does not. Closes #13492.
This commit is contained in:
tgregerson
2021-06-16 09:57:56 -05:00
committed by GitHub
parent 2bd2490539
commit e74ad86f14
5 changed files with 20 additions and 16 deletions

View File

@@ -37,7 +37,7 @@ class TriStateWidget;
// TriStateWidget is responsible for checkbox state (tri-state) and paint events while
// TriStateAction will keep in sync with it. This allows connecting with the usual
// QAction::triggered slot.
// QAction::triggered or QAction::toggled slots.
class TriStateAction : public QWidgetAction
{
public:
@@ -46,7 +46,12 @@ public:
// should use this function instead of QAction::setChecked(bool)
void setCheckState(Qt::CheckState checkState);
void setCloseOnTriggered(bool enabled);
// When set to 'true' toggling the checkbox will emit a signal on
// QAction::triggered. When placed in a QMenu, this causes the menu to close.
// When set to 'false' emits a signal on QAction::toggled instead, leaving the
// menu open.
// Default value: 'true'.
void setCloseOnInteraction(bool enabled);
private:
TriStateWidget *m_triStateWidget;