summary refs log tree commit diff
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2019-12-08 00:54:28 +0100
committerNicolas Werner <nicolas.werner@hotmail.de>2019-12-08 00:54:28 +0100
commit8c44c5e2d0360e73a1ee534f9ffa46a24c1bc059 (patch)
tree7bf32ee82a9e15fdffd55f330e3a6ea1536c5460
parentTry to fix binding loop warning (diff)
downloadnheko-8c44c5e2d0360e73a1ee534f9ffa46a24c1bc059.tar.xz
Change scroll behaviour of timeline
This requires Qt 5.9 (to calculate overshoot).
The default scroll behaviour of list views has far too much inertia.
This should make scrolling feel more like scrolling the other scroll
areas of nheko.
-rw-r--r--.travis.yml4
-rw-r--r--README.md4
-rw-r--r--resources/qml/TimelineView.qml25
3 files changed, 28 insertions, 5 deletions
diff --git a/.travis.yml b/.travis.yml

index b6112eb1..4ab6408a 100644 --- a/.travis.yml +++ b/.travis.yml
@@ -43,8 +43,8 @@ matrix: env: - CXX_COMPILER=g++-8 - C_COMPILER=gcc-8 - - QT_VERSION=58 - - QT_PKG=58 + - QT_VERSION=592 + - QT_PKG=59 - USE_BUNDLED_BOOST=1 - USE_BUNDLED_CMARK=1 - USE_BUNDLED_JSON=1 diff --git a/README.md b/README.md
index 0380a90a..1179463d 100644 --- a/README.md +++ b/README.md
@@ -89,7 +89,7 @@ sudo port install nheko ### Build Requirements -- Qt5 (5.8 or greater). Qt 5.7 adds support for color font rendering with +- Qt5 (5.9 or greater). Qt 5.7 adds support for color font rendering with Freetype, which is essential to properly support emoji, 5.8 adds some features to make interopability with Qml easier. - CMake 3.15 or greater. (Lower version may work, but may break boost linking) @@ -132,7 +132,7 @@ sudo pacman -S qt5-base \ ##### Gentoo Linux ```bash -sudo emerge -a ">=dev-qt/qtgui-5.7.1" media-libs/fontconfig +sudo emerge -a ">=dev-qt/qtgui-5.9.0" media-libs/fontconfig ``` ##### Ubuntu (e.g 14.04) diff --git a/resources/qml/TimelineView.qml b/resources/qml/TimelineView.qml
index 0defa282..238f21c7 100644 --- a/resources/qml/TimelineView.qml +++ b/resources/qml/TimelineView.qml
@@ -1,4 +1,4 @@ -import QtQuick 2.6 +import QtQuick 2.9 import QtQuick.Controls 2.1 import QtQuick.Layouts 1.2 import QtGraphicalEffects 1.0 @@ -46,6 +46,29 @@ Item { model: timelineManager.timeline + boundsBehavior: Flickable.StopAtBounds + + onVerticalOvershootChanged: contentY = contentY - verticalOvershoot + + MouseArea { + anchors.fill: parent + acceptedButtons: Qt.NoButton + propagateComposedEvents: true + z: -1 + onWheel: { + if (wheel.angleDelta != 0) { + chat.contentY = chat.contentY - wheel.angleDelta.y + if (wheel.angleDelta.y > 0 && chat.contentY > chat.contentHeight - chat.height) + chat.contentY = chat.contentHeight - chat.height + else if (wheel.angleDelta < 0 && chat.contentY < 0) + chat.contentY = 0 + wheel.accepted = true + chat.forceLayout() + chat.updatePosition() + } + } + } + onModelChanged: { if (model) { currentIndex = model.currentIndex