fix(sandbox): Fix results popup component position

Fixed alignment when results are being filtered.
If the x position that the popup should be aligned
goes off the screen, the popup appears back on
position 0. Also fixed result list item was not
vertically centered.
This commit is contained in:
Alexandra Betouni 2022-02-08 23:33:14 +02:00 committed by Pascal Precht
parent 665141f81d
commit cdf51fefbd
No known key found for this signature in database
GPG Key ID: 0EE28D8D6FD85D7D
1 changed files with 13 additions and 9 deletions

View File

@ -71,22 +71,27 @@ Page {
StatusBaseText { StatusBaseText {
id: contactsLabel id: contactsLabel
font.pixelSize: 15 font.pixelSize: 15
anchors.left: parent.left
anchors.leftMargin: 8
color: Theme.palette.baseColor1 color: Theme.palette.baseColor1
text: "Contacts" text: qsTr("Contacts")
} }
Control { Control {
width: 360 width: 360
anchors { anchors {
top: contactsLabel.bottom top: contactsLabel.bottom
topMargin: 8//Style.current.padding topMargin: 8//Style.current.padding
bottom: parent.bottom bottom: !statusPopupMenuBackgroundContent.visible ? parent.bottom : undefined
bottomMargin: 20//Style.current.bigPadding bottomMargin: 20//Style.current.bigPadding
} }
height: 16 + (!statusPopupMenuBackgroundContent.visible ? parent.height :
(((userListView.count * 64) > parent.height) ? parent.height : (userListView.count * 64)))
x: (statusPopupMenuBackgroundContent.visible && (tagSelector.namesModel.count > 0) &&
((tagSelector.textEdit.x + 24 + statusPopupMenuBackgroundContent.width) < parent.width))
? (tagSelector.textEdit.x + 24) : 0
background: Rectangle { background: Rectangle {
id: statusPopupMenuBackgroundContent id: statusPopupMenuBackgroundContent
anchors.left: parent.left anchors.fill: parent
anchors.right: parent.right
height: (userListView.height + 8)
visible: (tagSelector.sortedList.count > 0) visible: (tagSelector.sortedList.count > 0)
color: Theme.palette.statusPopupMenu.backgroundColor color: Theme.palette.statusPopupMenu.backgroundColor
radius: 8 radius: 8
@ -107,9 +112,9 @@ Page {
} }
contentItem: ListView { contentItem: ListView {
id: userListView id: userListView
anchors.left: parent.left anchors.fill: parent
anchors.right: parent.right anchors.topMargin: 8
height: (count * 64) > parent.height ? parent.height : (count * 64) anchors.bottomMargin: 8
clip: true clip: true
model: contactsModel model: contactsModel
ScrollBar.vertical: ScrollBar { ScrollBar.vertical: ScrollBar {
@ -125,7 +130,6 @@ Page {
Rectangle { Rectangle {
id: rectangle id: rectangle
anchors.fill: parent anchors.fill: parent
anchors.topMargin: 8
anchors.rightMargin: 8 anchors.rightMargin: 8
anchors.leftMargin: 8 anchors.leftMargin: 8
radius: 8 radius: 8