Port KKeySequenceItem to QQC2
ClosedPublic

Authored by davidedmundson on Apr 29 2020, 8:50 PM.

Details

Summary

This implicitly fixes a bug where space is used in the shortcut item.
Previously as QQC1 button was made up of multiple objects the key
handling would be handled by an internal object before our filters.

In QQC2 it's all one item, so our Keys handler takes precendence.

Test Plan

Added a test file
Set the button to control+space, alt+4
Set the button to alt+space (this correctly showed a warning about a conflict)
Confirmed tooltip worked correctly
Used space to activate the button when we weren't recording. This someone still worked..

Diff Detail

Repository
R296 KDeclarative
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
davidedmundson created this revision.Apr 29 2020, 8:50 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptApr 29 2020, 8:50 PM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
davidedmundson requested review of this revision.Apr 29 2020, 8:50 PM
broulik added inline comments.
src/qmlcontrols/kquickcontrols/KeySequenceItem.qml
57

Can we use the non-attached version here please since it's not likely (except maybe System Tray delegate) to be used in large quantities?

58

Is this _tr thing we could also improve (separately o/c)?

61

Probably can now use onToggled?

cblack added a subscriber: cblack.Apr 29 2020, 8:58 PM
cblack added inline comments.
src/qmlcontrols/kquickcontrols/KeySequenceItem.qml
57

Are we able to use some form of units? Hardcoding this seems wrong.

59

Ditto here, but even hardcoded this looks wrong.

davidedmundson added inline comments.Apr 29 2020, 9:37 PM
src/qmlcontrols/kquickcontrols/KeySequenceItem.qml
57

Can we use the non-attached version here please since it's not likely

It's the worst!

Are we able to use some form of units? Hardcoding this seems wrong.

It's come up before, this isn't ideal, but there's no other consistent alternative. It's the convention followed elsewhere.

Let's follow that up on https://phabricator.kde.org/T10873

58

We need to specify the domain, but you're right i18nd would work just as well and save a QObject

broulik added inline comments.Apr 30 2020, 6:42 AM
src/qmlcontrols/kquickcontrols/KeySequenceItem.qml
57

Why is it the worst? It keeps us from having to hardcode magic numbers.

58

Assuming i18n is always available? Maybe should stick to qsTr

davidedmundson added inline comments.Apr 30 2020, 8:50 AM
src/qmlcontrols/kquickcontrols/KeySequenceItem.qml
57

See task.

ngraham accepted this revision.Apr 30 2020, 1:56 PM
ngraham added a subscriber: ngraham.

Works for me, and we can bikeshed about the tooltip stuff elsewhere. :)

This revision is now accepted and ready to land.Apr 30 2020, 1:56 PM
This revision was automatically updated to reflect the committed changes.