mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-26 04:58:49 +03:00
Only show reply button and option button on hover
This commit is contained in:
parent
bed8c52891
commit
505a8b5742
1 changed files with 113 additions and 77 deletions
|
@ -7,13 +7,46 @@ import im.nheko 1.0
|
||||||
|
|
||||||
import "./delegates"
|
import "./delegates"
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: rowArea
|
||||||
|
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
height: row.height
|
||||||
|
|
||||||
|
hoverEnabled: true
|
||||||
|
preventStealing: true
|
||||||
|
propagateComposedEvents: true
|
||||||
|
acceptedButtons: Qt.NoButton
|
||||||
|
|
||||||
|
property bool showButtons: false
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
running: rowArea.containsMouse
|
||||||
|
interval: 150
|
||||||
|
onTriggered: rowArea.state = "showButtons"
|
||||||
|
}
|
||||||
|
|
||||||
|
states: [
|
||||||
|
State {
|
||||||
|
name: "hideButtons"
|
||||||
|
when: !rowArea.containsMouse
|
||||||
|
PropertyChanges { target: rowArea; showButtons: false; }
|
||||||
|
},
|
||||||
|
State {
|
||||||
|
name: "showButtons"
|
||||||
|
PropertyChanges { target: rowArea; showButtons: true; }
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
property var view: chat
|
id: row
|
||||||
|
|
||||||
anchors.leftMargin: avatarSize + 4
|
anchors.leftMargin: avatarSize + 4
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
|
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.alignment: Qt.AlignTop
|
Layout.alignment: Qt.AlignTop
|
||||||
|
@ -36,21 +69,8 @@ RowLayout {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StatusIndicator {
|
|
||||||
state: model.state
|
|
||||||
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
|
||||||
Layout.preferredHeight: 16
|
|
||||||
width: 16
|
|
||||||
}
|
|
||||||
|
|
||||||
EncryptionIndicator {
|
|
||||||
visible: model.isEncrypted
|
|
||||||
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
|
||||||
Layout.preferredHeight: 16
|
|
||||||
width: 16
|
|
||||||
}
|
|
||||||
|
|
||||||
ImageButton {
|
ImageButton {
|
||||||
|
visible: rowArea.showButtons
|
||||||
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
||||||
Layout.preferredHeight: 16
|
Layout.preferredHeight: 16
|
||||||
width: 16
|
width: 16
|
||||||
|
@ -63,9 +83,10 @@ RowLayout {
|
||||||
ToolTip.visible: hovered
|
ToolTip.visible: hovered
|
||||||
ToolTip.text: qsTr("Reply")
|
ToolTip.text: qsTr("Reply")
|
||||||
|
|
||||||
onClicked: view.model.replyAction(model.id)
|
onClicked: chat.model.replyAction(model.id)
|
||||||
}
|
}
|
||||||
ImageButton {
|
ImageButton {
|
||||||
|
visible: rowArea.showButtons
|
||||||
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
||||||
Layout.preferredHeight: 16
|
Layout.preferredHeight: 16
|
||||||
width: 16
|
width: 16
|
||||||
|
@ -81,6 +102,20 @@ RowLayout {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StatusIndicator {
|
||||||
|
state: model.state
|
||||||
|
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
||||||
|
Layout.preferredHeight: 16
|
||||||
|
width: 16
|
||||||
|
}
|
||||||
|
|
||||||
|
EncryptionIndicator {
|
||||||
|
visible: model.isEncrypted
|
||||||
|
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
||||||
|
Layout.preferredHeight: 16
|
||||||
|
width: 16
|
||||||
|
}
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
||||||
text: model.timestamp.toLocaleTimeString("HH:mm")
|
text: model.timestamp.toLocaleTimeString("HH:mm")
|
||||||
|
@ -96,3 +131,4 @@ RowLayout {
|
||||||
ToolTip.text: Qt.formatDateTime(model.timestamp, Qt.DefaultLocaleLongDate)
|
ToolTip.text: Qt.formatDateTime(model.timestamp, Qt.DefaultLocaleLongDate)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue