Flip Elsewhen between Fahrenheit and Celsius with Alt+T (#13450)
* Flip Elsewhen between Fahrenheit and Celsius with Shift+T Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Flip Elsewhen's temperature units with Alt+T instead of Shift+T PanelKeyCatcher's textKey now carries the held modifiers, which is how the panel tells Alt+T from T. Existing handlers take only the text and are unaffected. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ed5837a05b
commit
349ecc09a2
4 files changed
+76
-5
No files matched your search
@@ -0,0 +1,45 @@
|
||||
import QtQuick
|
||||
import QtTest
|
||||
import "../../../../shell/Ui"
|
||||
|
||||
// Text keys carry their modifiers, so a panel can tell Alt+T from T.
|
||||
Item {
|
||||
id: root
|
||||
width: 100
|
||||
height: 100
|
||||
|
||||
property string lastText: ""
|
||||
property int lastModifiers: -1
|
||||
|
||||
PanelKeyCatcher {
|
||||
id: catcher
|
||||
anchors.fill: parent
|
||||
onTextKey: function(text, modifiers) {
|
||||
root.lastText = text
|
||||
root.lastModifiers = modifiers
|
||||
}
|
||||
}
|
||||
|
||||
TestCase {
|
||||
name: "PanelKeyCatcherModifiers"
|
||||
when: windowShown
|
||||
|
||||
function init() {
|
||||
catcher.forceActiveFocus()
|
||||
root.lastText = ""
|
||||
root.lastModifiers = -1
|
||||
}
|
||||
|
||||
function test_plainLetterHasNoModifiers() {
|
||||
keyClick(Qt.Key_T)
|
||||
compare(root.lastText, "t")
|
||||
compare(root.lastModifiers & Qt.AltModifier, 0)
|
||||
}
|
||||
|
||||
function test_altLetterCarriesAlt() {
|
||||
keyClick(Qt.Key_T, Qt.AltModifier)
|
||||
compare(root.lastText.toLowerCase(), "t")
|
||||
verify(root.lastModifiers & Qt.AltModifier)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user