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

Check Widget for min height and width

This commit is contained in:
Elias Steurer 2023-02-18 14:13:23 +01:00
parent 231ee32488
commit f0161ffc35
4 changed files with 10 additions and 0 deletions

View File

@ -8,5 +8,6 @@
<link rel="stylesheet" href="">
</head>
<body>
<h1>This is my HTML Wallpaper 🚀</h1>
</body>
</html>

View File

@ -8,5 +8,6 @@
<link rel="stylesheet" href="">
</head>
<body>
<h1>This is my HTML Widget 🚀</h1>
</body>
</html>

View File

@ -2,6 +2,8 @@ import QtQuick
Item {
id: root
// This is the default size of the widget.
// These implicit width and height values are required!
implicitWidth: 300
implicitHeight: 200

View File

@ -73,6 +73,12 @@ 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
}
// Resize to loaded widget size
// Note: We must use implicit* here to not
// break the set values.