Improve HTile(Delegate) paddings

This commit is contained in:
miruka 2020-05-01 01:05:50 -04:00
parent 36a214bf1a
commit 0d25c4caeb
2 changed files with 12 additions and 10 deletions

View File

@ -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()

View File

@ -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
}