fix(ShareProfileDialog): contents spills outside of dialog

- make the contents scrollable using a `StatusScrollView`

Fixes #13967
This commit is contained in:
Lukáš Tinkl 2024-03-17 11:35:48 +01:00 committed by Lukáš Tinkl
parent 1b77695e01
commit 864be0ad37
1 changed files with 95 additions and 86 deletions

View File

@ -28,106 +28,115 @@ StatusDialog {
topPadding: Style.current.padding topPadding: Style.current.padding
bottomPadding: Style.current.xlPadding bottomPadding: Style.current.xlPadding
horizontalPadding: 80 horizontalPadding: 0
contentItem: ColumnLayout { StatusScrollView {
spacing: Style.current.halfPadding anchors.fill: parent
contentWidth: availableWidth
Rectangle { ColumnLayout {
Layout.fillWidth: true anchors.left: parent.left
Layout.preferredHeight: width anchors.leftMargin: 40
color: Theme.palette.white anchors.right: parent.right
anchors.rightMargin: 40
spacing: Style.current.halfPadding
Image { Rectangle {
anchors.fill: parent Layout.fillWidth: true
asynchronous: true Layout.preferredHeight: width
fillMode: Image.PreserveAspectFit color: Theme.palette.white
mipmap: true
smooth: false
source: root.qrCode
UserImage { Image {
anchors.centerIn: parent
name: root.displayName
pubkey: root.publicKey
image: root.largeImage
interactive: false
imageWidth: 78
imageHeight: 78
// show a hardcoded white ring
showRing: true
colorHash: JSON.stringify([{colorId: 4, segmentLength: 32}])
}
MouseArea {
anchors.fill: parent anchors.fill: parent
acceptedButtons: Qt.RightButton asynchronous: true
cursorShape: Qt.PointingHandCursor fillMode: Image.PreserveAspectFit
onClicked: qrContextMenu.popup() mipmap: true
} smooth: false
source: root.qrCode
ImageContextMenu { UserImage {
id: qrContextMenu anchors.centerIn: parent
imageSource: root.qrCode name: root.displayName
pubkey: root.publicKey
image: root.largeImage
interactive: false
imageWidth: 78
imageHeight: 78
// show a hardcoded white ring
showRing: true
colorHash: JSON.stringify([{colorId: 4, segmentLength: 32}])
}
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.RightButton
cursorShape: Qt.PointingHandCursor
onClicked: qrContextMenu.popup()
}
ImageContextMenu {
id: qrContextMenu
imageSource: root.qrCode
}
} }
} }
}
StatusBaseText { StatusBaseText {
Layout.topMargin: Style.current.smallPadding Layout.topMargin: Style.current.smallPadding
Layout.fillWidth: true Layout.fillWidth: true
text: qsTr("Profile link") text: qsTr("Profile link")
} }
StatusBaseInput { StatusBaseInput {
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredHeight: 44 Layout.preferredHeight: 44
leftPadding: Style.current.padding leftPadding: Style.current.padding
rightPadding: Style.current.halfPadding rightPadding: Style.current.halfPadding
topPadding: 0 topPadding: 0
bottomPadding: 0 bottomPadding: 0
placeholder.rightPadding: Style.current.halfPadding placeholder.rightPadding: Style.current.halfPadding
placeholder.elide: Text.ElideMiddle placeholder.elide: Text.ElideMiddle
placeholderText: root.linkToProfile placeholderText: root.linkToProfile
placeholderTextColor: Theme.palette.directColor1 placeholderTextColor: Theme.palette.directColor1
edit.readOnly: true edit.readOnly: true
background.color: "transparent" background.color: "transparent"
background.border.color: Theme.palette.baseColor2 background.border.color: Theme.palette.baseColor2
rightComponent: CopyButton { rightComponent: CopyButton {
textToCopy: root.linkToProfile textToCopy: root.linkToProfile
StatusToolTip { StatusToolTip {
text: qsTr("Copy link") text: qsTr("Copy link")
visible: parent.hovered visible: parent.hovered
}
} }
} }
}
StatusBaseText { StatusBaseText {
Layout.topMargin: Style.current.halfPadding Layout.topMargin: Style.current.halfPadding
Layout.fillWidth: true Layout.fillWidth: true
text: qsTr("Emoji hash") text: qsTr("Emoji hash")
}
StatusBaseInput {
Layout.fillWidth: true
Layout.preferredHeight: 44
leftPadding: Style.current.padding
rightPadding: Style.current.halfPadding
topPadding: 0
bottomPadding: 0
edit.readOnly: true
background.color: "transparent"
background.border.color: Theme.palette.baseColor2
leftComponent: EmojiHash {
publicKey: root.publicKey
oneRow: true
} }
rightComponent: CopyButton {
textToCopy: Utils.getEmojiHashAsJson(root.publicKey).join("").toString() StatusBaseInput {
StatusToolTip { Layout.fillWidth: true
text: qsTr("Copy emoji hash") Layout.preferredHeight: 44
visible: parent.hovered leftPadding: Style.current.padding
rightPadding: Style.current.halfPadding
topPadding: 0
bottomPadding: 0
edit.readOnly: true
background.color: "transparent"
background.border.color: Theme.palette.baseColor2
leftComponent: EmojiHash {
publicKey: root.publicKey
oneRow: true
}
rightComponent: CopyButton {
textToCopy: Utils.getEmojiHashAsJson(root.publicKey).join("").toString()
StatusToolTip {
text: qsTr("Copy emoji hash")
visible: parent.hovered
}
} }
} }
} }