From 80039621c01c69ee857fa1c7f0e2d7c46e2d7b64 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Thu, 28 Jan 2021 12:36:22 +0100 Subject: Adapt to hover on disabled items Only react to hovered on enabled items. Fixes: QTBUG-90580 Change-Id: I955033f391e6cd592e3d75b79b9242019db9fcfa Reviewed-by: Mitch Curtis --- src/quicktemplates2/qquickcombobox.cpp | 2 +- src/quicktemplates2/qquickmenu.cpp | 2 +- src/quicktemplates2/qquickmenubar.cpp | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/quicktemplates2/qquickcombobox.cpp b/src/quicktemplates2/qquickcombobox.cpp index 0f537ede..136b32f4 100644 --- a/src/quicktemplates2/qquickcombobox.cpp +++ b/src/quicktemplates2/qquickcombobox.cpp @@ -384,7 +384,7 @@ void QQuickComboBoxPrivate::itemHovered() return; QQuickAbstractButton *button = qobject_cast(q->sender()); - if (!button || !button->isHovered() || QQuickAbstractButtonPrivate::get(button)->touchId != -1) + if (!button || !button->isHovered() || !button->isEnabled() || QQuickAbstractButtonPrivate::get(button)->touchId != -1) return; int index = delegateModel->indexOf(button, nullptr); diff --git a/src/quicktemplates2/qquickmenu.cpp b/src/quicktemplates2/qquickmenu.cpp index d9231cbd..59c47d03 100644 --- a/src/quicktemplates2/qquickmenu.cpp +++ b/src/quicktemplates2/qquickmenu.cpp @@ -477,7 +477,7 @@ void QQuickMenuPrivate::onItemHovered() { Q_Q(QQuickMenu); QQuickAbstractButton *button = qobject_cast(q->sender()); - if (!button || !button->isHovered() || QQuickAbstractButtonPrivate::get(button)->touchId != -1) + if (!button || !button->isHovered() || !button->isEnabled() || QQuickAbstractButtonPrivate::get(button)->touchId != -1) return; QQuickMenuItem *oldCurrentItem = currentItem; diff --git a/src/quicktemplates2/qquickmenubar.cpp b/src/quicktemplates2/qquickmenubar.cpp index b5731158..a732d889 100644 --- a/src/quicktemplates2/qquickmenubar.cpp +++ b/src/quicktemplates2/qquickmenubar.cpp @@ -181,7 +181,7 @@ void QQuickMenuBarPrivate::onItemHovered() { Q_Q(QQuickMenuBar); QQuickMenuBarItem *item = qobject_cast(q->sender()); - if (!item || item == currentItem || !item->isHovered() || QQuickMenuBarItemPrivate::get(item)->touchId != -1) + if (!item || item == currentItem || !item->isHovered() || !item->isEnabled() || QQuickMenuBarItemPrivate::get(item)->touchId != -1) return; activateItem(item); @@ -204,7 +204,7 @@ void QQuickMenuBarPrivate::onItemTriggered() void QQuickMenuBarPrivate::onMenuAboutToHide() { - if (triggering || !currentItem || currentItem->isHovered() || !currentItem->isHighlighted()) + if (triggering || !currentItem || (currentItem->isHovered() && currentItem->isEnabled()) || !currentItem->isHighlighted()) return; popupMode = false; -- cgit v1.2.3