Fix expand icon size and startup highlight

Remove "hide hover highlight when keyboard pressed" feature, too hacky.
This commit is contained in:
miruka
2019-08-21 06:02:00 -04:00
parent 1f5b46c257
commit 8ef3a6dc33
8 changed files with 130 additions and 60 deletions

View File

@@ -55,6 +55,7 @@ Button {
svgName: loading ? "hourglass" : iconName
Layout.fillHeight: true
Layout.alignment: Qt.AlignCenter
}
HLabel {

View File

@@ -6,10 +6,10 @@ HButton {
signal activated()
signal highlightMe()
property bool isCurrent: false
property HListView view: ListView.view
property bool shouldBeCurrent: false
readonly property var delegateModel: model
@@ -30,7 +30,7 @@ HButton {
HLabel {
id: title
text: "Title"
text: "Missing title"
elide: Text.ElideRight
verticalAlignment: Qt.AlignVCenter
@@ -73,29 +73,22 @@ HButton {
children: [image, details].concat(additionalItems)
}
onIsCurrentChanged: if (isCurrent) highlightMe()
onHighlightMe: accountRoomList.currentIndex = model.index
onActivated: view.currentIndex = model.index
onClicked: {
ListView.highlightRangeMode = ListView.NoHighlightRange
ListView.highlightMoveDuration = 0
view.highlightRangeMode = ListView.NoHighlightRange
view.highlightMoveDuration = 0
activated()
ListView.highlightRangeMode = ListView.ApplyRange
ListView.highlightMoveDuration = theme.animationDuration
view.highlightRangeMode = ListView.ApplyRange
view.highlightMoveDuration = theme.animationDuration
}
Timer {
interval: 100
repeat: true
running: ListView.currentIndex == -1
running: view.currentIndex == -1
// Component.onCompleted won't work for this
onTriggered: if (isCurrent) highlightMe()
onTriggered: if (shouldBeCurrent) view.currentIndex = model.index
}
// Connections {
// target: ListView
// onHideHoverHighlight: tile.hovered = false
// }
}

View File

@@ -7,10 +7,6 @@ HListView {
id: accountRoomList
signal hideHoverHighlight()
onHideHoverHighlight: hoverBlocker.enabled = true
readonly property var originSource: window.sidePaneModelSource
readonly property var collapseAccounts: window.uiState.collapseAccounts
readonly property string filter: paneToolBar.roomFilter
@@ -62,14 +58,12 @@ HListView {
}
function previous(activate=true) {
hideHoverHighlight()
decrementCurrentIndex()
if (activate) activateLimiter.requestFire()
}
function next(activate=true) {
hideHoverHighlight()
incrementCurrentIndex()
if (activate) activateLimiter.requestFire()
}
@@ -106,22 +100,14 @@ HListView {
delegate: Loader {
width: accountRoomList.width
source: "Delegate" +
(model.type == "Account" ? "Account.qml" : "Room.qml")
Component.onCompleted: setSource(
model.type == "Account" ?
"DelegateAccount.qml" : "DelegateRoom.qml",
{view: accountRoomList}
)
}
MouseArea {
id: hoverBlocker
anchors.fill: parent
enabled: false
hoverEnabled: enabled
propagateComposedEvents: true
onMouseXChanged: enabled = false
onMouseYChanged: enabled = false
}
HRateLimiter {
id: filterLimiter
cooldown: 16

View File

@@ -8,12 +8,12 @@ HTileDelegate {
topPadding: model.index > 0 ? sidePane.currentSpacing / 2 : 0
bottomPadding: topPadding
backgroundColor: theme.sidePane.account.background
opacity: collapsed && ! forceExpand ?
theme.sidePane.account.collapsedOpacity : 1
isCurrent: window.uiState.page == "Pages/EditAccount/EditAccount.qml" &&
window.uiState.pageProperties.userId == model.data.user_id
shouldBeCurrent:
window.uiState.page == "Pages/EditAccount/EditAccount.qml" &&
window.uiState.pageProperties.userId == model.data.user_id
Behavior on opacity { HNumberAnimation {} }
@@ -52,9 +52,8 @@ HTileDelegate {
HButton {
id: expand
iconName: "expand"
ico.dimension: 16
backgroundColor: "transparent"
leftPadding: sidePane.currentSpacing / 1.5
padding: sidePane.currentSpacing / 1.5
rightPadding: leftPadding
onClicked: accountDelegate.toggleCollapse()
@@ -70,7 +69,5 @@ HTileDelegate {
}
Behavior on opacity { HNumberAnimation {} }
Layout.fillHeight: true
}
}

View File

@@ -8,9 +8,11 @@ HTileDelegate {
spacing: sidePane.currentSpacing
backgroundColor: theme.sidePane.room.background
opacity: model.data.left ? theme.sidePane.room.leftRoomOpacity : 1
isCurrent: window.uiState.page == "Chat/Chat.qml" &&
window.uiState.pageProperties.userId == model.user_id &&
window.uiState.pageProperties.roomId == model.data.room_id
shouldBeCurrent:
window.uiState.page == "Chat/Chat.qml" &&
window.uiState.pageProperties.userId == model.user_id &&
window.uiState.pageProperties.roomId == model.data.room_id
Behavior on opacity { HNumberAnimation {} }