actually fixing popup content spacing this time

This commit is contained in:
end-4
2026-03-29 19:22:18 +02:00
parent e597928a9e
commit ce52695746
3 changed files with 17 additions and 18 deletions
@@ -27,15 +27,11 @@ Shapes.ShapeCanvas {
required property real startRadius
required property real endRadius
property real baseMargin: {
print("calculating new base margin (vertical, parent height, container height) = ", vertical, parent.height, containerShape.height)
if (!vertical)
return parent.anchors.topMargin
else
return parent.anchors.leftMargin
}
onBaseMarginChanged: {
print(baseMargin)
}
property alias containerShape: containerShape
property alias popupShape: popupShape
@@ -88,16 +84,18 @@ Shapes.ShapeCanvas {
onPopupYOffsetChanged: if (bgShape.showPopup) lockPopupY = true;
// Positioning
readonly property real popupContentOffsetBase: popupPadding + baseMargin
readonly property real popupContentOffsetBase: popupPadding
readonly property real popupContentOffsetBaseX: popupContentOffsetBase + parent.anchors.leftMargin
readonly property real popupContentOffsetBaseY: popupContentOffsetBase + parent.anchors.topMargin
readonly property real paddedContainerHeight: containerShape.height
readonly property real paddedContainerWidth: containerShape.width
readonly property real popupContentOffsetY: {
if (!vertical) return paddedContainerHeight + spacing + popupContentOffsetBase + (atBottom * -(popupHeight + backgroundHeight + spacing * 2))
else return popupYOffset + popupContentOffsetBase;
}
readonly property real popupContentOffsetX: {
if (!vertical) return popupXOffset + popupContentOffsetBase;
else return paddedContainerWidth + spacing + popupContentOffsetBase + (atBottom * -(popupWidth + backgroundWidth + spacing * 2));
if (!vertical) return popupXOffset + popupContentOffsetBaseX;
else return paddedContainerWidth + spacing + popupContentOffsetBaseX + (atBottom * -(popupWidth + backgroundWidth + spacing * 2));
}
readonly property real popupContentOffsetY: {
if (!vertical) return paddedContainerHeight + spacing + popupContentOffsetBaseY + (atBottom * -(popupHeight + backgroundHeight + spacing * 2))
else return popupYOffset + popupContentOffsetBaseY;
}
anchors {
@@ -21,13 +21,14 @@ HBarWidgetWithPopout {
HBarWidgetContent {
id: contentRoot
vertical: root.vertical
atBottom: root.atBottom
showPopup: root.showPopup
contentImplicitWidth: activeItem.implicitWidth
contentImplicitHeight: activeItem.implicitHeight
onClicked: root.showPopup = !root.showPopup
property var activeItem: sysInfoContent
contentImplicitWidth: sysInfoContent.implicitWidth
contentImplicitHeight: sysInfoContent.implicitHeight
SysInfoContent {
id: sysInfoContent
@@ -37,9 +38,9 @@ HBarWidgetWithPopout {
SysInfoPopupContent {
id: popupContent
anchors {
top: root.vertical ? contentRoot.activeItem.top : contentRoot.activeItem.top
top: parent.top
left: parent.left
topMargin: root.popupContentOffsetY
left: root.vertical ? contentRoot.activeItem.left : contentRoot.activeItem.left
leftMargin: root.popupContentOffsetX
}
@@ -53,9 +53,9 @@ HBarWidgetWithPopout {
PopupContent {
id: popupContent
anchors {
top: root.vertical ? verticalContent.top : horizontalContent.top
top: parent.top
left: parent.left
topMargin: root.popupContentOffsetY
left: root.vertical ? verticalContent.left : horizontalContent.left
leftMargin: root.popupContentOffsetX
}