Hide hover highlight when moving with keybinds

This commit is contained in:
miruka 2019-08-20 14:29:03 -04:00
parent 073a2eacee
commit 7e7852b51e
4 changed files with 36 additions and 5 deletions

View File

@ -1,10 +1,12 @@
import QtQuick 2.12 import QtQuick 2.12
HRectangle { HRectangle {
id: rectangle
property bool checkable: false // TODO property bool checkable: false // TODO
property bool checked: false property bool checked: false
property alias pressed: tap.pressed property bool hovered: false
property alias hovered: hover.hovered readonly property alias pressed: tap.pressed
readonly property QtObject _ir: theme.controls.interactiveRectangle readonly property QtObject _ir: theme.controls.interactiveRectangle
color: _ir.background color: _ir.background
@ -26,6 +28,10 @@ HRectangle {
"transparent" "transparent"
} }
HoverHandler { id: hover } HoverHandler {
id: hover
onHoveredChanged: rectangle.hovered = hovered
}
TapHandler { id: tap } TapHandler { id: tap }
} }

View File

@ -7,6 +7,10 @@ HListView {
id: accountRoomList id: accountRoomList
signal hideHoverHighlight()
onHideHoverHighlight: hoverBlocker.enabled = true
readonly property var originSource: window.sidePaneModelSource readonly property var originSource: window.sidePaneModelSource
readonly property var collapseAccounts: window.uiState.collapseAccounts readonly property var collapseAccounts: window.uiState.collapseAccounts
readonly property string filter: paneToolBar.roomFilter readonly property string filter: paneToolBar.roomFilter
@ -58,12 +62,14 @@ HListView {
} }
function previous(activate=true) { function previous(activate=true) {
hideHoverHighlight()
decrementCurrentIndex() decrementCurrentIndex()
if (activate) activateLimiter.requestFire() if (activate) activateLimiter.requestFire()
} }
function next(activate=true) { function next(activate=true) {
hideHoverHighlight()
incrementCurrentIndex() incrementCurrentIndex()
if (activate) activateLimiter.requestFire() if (activate) activateLimiter.requestFire()
} }
@ -105,6 +111,17 @@ HListView {
} }
MouseArea {
id: hoverBlocker
anchors.fill: parent
enabled: false
hoverEnabled: enabled
propagateComposedEvents: true
onMouseXChanged: enabled = false
onMouseYChanged: enabled = false
}
HRateLimiter { HRateLimiter {
id: filterLimiter id: filterLimiter
cooldown: 16 cooldown: 16

View File

@ -51,6 +51,11 @@ HInteractiveRectangle {
onTriggered: if (isCurrent) beHighlighted() onTriggered: if (isCurrent) beHighlighted()
} }
Connections {
target: accountRoomList
onHideHoverHighlight: accountDelegate.hovered = false
}
TapHandler { TapHandler {
onTapped: { onTapped: {
accountRoomList.highlightRangeMode = ListView.NoHighlightRange accountRoomList.highlightRangeMode = ListView.NoHighlightRange

View File

@ -45,6 +45,11 @@ HInteractiveRectangle {
onTriggered: if (isCurrent) beHighlighted() onTriggered: if (isCurrent) beHighlighted()
} }
Connections {
target: accountRoomList
onHideHoverHighlight: roomDelegate.hovered = false
}
TapHandler { TapHandler {
onTapped: { onTapped: {
accountRoomList.highlightRangeMode = ListView.NoHighlightRange accountRoomList.highlightRangeMode = ListView.NoHighlightRange
@ -57,8 +62,6 @@ HInteractiveRectangle {
HRowLayout { HRowLayout {
id: rowLayout id: rowLayout
property var pr: sidePane.currentSpacing
onPrChanged: print("pr changed:", pr, spacing, x)
spacing: sidePane.currentSpacing spacing: sidePane.currentSpacing
x: sidePane.currentSpacing x: sidePane.currentSpacing