delete-copy-paste buttons layed out properly

Now these buttons are finally shown with long press and seem to be
working more-or-less as intended.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
This commit is contained in:
Miika Turkia 2018-10-27 13:00:02 +03:00 committed by Dirk Hohndel
parent 37e7602a1e
commit 88d5eccb17

View file

@ -118,12 +118,12 @@ Kirigami.ScrollablePage {
} }
property bool deleteButtonVisible: false property bool deleteButtonVisible: false
property bool copyButtonVisible: true // TODO: false property bool copyButtonVisible: false
property bool pasteButtonVisible: false property bool pasteButtonVisible: false
onPressAndHold: { onPressAndHold: {
deleteButtonVisible = false // TODO: true deleteButtonVisible = true
copyButtonVisible = false // TODO: true copyButtonVisible = true
pasteButtonVisible = true pasteButtonVisible = true
timer.restart() timer.restart()
} }
@ -143,7 +143,7 @@ Kirigami.ScrollablePage {
} }
Item { Item {
id: diveListEntry id: diveListEntry
width: parent.width - Kirigami.Units.gridUnit * (innerListItem.deleteButtonVisible ? 3 : 1) width: parent.width - Kirigami.Units.gridUnit * (innerListItem.deleteButtonVisible ? 3 * 3 : 1)
height: Math.ceil(childrenRect.height + Kirigami.Units.smallSpacing) height: Math.ceil(childrenRect.height + Kirigami.Units.smallSpacing)
anchors.left: leftBarDive.right anchors.left: leftBarDive.right
Controls.Label { Controls.Label {
@ -202,15 +202,16 @@ Kirigami.ScrollablePage {
id: copyButton id: copyButton
visible: copyButtonVisible visible: copyButtonVisible
height: diveListEntry.height - 2 * Kirigami.Units.smallSpacing height: diveListEntry.height - 2 * Kirigami.Units.smallSpacing
width: height - 3 * Kirigami.Units.smallSpacing width: height
color: subsurfaceTheme.lightDrawerColor color: subsurfaceTheme.lightDrawerColor
antialiasing: true antialiasing: true
radius: Kirigami.Units.smallSpacing radius: Kirigami.Units.smallSpacing
anchors { anchors {
left: diveListEntry.right left: diveListEntry.right
right: parent.right
verticalCenter: diveListEntry.verticalCenter verticalCenter: diveListEntry.verticalCenter
verticalCenterOffset: Kirigami.Units.smallSpacing / 2 verticalCenterOffset: Kirigami.Units.smallSpacing / 2
rightMargin: horizontalPadding * 2
leftMargin: horizontalPadding * 2
} }
Kirigami.Icon { Kirigami.Icon {
anchors { anchors {
@ -237,15 +238,16 @@ Kirigami.ScrollablePage {
id: pasteButton id: pasteButton
visible: pasteButtonVisible visible: pasteButtonVisible
height: diveListEntry.height - 2 * Kirigami.Units.smallSpacing height: diveListEntry.height - 2 * Kirigami.Units.smallSpacing
width: height - 3 * Kirigami.Units.smallSpacing width: height
color: subsurfaceTheme.contrastAccentColor color: subsurfaceTheme.lightDrawerColor
antialiasing: true antialiasing: true
radius: Kirigami.Units.smallSpacing radius: Kirigami.Units.smallSpacing
anchors { anchors {
left: diveListEntry.right left: copyButton.right
right: parent.right
verticalCenter: diveListEntry.verticalCenter verticalCenter: diveListEntry.verticalCenter
verticalCenterOffset: Kirigami.Units.smallSpacing / 2 verticalCenterOffset: Kirigami.Units.smallSpacing / 2
rightMargin: horizontalPadding * 2
leftMargin: horizontalPadding * 2
} }
Kirigami.Icon { Kirigami.Icon {
anchors { anchors {
@ -272,15 +274,17 @@ Kirigami.ScrollablePage {
id: deleteButton id: deleteButton
visible: deleteButtonVisible visible: deleteButtonVisible
height: diveListEntry.height - 2 * Kirigami.Units.smallSpacing height: diveListEntry.height - 2 * Kirigami.Units.smallSpacing
width: height - 3 * Kirigami.Units.smallSpacing width: height
color: subsurfaceTheme.contrastAccentColor color: subsurfaceTheme.contrastAccentColor
antialiasing: true antialiasing: true
radius: Kirigami.Units.smallSpacing radius: Kirigami.Units.smallSpacing
anchors { anchors {
left: diveListEntry.right left: pasteButton.right
right: parent.right right: parent.right
verticalCenter: diveListEntry.verticalCenter verticalCenter: diveListEntry.verticalCenter
verticalCenterOffset: Kirigami.Units.smallSpacing / 2 verticalCenterOffset: Kirigami.Units.smallSpacing / 2
rightMargin: horizontalPadding * 2
leftMargin: horizontalPadding * 2
} }
Kirigami.Icon { Kirigami.Icon {
anchors { anchors {