1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-10-06 09:17:07 +02:00

Change Widget to behave more like a window

Lets only move with the new taskbar, to make sure
that we always can interact with the widget content
This commit is contained in:
Elias Steurer 2023-03-25 14:25:51 +01:00
parent 1689931060
commit 9b824a5192

View File

@ -62,11 +62,11 @@ Item {
// Some width do not know their implicit size,
// see the xkcd example.
function onImplicitWidthChanged() {
print()
root.width = loader.item.implicitWidth
print();
root.width = loader.item.implicitWidth;
}
function onImplicitHeightChanged() {
root.height = loader.item.implicitHeight
root.height = loader.item.implicitHeight;
}
}
@ -88,9 +88,9 @@ Item {
onStatusChanged: {
if (loader.status == Loader.Ready && loader.source !== "") {
if (loader.item.implicitWidth === 0 || loader.item.implicitHeight === 0) {
print("Implicit size is 0, using root size")
loader.item.implicitWidth = root.width
loader.item.implicitHeight = root.height
print("Implicit size is 0, using root size");
loader.item.implicitWidth = root.width;
loader.item.implicitHeight = root.height;
}
// Resize to loaded widget size
@ -118,10 +118,23 @@ Item {
}
}
}
Item {
id: nav
height: 20
anchors {
top: parent.top
right: parent.right
left: parent.left
}
Rectangle {
id: bg
anchors.fill: parent
color: "black"
opacity: 0
}
MouseArea {
id: mouseArea
height: 20
property var clickPos
anchors.fill: parent
@ -161,7 +174,7 @@ Item {
}
anchors {
margins: 5
margins: 1
top: parent.top
right: parent.right
}
@ -183,6 +196,11 @@ Item {
target: imgClose
opacity: .5
}
PropertyChanges {
target: bg
opacity: .3
}
},
State {
name: "iconHover"
@ -203,6 +221,7 @@ Item {
]
}
}
}
states: [
State {
@ -227,7 +246,7 @@ Item {
to: "in"
PropertyAnimation {
targets: [root, bgNoise, loader]
targets: [root, bgNoise, loader, bg]
duration: 250
property: "opacity"
}