refactoring after review

This commit is contained in:
mprakhov 2022-11-11 18:46:35 +02:00 committed by Mykhailo Prakhov
parent 36e0277321
commit d26ca0baf9
2 changed files with 11 additions and 24 deletions

View File

@ -63,42 +63,29 @@ SettingsContentBase {
width: root.contentWidth
StackLayout {
Layout.fillWidth: true
id: stackLayout
currentIndex: editPreviwTabBar.currentIndex
onImplicitHeightChanged: {
// During opening Profile, StackLayout always set implicitHeight of his biggest
// child implicitHeight and it reflecting on a scroll area.
// Use implicitHeight of current child
if (currentIndex === 0 && implicitHeight !== settingsView.implicitHeight) {
implicitHeight = settingsView.implicitHeight
} else if (currentIndex === 1 && implicitHeight !== profilePreview.implicitHeight) {
implicitHeight = profilePreview.implicitHeight
}
}
onCurrentIndexChanged: {
switch(currentIndex) {
case 0: implicitHeight = settingsView.implicitHeight; break
case 1: implicitHeight = profilePreview.implicitHeight; break
}
}
MyProfileSettingsView {
id: settingsView
Layout.fillWidth: true
profileStore: root.profileStore
privacyStore: root.privacyStore
walletStore: root.walletStore
onVisibleChanged: if (visible) stackLayout.Layout.preferredHeight = settingsView.implicitHeight
Component.onCompleted: stackLayout.Layout.preferredHeight = Qt.binding(() => settingsView.implicitHeight)
}
MyProfilePreview {
id: profilePreview
Layout.fillWidth: true
profileStore: root.profileStore
contactsStore: root.contactsStore
dirtyValues: settingsView.dirtyValues
dirty: settingsView.dirty
onVisibleChanged: if (visible) stackLayout.Layout.preferredHeight = Qt.binding(() => profilePreview.implicitHeight)
}
}

View File

@ -87,15 +87,15 @@ Control {
StatusScrollView {
id: scrollView
visible: root.bio !== ""
visible: root.bio
padding: 0
rightPadding: scrollBar.visible ? 16 : 0
Layout.maximumHeight: 108
Layout.fillWidth: true
TextArea.flickable: bioText
contentHeight: bioText.height
ScrollBar.vertical: StatusScrollBar {
id: scrollBar
policy: scrollView.contentHeight > scrollView.height ? ScrollBar.AlwaysOn : ScrollBar.AlwaysOff
policy: bioText.height > scrollView.availableHeight ? ScrollBar.AlwaysOn : ScrollBar.AlwaysOff
}
StatusBaseText {