From a7b7c1c012a916b61687be810a43868ab1b75c46 Mon Sep 17 00:00:00 2001 From: Camila Ayres Date: Wed, 5 Feb 2025 21:29:15 +0100 Subject: [PATCH] Add button to scroll to top when activity list is long. Signed-off-by: Camila Ayres --- src/gui/tray/ActivityList.qml | 22 ++++++++++++++++++++++ theme.qrc.in | 1 + theme/chevron-double-up.svg | 1 + 3 files changed, 24 insertions(+) create mode 100644 theme/chevron-double-up.svg diff --git a/src/gui/tray/ActivityList.qml b/src/gui/tray/ActivityList.qml index 99935b48f2ab1..c5196948d5632 100644 --- a/src/gui/tray/ActivityList.qml +++ b/src/gui/tray/ActivityList.qml @@ -114,6 +114,28 @@ ScrollView { } } + Button { + id: scrollToTopButton + + anchors.bottom: parent.bottom + anchors.right: parent.right + + hoverEnabled: true + padding: Style.smallSpacing + + Accessible.role: Accessible.Button + Accessible.name: qsTr("Scroll to top") + Accessible.onPressAction: scrollToTopButton.clicked() + + icon.source: "image://svgimage-custom-color/chevron-double-up.svg/" + palette.buttonText + icon.width: Style.activityListButtonIconSize + icon.height: Style.activityListButtonIconSize + + onClicked: controlRoot.scrollToTop() + + visible: !controlRoot.atYBeginning && controlRoot.contentHeight > controlRoot.height + } + Column { id: placeholderColumn width: parent.width * 0.8 diff --git a/theme.qrc.in b/theme.qrc.in index 9bb04975573f2..5f0b5b417582d 100644 --- a/theme.qrc.in +++ b/theme.qrc.in @@ -241,5 +241,6 @@ theme/send.svg theme/call-notification.wav theme/talk-app.svg + theme/chevron-double-up.svg diff --git a/theme/chevron-double-up.svg b/theme/chevron-double-up.svg new file mode 100644 index 0000000000000..3166c1750a358 --- /dev/null +++ b/theme/chevron-double-up.svg @@ -0,0 +1 @@ + \ No newline at end of file