mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 11:00:48 +03:00
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.
This commit is contained in:
parent
05aa7f948a
commit
8c44c5e2d0
3 changed files with 28 additions and 5 deletions
|
@ -43,8 +43,8 @@ matrix:
|
||||||
env:
|
env:
|
||||||
- CXX_COMPILER=g++-8
|
- CXX_COMPILER=g++-8
|
||||||
- C_COMPILER=gcc-8
|
- C_COMPILER=gcc-8
|
||||||
- QT_VERSION=58
|
- QT_VERSION=592
|
||||||
- QT_PKG=58
|
- QT_PKG=59
|
||||||
- USE_BUNDLED_BOOST=1
|
- USE_BUNDLED_BOOST=1
|
||||||
- USE_BUNDLED_CMARK=1
|
- USE_BUNDLED_CMARK=1
|
||||||
- USE_BUNDLED_JSON=1
|
- USE_BUNDLED_JSON=1
|
||||||
|
|
|
@ -89,7 +89,7 @@ sudo port install nheko
|
||||||
|
|
||||||
### Build Requirements
|
### 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
|
Freetype, which is essential to properly support emoji, 5.8 adds some features
|
||||||
to make interopability with Qml easier.
|
to make interopability with Qml easier.
|
||||||
- CMake 3.15 or greater. (Lower version may work, but may break boost linking)
|
- 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
|
##### Gentoo Linux
|
||||||
|
|
||||||
```bash
|
```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)
|
##### Ubuntu (e.g 14.04)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import QtQuick 2.6
|
import QtQuick 2.9
|
||||||
import QtQuick.Controls 2.1
|
import QtQuick.Controls 2.1
|
||||||
import QtQuick.Layouts 1.2
|
import QtQuick.Layouts 1.2
|
||||||
import QtGraphicalEffects 1.0
|
import QtGraphicalEffects 1.0
|
||||||
|
@ -46,6 +46,29 @@ Item {
|
||||||
|
|
||||||
model: timelineManager.timeline
|
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: {
|
onModelChanged: {
|
||||||
if (model) {
|
if (model) {
|
||||||
currentIndex = model.currentIndex
|
currentIndex = model.currentIndex
|
||||||
|
|
Loading…
Reference in a new issue