Use a Component for Explicit Spacers

A component has the advantage that the width property can depend from
other properties. This does not work with the previous on the fly
construction as the width does not update when the referenced property
changes.
This commit is contained in:
Martin Gräßlin 2012-09-27 17:08:47 +02:00
parent bcdc74f8d6
commit 728b47ef07

View file

@ -22,7 +22,7 @@ Item {
var component = undefined;
switch (buttons.charAt(i)) {
case "_":
var button = Qt.createQmlObject("import QtQuick 1.1; Item{ width: " + group.explicitSpacer + "; height: parent.height}", groupRow, "dynamicGroup_" + buttons + i);
component = explicitSpacerComponent;
break;
case "A":
component = group.maximizeButton;
@ -85,4 +85,12 @@ Item {
}
createButtons();
}
Component {
id: explicitSpacerComponent
Item {
width: group.explicitSpacer
height: groupRow.height
}
}
}