From 1c6a510c16b35c937af202f517604620b4a97ff0 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Mon, 7 Sep 2015 13:28:15 +0200 Subject: Button: only enable mnemonic if button itself is enabled. Otherwise users can trigger shortcuts even when buttons are disabled. Change-Id: If97c6a3c3df574a4271c53cf7bcfd8fdb1a059d6 Task-number: QTBUG-48144 Reviewed-by: J-P Nurmi --- tests/auto/controls/data/tst_button.qml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'tests/auto') diff --git a/tests/auto/controls/data/tst_button.qml b/tests/auto/controls/data/tst_button.qml index 136f82cc..0d226ffc 100644 --- a/tests/auto/controls/data/tst_button.qml +++ b/tests/auto/controls/data/tst_button.qml @@ -40,6 +40,7 @@ import QtQuick 2.2 import QtTest 1.0 +import QtQuick.Controls 1.4 import QtQuickControlsTests 1.0 Item { @@ -278,5 +279,26 @@ TestCase { button.destroy() } + + Component { + id: mnemonicButtonComponent + + Button { + text: "&Hi" + enabled: false + } + } + + function test_mnemonic() { + var button = mnemonicButtonComponent.createObject(container); + verify(button); + + clickSpy.clear(); + clickSpy.target = button; + keyClick(Qt.Key_H, Qt.AltModifier); + compare(clickSpy.count, 0); + + button.destroy(); + } } } -- cgit v1.2.1