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
@@ -14,7 +14,7 @@ import QtQuick
|
||||
// onActivateRequested: root.activateCursor()
|
||||
// onCloseRequested: root.close()
|
||||
// onDeleteRequested: root.deleteSelected()
|
||||
// onTextKey: function(t) { if (t === "r") root.refresh() }
|
||||
// onTextKey: function(t, modifiers) { if (t === "r") root.refresh() }
|
||||
//
|
||||
// Column { ... panel content ... }
|
||||
// }
|
||||
@@ -41,7 +41,8 @@ Item {
|
||||
signal closeRequested()
|
||||
signal deleteRequested()
|
||||
signal tabRequested(int direction)
|
||||
signal textKey(string text)
|
||||
// The held modifiers ride along, so a panel can tell Alt+T from T.
|
||||
signal textKey(string text, int modifiers)
|
||||
|
||||
focus: true
|
||||
Keys.priority: Keys.BeforeItem
|
||||
@@ -79,7 +80,7 @@ Item {
|
||||
deleteRequested(); event.accepted = true; return
|
||||
}
|
||||
if (event.text && event.text.length === 1) {
|
||||
textKey(event.text)
|
||||
textKey(event.text, event.modifiers)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -758,10 +758,12 @@ Panel {
|
||||
}
|
||||
onTabRequested: function(direction) { root.switchPanel(direction) }
|
||||
// "+" searches in either view; "j" jumps on the globe, "a" adds on the list.
|
||||
// "t" flips 24-hour and AM/PM time, like clicking a row's time.
|
||||
onTextKey: function(text) {
|
||||
// "t" flips 24-hour and AM/PM time, like clicking a row's time, and Alt+T
|
||||
// flips Fahrenheit and Celsius, like clicking a temperature.
|
||||
onTextKey: function(text, modifiers) {
|
||||
var key = text.toLowerCase()
|
||||
if (key === "r") root.refresh()
|
||||
else if (key === "t" && (modifiers & Qt.AltModifier)) root.toggleUnits()
|
||||
else if (key === "t") root.toggleHour24()
|
||||
else if (root.globeMode && (key === "+" || key === "j")) {
|
||||
if (globeLoader.item) globeLoader.item.startJump()
|
||||
|
||||
Reference in new issue
Block a user