Add scrollbars to flickable and listviews

This commit is contained in:
miruka 2019-07-20 15:06:38 -04:00
parent 1ffca37021
commit d033ea84e8
8 changed files with 45 additions and 25 deletions

View File

@ -0,0 +1,28 @@
// Copyright 2019 miruka
// This file is part of harmonyqml, licensed under LGPLv3.
import QtQuick 2.12
import QtQuick.Controls 2.12
ListView {
add: Transition {
HNumberAnimation { properties: "x,y"; from: 100 }
}
move: Transition {
HNumberAnimation { properties: "x,y" }
}
displaced: Transition {
HNumberAnimation { properties: "x,y" }
}
remove: Transition {
ParallelAnimation {
HNumberAnimation { property: "opacity"; to: 0 }
HNumberAnimation { properties: "x,y"; to: 100 }
}
}
interactive: false
}

View File

@ -0,0 +1,10 @@
// Copyright 2019 miruka
// This file is part of harmonyqml, licensed under LGPLv3.
import QtQuick 2.12
import QtQuick.Controls 2.12
Flickable {
interactive: contentWidth > width || contentHeight > height
ScrollBar.vertical: ScrollBar {}
}

View File

@ -2,24 +2,9 @@
// This file is part of harmonyqml, licensed under LGPLv3. // This file is part of harmonyqml, licensed under LGPLv3.
import QtQuick 2.12 import QtQuick 2.12
import QtQuick.Controls 2.12
ListView { HFixedListView {
add: Transition { interactive: true
HNumberAnimation { properties: "x,y"; from: 100 } ScrollBar.vertical: ScrollBar {}
}
move: Transition {
HNumberAnimation { properties: "x,y" }
}
displaced: Transition {
HNumberAnimation { properties: "x,y" }
}
remove: Transition {
ParallelAnimation {
HNumberAnimation { property: "opacity"; to: 0 }
HNumberAnimation { properties: "x,y"; to: 100 }
}
}
} }

View File

@ -72,13 +72,12 @@ SwipeView {
rightPadding: leftPadding rightPadding: leftPadding
Behavior on leftPadding { HNumberAnimation {} } Behavior on leftPadding { HNumberAnimation {} }
Flickable { HFlickable {
id: innerFlickable id: innerFlickable
anchors.fill: parent anchors.fill: parent
clip: true clip: true
contentWidth: parent.width contentWidth: parent.width
contentHeight: contentColumn.childrenRect.height contentHeight: contentColumn.childrenRect.height
interactive: contentWidth > width || contentHeight > height
HColumnLayout { HColumnLayout {
id: contentColumn id: contentColumn

View File

@ -81,7 +81,6 @@ Column {
RoomCategoriesList { RoomCategoriesList {
id: roomCategoriesList id: roomCategoriesList
interactive: false // no scrolling
visible: height > 0 visible: height > 0
width: parent.width width: parent.width
height: childrenRect.height * (accountDelegate.expanded ? 1 : 0) height: childrenRect.height * (accountDelegate.expanded ? 1 : 0)

View File

@ -6,7 +6,7 @@ import QtQuick.Layouts 1.12
import SortFilterProxyModel 0.2 import SortFilterProxyModel 0.2
import "../Base" import "../Base"
HListView { HFixedListView {
property string userId: "" property string userId: ""
id: roomCategoriesList id: roomCategoriesList

View File

@ -41,7 +41,6 @@ Column {
RoomList { RoomList {
id: roomList id: roomList
interactive: false // no scrolling
visible: height > 0 visible: height > 0
width: roomCategoriesList.width - accountList.Layout.leftMargin width: roomCategoriesList.width - accountList.Layout.leftMargin
opacity: roomCategoryDelegate.expanded ? 1 : 0 opacity: roomCategoryDelegate.expanded ? 1 : 0

View File

@ -7,7 +7,7 @@ import SortFilterProxyModel 0.2
import "../Base" import "../Base"
import "../utils.js" as Utils import "../utils.js" as Utils
HListView { HFixedListView {
id: roomList id: roomList
property string userId: "" property string userId: ""