diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2016-04-02 07:49:28 -0500 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2016-04-02 12:46:59 -0500 |
commit | 0a0d7b48e9cc84c1d1bf68846a13cebf3e98aafd (patch) | |
tree | e1d05210f19d38041502fa099226a558c7cf39ed /qt-mobile | |
parent | 69c10808af442140829975ee1cf893160e3be10d (diff) | |
download | subsurface-0a0d7b48e9cc84c1d1bf68846a13cebf3e98aafd.tar.gz |
QML UI: press and hold for delete dive on dive list
This looks a little rough, but I think it works well. I'm sure it could
be prettier, though. The next patch will just do the white space cleanup
for the additional indentation level.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-mobile')
-rw-r--r-- | qt-mobile/qml/DiveList.qml | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/qt-mobile/qml/DiveList.qml b/qt-mobile/qml/DiveList.qml index d7fb5fdca..c3a92a93d 100644 --- a/qt-mobile/qml/DiveList.qml +++ b/qt-mobile/qml/DiveList.qml @@ -42,7 +42,23 @@ Kirigami.ScrollablePage { } } + property bool deleteButtonVisible: false + + onPressAndHold: { + deleteButtonVisible = true + timer.restart() + } + + Row { + width: parent.width - Kirigami.Units.gridUnit + height: childrenRect.height - Kirigami.Units.smallSpacing + spacing: horizontalPadding + add: Transition { + NumberAnimation { property: "opacity"; from: 0; to: 1.0; duration: 400 } + NumberAnimation { property: "scale"; from: 0; to: 1.0; duration: 400 } + } Item { + id: diveListEntry width: parent.width - Kirigami.Units.gridUnit height: childrenRect.height - Kirigami.Units.smallSpacing @@ -113,6 +129,40 @@ Kirigami.ScrollablePage { } } } + Rectangle { + visible: deleteButtonVisible + height: diveListEntry.height - Kirigami.Units.smallSpacing + width: height - 3 * Kirigami.Units.smallSpacing + color: "#FF3030" + antialiasing: true + radius: Kirigami.Units.smallSpacing + Kirigami.Icon { + anchors { + horizontalCenter: parent.horizontalCenter + verticalCenter: parent.verticalCenter + } + source: "trash-empty" + } + MouseArea { + anchors.fill: parent + enabled: parent.visible + onClicked: { + parent.visible = false + timer.stop() + manager.deleteDive(dive.id) + } + } + } + Item { + Timer { + id: timer + interval: 4000 + onTriggered: { + deleteButtonVisible = false + } + } + } + } } } |