Commit aecb0195 authored by Thomas BOUTROUE's avatar Thomas BOUTROUE

Add "placeholder" in ComboList

Allow ComboList to display it when currentKey is undefined

Fix numerous QML warnings on anchors when parent gets null
parent 70ea0c9d
Pipeline #972 passed with stage
in 31 seconds
......@@ -8,10 +8,11 @@ Item {
implicitWidth: (dumbLayout.width + arrow.width + padding * 3);
implicitHeight: (loaderCurrent.height + padding * 2);
property int padding : Style.spacingNormal;
property bool filterable : false;
property alias rounding : rect.radius;
property alias backColor : rect.color;
property int padding : Style.spacingNormal;
property bool filterable : false;
property alias rounding : rect.radius;
property alias backColor : rect.color;
property string placeholder : "";
property var model : undefined;
property Component delegate : ComboListDelegateForModelWithRoles { }
......@@ -135,10 +136,10 @@ Item {
enabled: base.enabled;
sourceComponent: base.delegate;
anchors {
left: parent.left;
left: (parent ? parent.left : undefined);
right: arrow.left;
margins: padding;
verticalCenter: parent.verticalCenter;
verticalCenter: (parent ? parent.verticalCenter : undefined);
}
Binding {
......@@ -154,13 +155,18 @@ Item {
Binding {
target: loaderCurrent.item;
property: "value";
value: currentValue;
value: (currentValue || placeholder);
}
Binding {
target: loaderCurrent.item;
property: "active";
value: false;
}
Binding {
target: loaderCurrent.item;
property: "opacity";
value: (currentKey !== undefined ? 1.0 : 0.65);
}
}
SymbolLoader {
id: arrow;
......@@ -169,9 +175,9 @@ Item {
symbol: Style.symbolArrowDown;
enabled: base.enabled;
anchors {
right: parent.right;
right: (parent ? parent.right : undefined);
margins: padding;
verticalCenter: parent.verticalCenter;
verticalCenter: (parent ? parent.verticalCenter : undefined);
}
}
Component {
......
......@@ -19,6 +19,6 @@ ComboListDelegate {
id: lbl;
text: base.value;
emphasis: base.active;
anchors.verticalCenter: parent.verticalCenter;
anchors.verticalCenter: (parent ? parent.verticalCenter : undefined);
}
}
......@@ -19,6 +19,6 @@ ComboListDelegate {
id: lbl;
text: base.value;
emphasis: base.active;
anchors.verticalCenter: parent.verticalCenter;
anchors.verticalCenter: (parent ? parent.verticalCenter : undefined);
}
}
......@@ -16,6 +16,6 @@ ComboListDelegate {
id: lbl;
text: base.value;
emphasis: base.active;
anchors.verticalCenter: parent.verticalCenter;
anchors.verticalCenter: (parent ? parent.verticalCenter : undefined);
}
}
......@@ -79,11 +79,10 @@ FocusScope {
pixelSize: Style.fontSizeNormal;
}
anchors {
left: parent.left;
right: parent.right;
margins: padding;
verticalCenter: parent.verticalCenter;
verticalCenter: (parent ? parent.verticalCenter : undefined);
}
ExtraAnchors.horizontalFill: parent;
onAccepted: { base.accepted (); }
}
MouseArea {
......@@ -106,8 +105,8 @@ FocusScope {
GradientStop { position: 1.0; color: backColor; }
}
anchors {
verticalCenter: parent.verticalCenter;
horizontalCenter: parent.left;
verticalCenter: (parent ? parent.verticalCenter : undefined);
horizontalCenter: (parent ? parent.left : undefined);
}
}
SymbolLoader {
......@@ -132,10 +131,9 @@ FocusScope {
pixelSize: input.font.pixelSize;
}
anchors {
left: parent.left;
right: parent.right;
margins: padding;
verticalCenter: parent.verticalCenter;
verticalCenter: (parent ? parent.verticalCenter : undefined);
}
ExtraAnchors.horizontalFill: parent;
}
}
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