From 0d25c4caebb918e01bc4b10d34da8edc6db7cb65 Mon Sep 17 00:00:00 2001 From: miruka Date: Fri, 1 May 2020 01:05:50 -0400 Subject: [PATCH] Improve HTile(Delegate) paddings --- src/gui/Base/HTile/HTile.qml | 12 ++---------- src/gui/Base/HTile/HTileDelegate.qml | 10 ++++++++++ 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/gui/Base/HTile/HTile.qml b/src/gui/Base/HTile/HTile.qml index 5610f4e6..f83ac452 100644 --- a/src/gui/Base/HTile/HTile.qml +++ b/src/gui/Base/HTile/HTile.qml @@ -5,6 +5,8 @@ import ".." HButton { id: tile + topPadding: padded ? spacing / (compact ? 4 : 2) : 0 + bottomPadding: topPadding signal leftClicked() @@ -21,16 +23,6 @@ HButton { Behavior on topPadding { HNumberAnimation {} } Behavior on bottomPadding { HNumberAnimation {} } - Binding on topPadding { - value: spacing / 4 - when: compact - } - - Binding on bottomPadding { - value: spacing / 4 - when: compact - } - TapHandler { acceptedButtons: Qt.LeftButton onTapped: leftClicked() diff --git a/src/gui/Base/HTile/HTileDelegate.qml b/src/gui/Base/HTile/HTileDelegate.qml index cf0ec20c..b0a0bbb3 100644 --- a/src/gui/Base/HTile/HTileDelegate.qml +++ b/src/gui/Base/HTile/HTileDelegate.qml @@ -6,6 +6,11 @@ import ".." HTile { id: tile + topPadding: + padded ? spacing / (firstInSection ? 1 : 2) / (compact ? 2 : 1) : 0 + bottomPadding: + padded ? spacing / (lastInSection ? 1 : 2) / (compact ? 2 : 1) : 0 + onLeftClicked: { view.highlightRangeMode = ListView.NoHighlightRange view.highlightMoveDuration = 0 @@ -18,4 +23,9 @@ HTile { signal activated() property HListView view: ListView.view + + readonly property bool firstInSection: + ListView.previousSection !== ListView.section + readonly property bool lastInSection: + ListView.nextSection !== ListView.section }