fix(scrollview instances): fixed dropdown&popup height

Fixes InDropdown & OutgoingContactVerificationRequestPopup
This commit is contained in:
Alexandra Betouni 2023-02-10 16:46:18 +02:00 committed by Alexandra Betouni
parent 7c3a6795f4
commit 7c87bc8987
4 changed files with 19 additions and 31 deletions

View File

@ -8,7 +8,6 @@ import StatusQ.Controls 0.1
import StatusQ.Popups 0.1 import StatusQ.Popups 0.1
import shared.controls 1.0 import shared.controls 1.0
import SortFilterProxyModel 0.2 import SortFilterProxyModel 0.2
StatusDropdown { StatusDropdown {
@ -50,6 +49,9 @@ StatusDropdown {
QtObject { QtObject {
id: d id: d
readonly property int defaultVMargin: 9
readonly property int maxHeightCountNo: 5
readonly property int itemStandardHeight: 44
readonly property var selectedChannels: new Map() readonly property var selectedChannels: new Map()
signal setSelectedChannels(var channels) signal setSelectedChannels(var channels)
@ -80,11 +82,7 @@ StatusDropdown {
} }
} }
ColumnLayout { contentItem: ColumnLayout {
anchors.top: parent.top
anchors.right: parent.right
anchors.left: parent.left
spacing: 0 spacing: 0
SearchBox { SearchBox {
@ -100,11 +98,10 @@ StatusDropdown {
StatusListItem { StatusListItem {
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 9 Layout.topMargin: d.defaultVMargin
Layout.preferredHeight: 44 Layout.preferredHeight: d.itemStandardHeight
visible: root.allowChoosingEntireCommunity visible: root.allowChoosingEntireCommunity
title: root.communityName title: root.communityName
subTitle: qsTr("Community") subTitle: qsTr("Community")
@ -154,29 +151,26 @@ StatusDropdown {
visible: root.allowChoosingEntireCommunity visible: root.allowChoosingEntireCommunity
} }
StatusScrollView { StatusScrollView {
id: scrollView id: scrollView
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.minimumHeight: Math.min(d.maxHeightCountNo, topRepeater.count) * d.itemStandardHeight
Layout.bottomMargin: 9 Layout.maximumHeight: Layout.minimumHeight
contentHeight: scrollableColumn.implicitHeight
Layout.bottomMargin: d.defaultVMargin
Layout.topMargin: Layout.topMargin:
!root.allowChoosingEntireCommunity && !root.allowChoosingEntireCommunity ? 9 : 0 !root.allowChoosingEntireCommunity && !root.allowChoosingEntireCommunity ? d.defaultVMargin : 0
padding: 0 padding: 0
ColumnLayout { ColumnLayout {
id: scollableColumn id: scrollableColumn
spacing: 0
width: scrollView.width width: scrollView.width
spacing: 0
StatusIconTextButton { StatusIconTextButton {
Layout.preferredHeight: 36 Layout.preferredHeight: 36
visible: root.showAddChannelButton visible: root.showAddChannelButton
leftPadding: 8 leftPadding: 8
spacing: 8 spacing: 8
statusIcon: "add" statusIcon: "add"
@ -189,7 +183,6 @@ StatusDropdown {
Repeater { Repeater {
id: topRepeater id: topRepeater
model: SortFilterProxyModel { model: SortFilterProxyModel {
id: topLevelModel id: topLevelModel
@ -203,10 +196,8 @@ StatusDropdown {
ColumnLayout { ColumnLayout {
id: column id: column
Layout.fillWidth: true Layout.fillWidth: true
spacing: 0 spacing: 0
readonly property var topModel: model readonly property var topModel: model
readonly property alias checkBox: loader.item readonly property alias checkBox: loader.item
property int checkedCount: 0 property int checkedCount: 0
@ -232,8 +223,8 @@ StatusDropdown {
id: loader id: loader
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: model.isCategory ? 9 : 0 Layout.preferredHeight: d.itemStandardHeight
Layout.topMargin: model.isCategory ? d.defaultVMargin : 0
sourceComponent: model.isCategory sourceComponent: model.isCategory
? communityCategoryDelegate ? communityCategoryDelegate
: communityDelegate : communityDelegate
@ -312,7 +303,6 @@ StatusDropdown {
Repeater { Repeater {
id: subItemsRepeater id: subItemsRepeater
model: SortFilterProxyModel { model: SortFilterProxyModel {
sourceModel: topModel.isCategory ? topModel.subItems : null sourceModel: topModel.isCategory ? topModel.subItems : null
sorters: RoleSorter { roleName: "position" } sorters: RoleSorter { roleName: "position" }
@ -330,7 +320,6 @@ StatusDropdown {
id: communitySubItem id: communitySubItem
Layout.fillWidth: true Layout.fillWidth: true
readonly property bool show: d.search(model.name, searcher.text) readonly property bool show: d.search(model.name, searcher.text)
|| checked || checked

View File

@ -169,7 +169,6 @@ SettingsPageLayout {
channelsTracker.revision channelsTracker.revision
communityNewPermissionView.dirtyValues.permissionType communityNewPermissionView.dirtyValues.permissionType
communityNewPermissionView.dirtyValues.isPrivate communityNewPermissionView.dirtyValues.isPrivate
const model = root.store.permissionsModel const model = root.store.permissionsModel
const count = model.rowCount() const count = model.rowCount()
@ -269,6 +268,7 @@ SettingsPageLayout {
CommunityPermissionsView { CommunityPermissionsView {
viewWidth: root.viewWidth viewWidth: root.viewWidth
height: root.height
rootStore: root.rootStore rootStore: root.rootStore
store: root.store store: root.store

View File

@ -30,12 +30,12 @@ StatusScrollView {
property int permissionIndexToRemove property int permissionIndexToRemove
} }
contentWidth: mainLayout.width contentWidth: root.viewWidth
contentHeight: mainLayout.height + mainLayout.anchors.topMargin contentHeight: mainLayout.implicitHeight
ColumnLayout { ColumnLayout {
id: mainLayout id: mainLayout
width: root.viewWidth width: parent.width
spacing: 24 spacing: 24
ListModel { ListModel {

View File

@ -108,7 +108,6 @@ StatusDialog {
text: qsTr("Waiting for %1's response...").arg(root.verificationResponseDisplayName) text: qsTr("Waiting for %1's response...").arg(root.verificationResponseDisplayName)
font.pixelSize: Style.current.additionalTextSize font.pixelSize: Style.current.additionalTextSize
horizontalAlignment : Text.AlignHCenter horizontalAlignment : Text.AlignHCenter
Layout.alignment: Qt.AlignHCenter
Layout.fillWidth: true Layout.fillWidth: true
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
color: Theme.palette.baseColor1 color: Theme.palette.baseColor1