Commit c730edc8 authored by David Edmundson's avatar David Edmundson

Port KKeySequenceItem to QQC2

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..

Reviewers: #plasma, davidre, ngraham

Reviewed By: ngraham

Subscribers: ngraham, cblack, broulik, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D29292
parent 277b2e3a
import QtQuick 2.0
import QtQuick.Controls 1.1
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.1
import org.kde.private.kquickcontrols 2.0 as KQuickControlsPrivate
......@@ -43,14 +43,20 @@ RowLayout {
{
id: mainButton
iconName: "configure"
icon.name: "configure"
property string shortcut
checkable: true
focus: checked
hoverEnabled: true
text: _helper.shortcutDisplay
tooltip: _tr.i18n("Click on the button, then enter the shortcut like you would in the program.\nExample for Ctrl+A: hold the Ctrl key and press A.")
ToolTip.visible: hovered
ToolTip.delay: 1000
ToolTip.text: _tr.i18n("Click on the button, then enter the shortcut like you would in the program.\nExample for Ctrl+A: hold the Ctrl key and press A.")
ToolTip.timeout: 5000
onCheckedChanged: {
if (checked) {
......@@ -82,6 +88,6 @@ RowLayout {
onClicked: _helper.clearKeySequence();
//icon name determines the direction of the arrow, NOT the direction of the app layout
iconName: Qt.application.layoutDirection == Qt.LeftToRight ? "edit-clear-locationbar-rtl" : "edit-clear-locationbar-ltr"
icon.name: Qt.application.layoutDirection == Qt.LeftToRight ? "edit-clear-locationbar-rtl" : "edit-clear-locationbar-ltr"
}
}
import QtQuick 2.0
import QtQuick.Controls 1.1
import org.kde.kquickcontrols 2.0
import QtQuick.Layouts 1.1
RowLayout {
KeySequenceItem
{
id: sequenceItem
}
Text
{
text: sequenceItem.keySequence
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment