Fix HButton/HTile focus and click
This commit is contained in:
parent
784cb3b19c
commit
38e781c9f7
@ -24,6 +24,9 @@ Button {
|
||||
implicitContentHeight + topPadding + bottomPadding
|
||||
)
|
||||
|
||||
// Prevent button from gaining focus and being highlighted on click
|
||||
focusPolicy: Qt.TabFocus
|
||||
|
||||
|
||||
readonly property alias iconItem: contentItem.icon
|
||||
readonly property alias label: contentItem.label
|
||||
|
@ -38,6 +38,7 @@ HButton {
|
||||
HLabel {
|
||||
id: rightInfo
|
||||
font.pixelSize: theme.fontSize.small
|
||||
color: theme.colors.halfDimText
|
||||
|
||||
visible: Layout.maximumWidth > 0
|
||||
Layout.maximumWidth:
|
||||
@ -52,6 +53,7 @@ HButton {
|
||||
textFormat: Text.StyledText
|
||||
font.pixelSize: theme.fontSize.small
|
||||
elide: Text.ElideRight
|
||||
color: theme.colors.dimText
|
||||
|
||||
visible: Layout.maximumHeight > 0
|
||||
Layout.maximumHeight: text ? implicitWidth : 0
|
||||
|
@ -4,6 +4,13 @@ import QtQuick.Layouts 1.12
|
||||
HTile {
|
||||
id: tile
|
||||
onActivated: view.currentIndex = model.index
|
||||
onClicked: {
|
||||
view.highlightRangeMode = ListView.NoHighlightRange
|
||||
view.highlightMoveDuration = 0
|
||||
activated()
|
||||
view.highlightRangeMode = ListView.ApplyRange
|
||||
view.highlightMoveDuration = theme.animationDuration
|
||||
}
|
||||
|
||||
|
||||
signal activated()
|
||||
@ -25,17 +32,6 @@ HTile {
|
||||
onTriggered: if (shouldBeCurrent) view.currentIndex = model.index
|
||||
}
|
||||
|
||||
TapHandler {
|
||||
acceptedButtons: Qt.LeftButton
|
||||
onTapped: {
|
||||
view.highlightRangeMode = ListView.NoHighlightRange
|
||||
view.highlightMoveDuration = 0
|
||||
activated()
|
||||
view.highlightRangeMode = ListView.ApplyRange
|
||||
view.highlightMoveDuration = theme.animationDuration
|
||||
}
|
||||
}
|
||||
|
||||
TapHandler {
|
||||
acceptedButtons: Qt.RightButton
|
||||
onTapped: if (contextMenu.count > 0) contextMenu.popup()
|
||||
|
Loading…
Reference in New Issue
Block a user