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.
|
||||
|
||||
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 }
|
||||
}
|
||||
}
|
||||
HFixedListView {
|
||||
interactive: true
|
||||
ScrollBar.vertical: ScrollBar {}
|
||||
}
|
||||
|
|
|
@ -72,13 +72,12 @@ SwipeView {
|
|||
rightPadding: leftPadding
|
||||
Behavior on leftPadding { HNumberAnimation {} }
|
||||
|
||||
Flickable {
|
||||
HFlickable {
|
||||
id: innerFlickable
|
||||
anchors.fill: parent
|
||||
clip: true
|
||||
contentWidth: parent.width
|
||||
contentHeight: contentColumn.childrenRect.height
|
||||
interactive: contentWidth > width || contentHeight > height
|
||||
|
||||
HColumnLayout {
|
||||
id: contentColumn
|
||||
|
|
|
@ -81,7 +81,6 @@ Column {
|
|||
|
||||
RoomCategoriesList {
|
||||
id: roomCategoriesList
|
||||
interactive: false // no scrolling
|
||||
visible: height > 0
|
||||
width: parent.width
|
||||
height: childrenRect.height * (accountDelegate.expanded ? 1 : 0)
|
||||
|
|
|
@ -6,7 +6,7 @@ import QtQuick.Layouts 1.12
|
|||
import SortFilterProxyModel 0.2
|
||||
import "../Base"
|
||||
|
||||
HListView {
|
||||
HFixedListView {
|
||||
property string userId: ""
|
||||
|
||||
id: roomCategoriesList
|
||||
|
|
|
@ -41,7 +41,6 @@ Column {
|
|||
|
||||
RoomList {
|
||||
id: roomList
|
||||
interactive: false // no scrolling
|
||||
visible: height > 0
|
||||
width: roomCategoriesList.width - accountList.Layout.leftMargin
|
||||
opacity: roomCategoryDelegate.expanded ? 1 : 0
|
||||
|
|
|
@ -7,7 +7,7 @@ import SortFilterProxyModel 0.2
|
|||
import "../Base"
|
||||
import "../utils.js" as Utils
|
||||
|
||||
HListView {
|
||||
HFixedListView {
|
||||
id: roomList
|
||||
|
||||
property string userId: ""
|
||||
|
|
Loading…
Reference in New Issue
Block a user