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 committed by Michał Cieślak
parent eab95c1c7b
commit 11e6429068
2 changed files with 63 additions and 51 deletions

View File

@ -173,13 +173,13 @@ Rectangle {
text: "Chat"
}
StatusChatListAndCategories {
StatusChatList {
anchors.top: headline.bottom
anchors.topMargin: 16
anchors.bottom: parent.bottom
width: parent.width
anchors.horizontalCenter: parent.horizontalCenter
chatList.model: demoChatListItems
chatListItems.model: demoChatListItems
selectedChatId: "0"
onChatItemSelected: selectedChatId = id
onChatItemUnmuted: {
@ -247,6 +247,7 @@ Rectangle {
StatusAppTwoPanelLayout {
leftPanel: Item {
id: leftPanel
anchors.fill: parent
StatusChatInfoToolBar {
@ -255,7 +256,7 @@ Rectangle {
anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter
chatInfoButton.title: "Cryptokitties"
chatInfoButton.title: "CryptoKitties"
chatInfoButton.subTitle: "128 Members"
chatInfoButton.image.source: "https://pbs.twimg.com/profile_images/1369221718338895873/T_5fny6o_400x400.jpg"
chatInfoButton.icon.color: Theme.palette.miscColor6
@ -283,63 +284,74 @@ Rectangle {
}
}
StatusChatListAndCategories {
ScrollView {
id: scrollView
anchors.top: statusChatInfoToolBar.bottom
anchors.topMargin: 8
anchors.bottom: parent.bottom
width: parent.width
width: leftPanel.width
chatList.model: demoCommunityChatListItems
categoryList.model: demoCommunityCategoryItems
contentHeight: communityCategories.height
clip: true
showCategoryActionButtons: true
onChatItemSelected: selectedChatId = id
StatusChatListAndCategories {
id: communityCategories
height: implicitHeight > (leftPanel.height - 64) ? implicitHeight + 8 : leftPanel.height - 64
width: leftPanel.width
categoryPopupMenu: StatusPopupMenu {
chatList.model: demoCommunityChatListItems
categoryList.model: demoCommunityCategoryItems
property string categoryId
showCategoryActionButtons: true
onChatItemSelected: selectedChatId = id
StatusMenuItem {
text: "Mute Category"
icon.name: "notification"
categoryPopupMenu: StatusPopupMenu {
property string categoryId
StatusMenuItem {
text: "Mute Category"
icon.name: "notification"
}
StatusMenuItem {
text: "Mark as Read"
icon.name: "checkmark-circle"
}
StatusMenuItem {
text: "Edit Category"
icon.name: "edit"
}
StatusMenuSeparator {}
StatusMenuItem {
text: "Delete Category"
icon.name: "delete"
type: StatusMenuItem.Type.Danger
}
}
StatusMenuItem {
text: "Mark as Read"
icon.name: "checkmark-circle"
}
StatusMenuItem {
text: "Edit Category"
icon.name: "edit"
}
popupMenu: StatusPopupMenu {
StatusMenuItem {
text: "Create channel"
icon.name: "channel"
}
StatusMenuSeparator {}
StatusMenuItem {
text: "Create category"
icon.name: "channel-category"
}
StatusMenuItem {
text: "Delete Category"
icon.name: "delete"
type: StatusMenuItem.Type.Danger
}
}
StatusMenuSeparator {}
popupMenu: StatusPopupMenu {
StatusMenuItem {
text: "Create channel"
icon.name: "channel"
}
StatusMenuItem {
text: "Create category"
icon.name: "channel-category"
}
StatusMenuSeparator {}
StatusMenuItem {
text: "Invite people"
icon.name: "share-ios"
StatusMenuItem {
text: "Invite people"
icon.name: "share-ios"
}
}
}
}

View File

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