refactor: don't make StatusChatList scrollable by default

This is because we ran into issues where some component compositions
caused scrollviews to be nested which rendered them non-functional.

For now we're rolling back the idea of components being smart enough
to become scrollable by themselves and have StatusQ consumers handle
scroll behaviour.
This commit is contained in:
Pascal Precht 2021-06-22 10:37:59 +02:00
parent e49b58b94d
commit 8a684a7d8a
No known key found for this signature in database
GPG Key ID: 0EE28D8D6FD85D7D
2 changed files with 63 additions and 51 deletions

View File

@ -173,13 +173,13 @@ Rectangle {
text: "Chat" text: "Chat"
} }
StatusChatListAndCategories { StatusChatList {
anchors.top: headline.bottom anchors.top: headline.bottom
anchors.topMargin: 16 anchors.topMargin: 16
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
width: parent.width anchors.horizontalCenter: parent.horizontalCenter
chatList.model: demoChatListItems chatListItems.model: demoChatListItems
selectedChatId: "0" selectedChatId: "0"
onChatItemSelected: selectedChatId = id onChatItemSelected: selectedChatId = id
onChatItemUnmuted: { onChatItemUnmuted: {
@ -247,6 +247,7 @@ Rectangle {
StatusAppTwoPanelLayout { StatusAppTwoPanelLayout {
leftPanel: Item { leftPanel: Item {
id: leftPanel
anchors.fill: parent anchors.fill: parent
StatusChatInfoToolBar { StatusChatInfoToolBar {
@ -255,7 +256,7 @@ Rectangle {
anchors.top: parent.top anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
chatInfoButton.title: "Cryptokitties" chatInfoButton.title: "CryptoKitties"
chatInfoButton.subTitle: "128 Members" chatInfoButton.subTitle: "128 Members"
chatInfoButton.image.source: "https://pbs.twimg.com/profile_images/1369221718338895873/T_5fny6o_400x400.jpg" chatInfoButton.image.source: "https://pbs.twimg.com/profile_images/1369221718338895873/T_5fny6o_400x400.jpg"
chatInfoButton.icon.color: Theme.palette.miscColor6 chatInfoButton.icon.color: Theme.palette.miscColor6
@ -283,11 +284,21 @@ Rectangle {
} }
} }
StatusChatListAndCategories { ScrollView {
id: scrollView
anchors.top: statusChatInfoToolBar.bottom anchors.top: statusChatInfoToolBar.bottom
anchors.topMargin: 8 anchors.topMargin: 8
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
width: parent.width width: leftPanel.width
contentHeight: communityCategories.height
clip: true
StatusChatListAndCategories {
id: communityCategories
height: implicitHeight > (leftPanel.height - 64) ? implicitHeight + 8 : leftPanel.height - 64
width: leftPanel.width
chatList.model: demoCommunityChatListItems chatList.model: demoCommunityChatListItems
categoryList.model: demoCommunityCategoryItems categoryList.model: demoCommunityCategoryItems
@ -344,6 +355,7 @@ Rectangle {
} }
} }
} }
}
rightPanel: Item { rightPanel: Item {
anchors.fill: parent anchors.fill: parent

View File

@ -4,11 +4,11 @@ import QtQuick.Controls 2.14
import StatusQ.Components 0.1 import StatusQ.Components 0.1
import StatusQ.Popups 0.1 import StatusQ.Popups 0.1
ScrollView { Item {
id: statusChatListAndCategories id: statusChatListAndCategories
clip: true implicitHeight: chatListsAndCategories.height
contentHeight: chatListsAndCategories.height + 8 implicitWidth: chatListsAndCategories.width
property string selectedChatId: "" property string selectedChatId: ""
property bool showCategoryActionButtons: false property bool showCategoryActionButtons: false
@ -32,7 +32,7 @@ ScrollView {
MouseArea { MouseArea {
id: sensor id: sensor
anchors.top: parent.top anchors.top: parent.top
width: parent.width width: statusChatListAndCategories.width
height: statusChatListAndCategories.height height: statusChatListAndCategories.height
acceptedButtons: Qt.LeftButton | Qt.RightButton acceptedButtons: Qt.LeftButton | Qt.RightButton
onClicked: { onClicked: {