diff --git a/storybook/pages/DoubleFlickableWithFoldingPage.qml b/storybook/pages/DoubleFlickableWithFoldingPage.qml
index 124a2ad078..10b7a5fb95 100644
--- a/storybook/pages/DoubleFlickableWithFoldingPage.qml
+++ b/storybook/pages/DoubleFlickableWithFoldingPage.qml
@@ -1,6 +1,7 @@
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
+import QtQml 2.15
import StatusQ.Core 0.1
import StatusQ.Core.Utils 0.1
@@ -15,6 +16,8 @@ SplitView {
readonly property int header1Size: 40
readonly property int header2Size: 40
+ readonly property int footerSize: 60
+
function fillModel(model, count) {
const content = []
@@ -104,6 +107,29 @@ SplitView {
}
}
+ footer: Rectangle {
+ z: 1
+
+ height: root.footerSize
+ width: grid1.width
+
+ Label {
+ anchors.centerIn: parent
+ text: "placeholder 1"
+ }
+
+ color: "yellow"
+ }
+
+ Binding {
+ target: grid1
+ property: "footer"
+ when: !grid1.model || grid1.count !== 0
+ //when: grid1.count !== 0
+ value: null
+ restoreMode: Binding.RestoreBindingOrValue
+ }
+
delegate: Rectangle {
width: grid1.cellWidth
height: grid1.cellHeight
@@ -156,6 +182,28 @@ SplitView {
}
}
+ footer: Rectangle {
+ z: 1
+
+ height: root.footerSize
+ width: grid2.width
+
+ Label {
+ anchors.centerIn: parent
+ text: "placeholder 2"
+ }
+
+ color: "yellow"
+ }
+
+ Binding {
+ target: grid2
+ property: "footer"
+ when: !grid2.model || grid2.count !== 0
+ value: null
+ restoreMode: Binding.RestoreBindingOrValue
+ }
+
delegate: Rectangle {
width: grid2.cellWidth
height: grid2.cellHeight
diff --git a/ui/StatusQ/src/StatusQ/Core/Utils/DoubleFlickableWithFolding.qml b/ui/StatusQ/src/StatusQ/Core/Utils/DoubleFlickableWithFolding.qml
index cf2e6789b3..84e1f705f4 100644
--- a/ui/StatusQ/src/StatusQ/Core/Utils/DoubleFlickableWithFolding.qml
+++ b/ui/StatusQ/src/StatusQ/Core/Utils/DoubleFlickableWithFolding.qml
@@ -1,6 +1,8 @@
import QtQuick 2.15
import QtQml 2.15
+import "internal"
+
DoubleFlickable {
readonly property bool flickable1Folded: !d.grid1ContentInViewport
readonly property bool flickable2Folded: d.grid2HeaderAtEnd || d.model2Blocked
@@ -49,50 +51,22 @@ DoubleFlickable {
}
}
+ // The Flickable component (ListView or GridView) controls y positioning
+ // of the header and it cannot be effectively overriden. As a solution to
+ // this problem, the header can be reparented to a wrapper compensating
+ // for the y offset.
HeaderWrapper {
- id: header1Wrapper
-
parent: contentItem
flickable: flickable1
y: contentY
}
HeaderWrapper {
- id: header2Wrapper
-
parent: contentItem
flickable: flickable2
y: contentY + d.grid2HeaderOffset
}
- // The Flickable component (ListView or GridView) controls y positioning
- // of the header and it cannot be effectively overriden. As a solution to
- // this problem, the header can be reparented to a wrapper compensating
- // for the y offset.
- component HeaderWrapper: Item {
- property Flickable flickable
-
- z: 1
-
- Binding {
- when: flickable.headerItem
- target: flickable.headerItem
- property: "parent"
- value: container
- restoreMode: Binding.RestoreBindingOrValue
- }
-
- Binding {
- when: flickable.headerItem
- target: container
- property: "y"
- value: -flickable.headerItem.y
- restoreMode: Binding.RestoreBindingOrValue
- }
-
- Item { id: container }
- }
-
QtObject {
id: d
diff --git a/ui/StatusQ/src/StatusQ/Core/Utils/internal/HeaderWrapper.qml b/ui/StatusQ/src/StatusQ/Core/Utils/internal/HeaderWrapper.qml
new file mode 100644
index 0000000000..501f6a422d
--- /dev/null
+++ b/ui/StatusQ/src/StatusQ/Core/Utils/internal/HeaderWrapper.qml
@@ -0,0 +1,29 @@
+import QtQuick 2.15
+import QtQml 2.15
+
+// This component is implementation detail of DoubleFlickableWithFolding
+// Moved to external file instead of using inline component because a bug
+// in Qt 5.15.2 causing tests crash.
+Item {
+ property Flickable flickable
+
+ z: 1
+
+ Binding {
+ when: flickable.headerItem
+ target: flickable.headerItem
+ property: "parent"
+ value: container
+ restoreMode: Binding.RestoreBindingOrValue
+ }
+
+ Binding {
+ when: flickable.headerItem
+ target: container
+ property: "y"
+ value: -flickable.headerItem.y
+ restoreMode: Binding.RestoreBindingOrValue
+ }
+
+ Item { id: container }
+}
diff --git a/ui/StatusQ/src/statusq.qrc b/ui/StatusQ/src/statusq.qrc
index 82599542e8..d84ba04799 100644
--- a/ui/StatusQ/src/statusq.qrc
+++ b/ui/StatusQ/src/statusq.qrc
@@ -181,6 +181,7 @@
StatusQ/Core/Utils/ClippingWrapper.qml
StatusQ/Core/Utils/DoubleFlickable.qml
StatusQ/Core/Utils/DoubleFlickableWithFolding.qml
+ StatusQ/Core/Utils/internal/HeaderWrapper.qml
StatusQ/Core/Utils/Emoji.qml
StatusQ/Core/Utils/JSONListModel.qml
StatusQ/Core/Utils/ModelChangeGuard.qml