2023-09-22 15:09:36 +00:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQuick.Controls 2.15
|
|
|
|
import QtQuick.Layouts 1.15
|
2022-08-10 14:47:37 +00:00
|
|
|
|
|
|
|
Rectangle {
|
2022-10-06 12:04:14 +00:00
|
|
|
id: root
|
|
|
|
|
2023-01-31 23:15:50 +00:00
|
|
|
z: 1000
|
2022-10-06 12:04:14 +00:00
|
|
|
border.color: 'red'
|
|
|
|
color: 'transparent'
|
|
|
|
|
|
|
|
QtObject {
|
2023-09-22 15:09:36 +00:00
|
|
|
id: d
|
2022-10-06 12:04:14 +00:00
|
|
|
|
|
|
|
property Item originalParent
|
2023-09-22 15:09:36 +00:00
|
|
|
}
|
2022-10-06 12:04:14 +00:00
|
|
|
|
2023-09-22 15:09:36 +00:00
|
|
|
Timer {
|
|
|
|
id: positionUpdateTimer
|
2022-10-06 12:04:14 +00:00
|
|
|
|
2023-09-22 15:09:36 +00:00
|
|
|
interval: 500
|
|
|
|
repeat: true
|
|
|
|
triggeredOnStart: true
|
2022-10-06 12:04:14 +00:00
|
|
|
|
2023-09-22 15:09:36 +00:00
|
|
|
onTriggered: {
|
|
|
|
const overlay = d.originalParent.Overlay.overlay
|
2022-10-06 12:04:14 +00:00
|
|
|
|
|
|
|
if (!overlay)
|
|
|
|
return
|
|
|
|
|
|
|
|
root.parent = overlay
|
2023-09-22 15:09:36 +00:00
|
|
|
root.visible = d.originalParent.visible
|
|
|
|
const rect = d.originalParent.mapToItem(overlay, 0, 0,
|
|
|
|
d.originalParent.width,
|
|
|
|
d.originalParent.height)
|
2022-10-06 12:04:14 +00:00
|
|
|
root.x = rect.x
|
|
|
|
root.y = rect.y
|
|
|
|
root.width = rect.width
|
|
|
|
root.height = rect.height
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component.onCompleted: {
|
|
|
|
if (parent instanceof ColumnLayout
|
|
|
|
|| parent instanceof RowLayout
|
|
|
|
|| parent instanceof GridLayout
|
2023-05-10 10:54:14 +00:00
|
|
|
|| parent instanceof StackLayout
|
2022-10-06 12:04:14 +00:00
|
|
|
|| parent instanceof Column
|
|
|
|
|| parent instanceof Row
|
|
|
|
|| parent instanceof Grid
|
|
|
|
|| parent instanceof Flow) {
|
2023-09-22 15:09:36 +00:00
|
|
|
d.originalParent = parent
|
|
|
|
positionUpdateTimer.running = true
|
2022-10-06 12:04:14 +00:00
|
|
|
} else {
|
|
|
|
if (!anchors.fill)
|
|
|
|
anchors.fill = parent
|
|
|
|
}
|
|
|
|
}
|
2022-08-10 14:47:37 +00:00
|
|
|
}
|