Commit d035e939 authored by Michal Policht's avatar Michal Policht

Change the way implicit width and height are calculated.

Read-only properties 'wayWidth' and 'wayHeight' have been added.

Loader does not initialize 'item' before Valve component is ready, which
results in recalculation of implicit width and height if they rely on
binding involving 'item'. It also prevents one from relying on implicit
width and height within 'Component.onCompleted' signal handler. To avoid
this Loader components rely on their respective flags along with
'wayWidth' and 'wayHeight' properties to calculate their sizes.
parent 5b7074ce
Pipeline #15643 passed with stages
in 17 minutes and 23 seconds
......@@ -13,6 +13,10 @@ Element {
active: true
readonly property real wayWidth: units.quadrat * 0.25
readonly property real wayHeight: units.quadrat * 0.25
property bool leftWay: true
property bool rightWay: true
......@@ -33,8 +37,8 @@ Element {
SymbolCanvas {
id: canvas
implicitWidth: units.quadrat * 0.25
implicitHeight: units.quadrat * 0.25
implicitWidth: root.wayWidth
implicitHeight: root.wayHeight
element: root
......@@ -71,8 +75,8 @@ Element {
Loader {
y: topWay ? 0.5 * height : 0
width: item ? item.implicitWidth : 0
height: item ? item.implicitHeight : 0
width: leftWay ? wayWidth : 0
height: leftWay ? wayHeight : 0
sourceComponent: leftWay ? way : undefined
property bool closed: leftClosed
......@@ -81,8 +85,8 @@ Element {
Loader {
x: leftWay ? width : (topWay || bottomWay) ? width * 0.5 : 0
y: topWay ? 0.5 * height : 0
width: item ? item.implicitWidth : 0
height: item ? item.implicitHeight : 0
width: rightWay ? wayWidth : 0
height: rightWay ? wayHeight : 0
rotation: 180
sourceComponent: rightWay ? way : undefined
......@@ -91,8 +95,8 @@ Element {
Loader {
x: leftWay ? width * 0.5 : 0
width: item ? item.implicitWidth : 0
height: item ? item.implicitHeight : 0
width: topWay ? wayWidth : 0
height: topWay ? wayHeight : 0
rotation: 90
sourceComponent: topWay ? way : undefined
......@@ -102,8 +106,8 @@ Element {
Loader {
x: leftWay ? width * 0.5 : 0
y: topWay ? height : (leftWay || rightWay) ? height * 0.5 : 0
width: item ? item.implicitWidth : 0
height: item ? item.implicitHeight : 0
width: bottomWay ? wayWidth : 0
height: bottomWay ? wayHeight : 0
rotation: -90
sourceComponent: bottomWay ? way : undefined
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment