From 6c20f4ca0f92ca5a208ca567e7a9cf28df743bf7 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Fri, 21 Jul 2017 06:19:56 +0200 Subject: Use a Button for the Addressbook delegate. This makes it keyboard selectable. --- framework/qml/People.qml | 85 ++++++++++++++++++++++++------------------------ 1 file changed, 42 insertions(+), 43 deletions(-) (limited to 'framework') diff --git a/framework/qml/People.qml b/framework/qml/People.qml index 42c95d78..d0f7d252 100644 --- a/framework/qml/People.qml +++ b/framework/qml/People.qml @@ -98,6 +98,7 @@ Item { anchors.fill: parent + activeFocusOnTab: true ScrollBar.vertical: ScrollBar { } contentHeight: content.height clip: true @@ -133,65 +134,63 @@ Item { filter: searchBar.text } - delegate: Rectangle { + //TODO using Kube.Button currently crashes, but shouldn't + delegate: Button { id: delegateRoot height: Kube.Units.gridUnit * 3 width: Kube.Units.gridUnit * 10 - border.width: 1 - border.color: "lightgrey" + activeFocusOnTab: true + Keys.onReturnPressed: delegateRoot.clicked() - MouseArea { - anchors.fill: parent - - onClicked: { - root.currentContact = model.domainObject - stack.push(personPage) - } + onClicked: { + root.currentContact = model.domainObject + stack.push(personPage) } - Rectangle { - id: avatarPlaceholder - - height: parent.height - width: height - Kube.KubeImage { - anchors.fill: parent - visible: model.imageData != "" - imageData: model.imageData - } - Kube.Icon { - anchors.fill: parent - visible: model.imageData == "" - iconName: Kube.Icons.user + contentItem: Item { + anchors.fill: parent + Item { + id: avatarPlaceholder + + height: parent.height + width: height + Kube.KubeImage { + anchors.fill: parent + visible: model.imageData != "" + imageData: model.imageData + } + Kube.Icon { + anchors.fill: parent + visible: model.imageData == "" + iconName: Kube.Icons.user + } } - color: "lightgrey" - } + Column { - Column { + width: parent.width - width: parent.width + anchors { + left: avatarPlaceholder.right + margins: Kube.Units.smallSpacing + verticalCenter: parent.verticalCenter + } - anchors { - left: avatarPlaceholder.right - margins: Kube.Units.smallSpacing - verticalCenter: parent.verticalCenter - } + Kube.Label { + width: delegateRoot.width - avatarPlaceholder.width - Kube.Units.smallSpacing * 2 - Kube.Label { - width: delegateRoot.width - avatarPlaceholder.width - Kube.Units.smallSpacing * 2 - - text: model.firstName - elide: Text.ElideRight - } + text: model.firstName + elide: Text.ElideRight + } - Kube.Label { - width: delegateRoot.width - avatarPlaceholder.width - Kube.Units.smallSpacing * 2 + Kube.Label { + width: delegateRoot.width - avatarPlaceholder.width - Kube.Units.smallSpacing * 2 - text: model.lastName - elide: Text.ElideRight + text: model.lastName + elide: Text.ElideRight + } } } } -- cgit v1.2.3