mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
Fix action drawer toolButtons ref and page indicator sync
NotificationDrawer referenced toolButtons, a sibling defined in ContentContainer, not a local property. Add toolButtonsItem: Item and wire it at the call site. Replace the magic literal 10 with Kirigami.Units.largeSpacing while here. The PageIndicator had a one-way binding to swipeView.currentIndex that would break after a user tap. Make it bidirectional with a Connections block and a loop guard on both sides.
This commit is contained in:
parent
2059f14faf
commit
9b94c200ee
3 changed files with 19 additions and 2 deletions
|
|
@ -186,6 +186,7 @@ Item {
|
|||
|
||||
// In convergence, cap the height so it doesn't stretch full-screen
|
||||
maximumHeight: isConvergence ? root.height * 0.6 : -1
|
||||
toolButtonsItem: toolButtons
|
||||
}
|
||||
|
||||
// Secondary swipe area for uses in portrait.
|
||||
|
|
|
|||
|
|
@ -25,6 +25,9 @@ Item {
|
|||
property alias notificationWidget: notificationWidget
|
||||
property real contentY: notificationWidget.listView.contentY
|
||||
|
||||
// The sibling toolbar whose height must be subtracted from the available space.
|
||||
property Item toolButtonsItem: null
|
||||
|
||||
property real topPadding: {
|
||||
if (actionDrawer.mode == MobileShell.ActionDrawer.Portrait)
|
||||
return Kirigami.Units.largeSpacing;
|
||||
|
|
@ -42,7 +45,8 @@ Item {
|
|||
property real maximumHeight: -1
|
||||
|
||||
height: {
|
||||
let h = Math.min(actionDrawer.height - toolButtons.height, notificationWidget.listView.contentHeight + 10 + topMargin);
|
||||
let toolH = toolButtonsItem ? toolButtonsItem.height : 0;
|
||||
let h = Math.min(actionDrawer.height - toolH, notificationWidget.listView.contentHeight + Kirigami.Units.largeSpacing + topMargin);
|
||||
return maximumHeight > 0 ? Math.min(h, maximumHeight) : h;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -241,10 +241,22 @@ Item {
|
|||
asynchronous: true
|
||||
|
||||
sourceComponent: PageIndicator {
|
||||
id: pageIndicatorItem
|
||||
count: swipeView.count
|
||||
currentIndex: swipeView.currentIndex
|
||||
interactive: true
|
||||
onCurrentIndexChanged: swipeView.currentIndex = currentIndex
|
||||
onCurrentIndexChanged: {
|
||||
if (swipeView.currentIndex !== currentIndex)
|
||||
swipeView.currentIndex = currentIndex;
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: swipeView
|
||||
function onCurrentIndexChanged() {
|
||||
if (pageIndicatorItem.currentIndex !== swipeView.currentIndex)
|
||||
pageIndicatorItem.currentIndex = swipeView.currentIndex;
|
||||
}
|
||||
}
|
||||
|
||||
delegate: Rectangle {
|
||||
implicitWidth: 8
|
||||
|
|
|
|||
Loading…
Reference in a new issue