Add scrollbars to flickable and listviews
This commit is contained in:
parent
1ffca37021
commit
d033ea84e8
28
src/qml/Base/HFixedListView.qml
Normal file
28
src/qml/Base/HFixedListView.qml
Normal 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
|
||||||
|
}
|
10
src/qml/Base/HFlickable.qml
Normal file
10
src/qml/Base/HFlickable.qml
Normal 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 {}
|
||||||
|
}
|
|
@ -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 }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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: ""
|
||||||
|
|
Loading…
Reference in New Issue
Block a user