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.
remotes/origin/0.7.0-dev
Nicolas Werner 5 years ago
parent 05aa7f948a
commit 8c44c5e2d0
  1. 4
      .travis.yml
  2. 4
      README.md
  3. 25
      resources/qml/TimelineView.qml

@ -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

@ -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)

@ -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

Loading…
Cancel
Save