Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.15.12, 6.2.6, 6.4.1
Description
Code
import QtQuick 2.15 import QtQuick.Window 2.15 import QtQuick.Controls 2.15 import QtQuick.Layouts 1.15 Window { width: 400 height: 300 visible: true function discardSpaceKey(keyEvent, source) { console.log(`Discarding [Space] in ${source}...`) keyEvent.accepted = true } ColumnLayout { anchors.fill: parent TextField { id: textField Layout.fillWidth: true text: "TextField" Keys.onSpacePressed: (event) => discardSpaceKey(event, "TextField") } ComboBox{ id: editableComboBox Layout.fillWidth: true editable: true model: ["ComboBox:Editable", "Alpha", "Bravo", "Charlie"] Keys.onSpacePressed: (event) => discardSpaceKey(event, "Editable ComboBox") } ComboBox{ id: nonEditableComboBox Layout.fillWidth: true editable: false model: ["ComboBox:NonEditable", "Delta", "Echo", "Foxtrot"] Keys.onSpacePressed: (event) => discardSpaceKey(event, "Non-Editable ComboBox") } } Component.onCompleted: textField.focus = true }
Steps to reproduce
- Run the above code; textField should receive focus at startup
- Press [Space]
- Press [Tab] until editableComboBox receives focus
- Press [Space]
- Click the arrow indicator of editableComboBox to open its popup
- Hover the mouse cursor over "Bravo" and press [Space]
- Press [Tab] until nonEditableComboBox receives focus
- Press [Space]
- Click the arrow indicator of nonEditableComboBox to open its popup
- Hover the mouse cursor over "Echo" and press [Space]
Actual outcomes
- Step #2: Nothing happens (expected)
- Step #4: Nothing happens (expected)
- Step #6: Nothing happens (expected)
- Step #8: The popup of nonEditableComboBox appears (not expected)
- Step #10: The popup of nonEditableComboBox disappears and "Echo" is selected (not expected)
Expected outcomes
nonEditableComboBox should treat the [Space] key like how editableComboBox does.