diff options
author | Nicolas Werner <nicolas.werner@hotmail.de> | 2023-06-02 01:36:01 +0200 |
---|---|---|
committer | Nicolas Werner <nicolas.werner@hotmail.de> | 2023-06-08 22:32:08 +0200 |
commit | c25d0c6b2f30731b108e99c6ceccd925d764eb56 (patch) | |
tree | c7c718bde72a07d5d147fe2ee28949f336cb5478 /resources/qml | |
parent | Fix palette access and QMediaPlayer errors (diff) | |
download | nheko-c25d0c6b2f30731b108e99c6ceccd925d764eb56.tar.xz |
Get rid of scrollhelper
Diffstat (limited to 'resources/qml')
-rw-r--r-- | resources/qml/CommunitiesList.qml | 6 | ||||
-rw-r--r-- | resources/qml/Completer.qml | 5 | ||||
-rw-r--r-- | resources/qml/MessageView.qml | 5 | ||||
-rw-r--r-- | resources/qml/RoomList.qml | 5 | ||||
-rw-r--r-- | resources/qml/ScrollHelper.qml | 96 | ||||
-rw-r--r-- | resources/qml/TopBar.qml | 10 | ||||
-rw-r--r-- | resources/qml/components/ReorderableListview.qml | 4 | ||||
-rw-r--r-- | resources/qml/dialogs/AliasEditor.qml | 4 | ||||
-rw-r--r-- | resources/qml/dialogs/AllowedRoomsSettingsDialog.qml | 4 | ||||
-rw-r--r-- | resources/qml/dialogs/ImagePackEditorDialog.qml | 5 | ||||
-rw-r--r-- | resources/qml/dialogs/ImagePackSettingsDialog.qml | 11 | ||||
-rw-r--r-- | resources/qml/dialogs/PowerLevelSpacesApplyDialog.qml | 5 | ||||
-rw-r--r-- | resources/qml/dialogs/RoomDirectory.qml | 5 | ||||
-rw-r--r-- | resources/qml/dialogs/RoomMembers.qml | 5 | ||||
-rw-r--r-- | resources/qml/dialogs/RoomSettings.qml | 5 | ||||
-rw-r--r-- | resources/qml/dialogs/UserProfile.qml | 6 | ||||
-rw-r--r-- | resources/qml/emoji/StickerPicker.qml | 6 |
17 files changed, 2 insertions, 185 deletions
diff --git a/resources/qml/CommunitiesList.qml b/resources/qml/CommunitiesList.qml index 5bf239a6..a210a4bb 100644 --- a/resources/qml/CommunitiesList.qml +++ b/resources/qml/CommunitiesList.qml @@ -39,12 +39,6 @@ Page { parent: !collapsed && Settings.scrollbarsInRoomlist ? communitiesList : null } - ScrollHelper { - flickable: parent - anchors.fill: parent - enabled: !Settings.mobileMode - } - Platform.Menu { id: communityContextMenu diff --git a/resources/qml/Completer.qml b/resources/qml/Completer.qml index 95bebc1b..02dccfc9 100644 --- a/resources/qml/Completer.qml +++ b/resources/qml/Completer.qml @@ -97,11 +97,6 @@ Control { // that until we find something better. Put is all together and you have the formula below! implicitHeight: Math.min(contentHeight, 6*rowSpacing + 7*(popup.avatarHeight + 2*rowMargin)) clip: true - ScrollHelper { - flickable: parent - anchors.fill: parent - enabled: !Settings.mobileMode - } Timer { id: deadTimer diff --git a/resources/qml/MessageView.qml b/resources/qml/MessageView.qml index b35db9ac..158bc236 100644 --- a/resources/qml/MessageView.qml +++ b/resources/qml/MessageView.qml @@ -252,11 +252,6 @@ Item { } - ScrollHelper { - flickable: parent - anchors.fill: parent - } - Shortcut { sequence: StandardKey.MoveToPreviousPage onActivated: { diff --git a/resources/qml/RoomList.qml b/resources/qml/RoomList.qml index 733063f9..851608b6 100644 --- a/resources/qml/RoomList.qml +++ b/resources/qml/RoomList.qml @@ -63,11 +63,6 @@ Page { parent: !collapsed && Settings.scrollbarsInRoomlist ? roomlist : null } - ScrollHelper { - flickable: parent - anchors.fill: parent - } - Connections { function onCurrentRoomChanged() { if (Rooms.currentRoom) diff --git a/resources/qml/ScrollHelper.qml b/resources/qml/ScrollHelper.qml deleted file mode 100644 index 04d060ec..00000000 --- a/resources/qml/ScrollHelper.qml +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (C) 2016 Michael Bohlender, <michael.bohlender@kdemail.net> -// Copyright (C) 2017 Christian Mollekopf, <mollekopf@kolabsystems.com> -// SPDX-FileCopyrightText: Nheko Contributors -// -// SPDX-License-Identifier: GPL-3.0-or-later - -/* -* Shamelessly stolen from: -* https://cgit.kde.org/kube.git/tree/framework/qml/ScrollHelper.qml -* -* The MouseArea + interactive: false + maximumFlickVelocity are required -* to fix scrolling for desktop systems where we don't want flicking behaviour. -* -* See also: -* ScrollView.qml in qtquickcontrols -* qquickwheelarea.cpp in qtquickcontrols -*/ - -import QtQuick 2.9 -import QtQuick.Controls 2.3 - -MouseArea { - // console.warn("Delta: ", wheel.pixelDelta.y); - // console.warn("Old position: ", flickable.contentY); - // console.warn("New position: ", newPos); - // breaks ListView's with headers... - //if (typeof (flickableItem.headerItem) !== "undefined" && flickableItem.headerItem) - // minYExtent += flickableItem.headerItem.height; - - id: root - - property Flickable flickable - property alias enabled: root.enabled - - function calculateNewPosition(flickableItem, wheel) { - //Nothing to scroll - if (flickableItem.contentHeight < flickableItem.height) - return flickableItem.contentY; - - //Ignore 0 events (happens at least with Christians trackpad) - if (wheel.pixelDelta.y == 0 && wheel.angleDelta.y == 0) - return flickableItem.contentY; - - //pixelDelta seems to be the same as angleDelta/8 - var pixelDelta = 0; - //The pixelDelta is a smaller number if both are provided, so pixelDelta can be 0 while angleDelta is still something. So we check the angleDelta - if (wheel.angleDelta.y) { - var wheelScrollLines = 3; //Default value of QApplication wheelScrollLines property - var pixelPerLine = 20; //Default value in Qt, originally comes from QTextEdit - var ticks = (wheel.angleDelta.y / 8) / 15; //Divide by 8 gives us pixels typically come in 15pixel steps. - pixelDelta = ticks * pixelPerLine * wheelScrollLines; - } else { - pixelDelta = wheel.pixelDelta.y; - } - pixelDelta = Math.round(pixelDelta); - if (!pixelDelta) - return flickableItem.contentY; - - var minYExtent = flickableItem.originY + flickableItem.topMargin; - var maxYExtent = (flickableItem.contentHeight + flickableItem.bottomMargin + flickableItem.originY) - flickableItem.height; - //Avoid overscrolling - return Math.max(minYExtent, Math.min(maxYExtent, flickableItem.contentY - pixelDelta)); - } - - propagateComposedEvents: true - //Place the mouse area under the flickable - z: -1 - onFlickableChanged: { - if (enabled) { - flickable.maximumFlickVelocity = 100000; - flickable.boundsBehavior = Flickable.StopAtBounds; - root.parent = flickable; - } - } - acceptedButtons: Qt.NoButton - onWheel: { - var newPos = calculateNewPosition(flickable, wheel); - // Show the scrollbars - flickable.flick(0, 0); - flickable.contentY = newPos; - cancelFlickStateTimer.restart(); - } - - Timer { - id: cancelFlickStateTimer - - //How long the scrollbar will remain visible - interval: 500 - // Hide the scrollbars - onTriggered: { - flickable.cancelFlick(); - flickable.movementEnded(); - } - } - -} diff --git a/resources/qml/TopBar.qml b/resources/qml/TopBar.qml index eaaa38ea..a54c5ed7 100644 --- a/resources/qml/TopBar.qml +++ b/resources/qml/TopBar.qml @@ -408,11 +408,6 @@ Pane { } - ScrollHelper { - flickable: parent - anchors.fill: parent - enabled: !Settings.mobileMode - } } } @@ -443,11 +438,6 @@ Pane { } - ScrollHelper { - flickable: parent - anchors.fill: parent - enabled: !Settings.mobileMode - } } } diff --git a/resources/qml/components/ReorderableListview.qml b/resources/qml/components/ReorderableListview.qml index 4e67082e..1e8ab7b0 100644 --- a/resources/qml/components/ReorderableListview.qml +++ b/resources/qml/components/ReorderableListview.qml @@ -105,10 +105,6 @@ Item { clip: true anchors { fill: parent; margins: 2 } - ScrollHelper { - flickable: parent - anchors.fill: parent - } model: visualModel diff --git a/resources/qml/dialogs/AliasEditor.qml b/resources/qml/dialogs/AliasEditor.qml index 32efff22..c49ad321 100644 --- a/resources/qml/dialogs/AliasEditor.qml +++ b/resources/qml/dialogs/AliasEditor.qml @@ -53,10 +53,6 @@ ApplicationWindow { clip: true - ScrollHelper { - flickable: parent - anchors.fill: parent - } model: editingModel spacing: 4 diff --git a/resources/qml/dialogs/AllowedRoomsSettingsDialog.qml b/resources/qml/dialogs/AllowedRoomsSettingsDialog.qml index 94ecf651..89ea5e04 100644 --- a/resources/qml/dialogs/AllowedRoomsSettingsDialog.qml +++ b/resources/qml/dialogs/AllowedRoomsSettingsDialog.qml @@ -53,10 +53,6 @@ ApplicationWindow { clip: true - ScrollHelper { - flickable: parent - anchors.fill: parent - } model: roomSettings.allowedRoomsModel spacing: 4 diff --git a/resources/qml/dialogs/ImagePackEditorDialog.qml b/resources/qml/dialogs/ImagePackEditorDialog.qml index 9e848150..4cb2c1f6 100644 --- a/resources/qml/dialogs/ImagePackEditorDialog.qml +++ b/resources/qml/dialogs/ImagePackEditorDialog.qml @@ -49,11 +49,6 @@ ApplicationWindow { model: imagePack - ScrollHelper { - flickable: parent - anchors.fill: parent - enabled: !Settings.mobileMode - } header: AvatarListTile { title: imagePack.packname diff --git a/resources/qml/dialogs/ImagePackSettingsDialog.qml b/resources/qml/dialogs/ImagePackSettingsDialog.qml index 31a34c94..b7aab2a6 100644 --- a/resources/qml/dialogs/ImagePackSettingsDialog.qml +++ b/resources/qml/dialogs/ImagePackSettingsDialog.qml @@ -55,11 +55,7 @@ ApplicationWindow { model: packlist clip: true - ScrollHelper { - flickable: parent - anchors.fill: parent - enabled: !Settings.mobileMode - } + footer: ColumnLayout { Button { @@ -217,11 +213,6 @@ ApplicationWindow { currentIndex: -1 // prevent sorting from stealing focus cacheBuffer: 500 - ScrollHelper { - flickable: parent - anchors.fill: parent - enabled: !Settings.mobileMode - } // Individual emoji delegate: AbstractButton { diff --git a/resources/qml/dialogs/PowerLevelSpacesApplyDialog.qml b/resources/qml/dialogs/PowerLevelSpacesApplyDialog.qml index 3f816143..01ec8b61 100644 --- a/resources/qml/dialogs/PowerLevelSpacesApplyDialog.qml +++ b/resources/qml/dialogs/PowerLevelSpacesApplyDialog.qml @@ -84,11 +84,6 @@ ApplicationWindow { clip: true - ScrollHelper { - flickable: parent - anchors.fill: parent - } - model: editingModel.spaces spacing: 4 cacheBuffer: 50 diff --git a/resources/qml/dialogs/RoomDirectory.qml b/resources/qml/dialogs/RoomDirectory.qml index 29adb9be..a6f53d2e 100644 --- a/resources/qml/dialogs/RoomDirectory.qml +++ b/resources/qml/dialogs/RoomDirectory.qml @@ -34,11 +34,6 @@ ApplicationWindow { anchors.fill: parent model: publicRooms - ScrollHelper { - flickable: parent - anchors.fill: parent - } - delegate: Rectangle { id: roomDirDelegate diff --git a/resources/qml/dialogs/RoomMembers.qml b/resources/qml/dialogs/RoomMembers.qml index 4952a0a9..916c6c86 100644 --- a/resources/qml/dialogs/RoomMembers.qml +++ b/resources/qml/dialogs/RoomMembers.qml @@ -106,11 +106,6 @@ ApplicationWindow { boundsBehavior: Flickable.StopAtBounds model: members - ScrollHelper { - flickable: parent - anchors.fill: parent - enabled: !Settings.mobileMode - } delegate: ItemDelegate { id: del diff --git a/resources/qml/dialogs/RoomSettings.qml b/resources/qml/dialogs/RoomSettings.qml index 6bc24058..0fa98fff 100644 --- a/resources/qml/dialogs/RoomSettings.qml +++ b/resources/qml/dialogs/RoomSettings.qml @@ -29,10 +29,7 @@ ApplicationWindow { sequence: StandardKey.Cancel onActivated: roomSettingsDialog.close() } - ScrollHelper { - flickable: flickable - anchors.fill: flickable - } + Flickable { id: flickable boundsBehavior: Flickable.StopAtBounds diff --git a/resources/qml/dialogs/UserProfile.qml b/resources/qml/dialogs/UserProfile.qml index dae43caa..b54b52a4 100644 --- a/resources/qml/dialogs/UserProfile.qml +++ b/resources/qml/dialogs/UserProfile.qml @@ -46,12 +46,6 @@ ApplicationWindow { anchors.margins: 10 footerPositioning: ListView.OverlayFooter - ScrollHelper { - flickable: parent - anchors.fill: parent - enabled: !Settings.mobileMode - } - header: ColumnLayout { id: contentL diff --git a/resources/qml/emoji/StickerPicker.qml b/resources/qml/emoji/StickerPicker.qml index b1623697..62d56a18 100644 --- a/resources/qml/emoji/StickerPicker.qml +++ b/resources/qml/emoji/StickerPicker.qml @@ -137,12 +137,6 @@ Menu { spacing: Nheko.paddingSmall - ScrollHelper { - flickable: parent - anchors.fill: parent - enabled: !Settings.mobileMode - } - // Individual emoji delegate: Row { required property var row; |