fix col/row grid on imported widgets

This commit is contained in:
Sarah Jamie Lewis 2020-07-06 15:47:08 -07:00
parent ca34a58760
commit 232e19d0a9
3 changed files with 13 additions and 18 deletions

View File

@ -2,28 +2,26 @@ Grid {
rows:2 rows:2
cols:2 cols:2
Rectangle { Rectangle {
color: "blue" color: "#F3F0F4"
Text { Text {
anchors.centerIn: parent anchors.centerIn: parent
text: "Hello, Twitter! 🦀" text: "Hello, Twitter! 🦀"
} }
} }
Rectangle { Rectangle {
color: "red" color: "#281038"
border.color: "#550099" border.color: "#550099"
anchors.centerIn: parent anchors.centerIn: parent
Image { Image {
id: opimg
anchors.centerIn: parent anchors.centerIn: parent
opacity: [[rand_opacity()]]
source: "./res/openprivacy.png" source: "./res/openprivacy.png"
} }
} }
Rectangle { Rectangle {
color: "red" color: "#634B72"
} }
Rectangle { Rectangle {
color: "blue" color: "#281038"
Text { Text {
anchors.centerIn: parent anchors.centerIn: parent
text: "Hello, Twitter! 🦀" text: "Hello, Twitter! 🦀"

View File

@ -6,15 +6,12 @@ Grid {
} }
Rectangle { HelloTwitter {
color: "blue"
Text {
anchors.centerIn: parent
text: "Hello, World!"
}
} }
Rectangle { Rectangle {
color: "blue" color: "#8c63a4"
Text { Text {
id: target id: target
anchors.centerIn: parent anchors.centerIn: parent
@ -26,7 +23,7 @@ Grid {
columns: 2 columns: 2
Rectangle { Rectangle {
color: "red" color: "#634B72"
TextField { TextField {
id: tf1 id: tf1
anchors.centerIn: parent anchors.centerIn: parent
@ -36,7 +33,7 @@ Grid {
} }
} }
Rectangle { Rectangle {
color: "blue" color: "#6F4985"
Button { Button {
anchors.centerIn: parent anchors.centerIn: parent
text: "Hello, World!" text: "Hello, World!"
@ -47,7 +44,7 @@ Grid {
} }
} }
Rectangle { Rectangle {
color: "blue" color: "#F3F0F4"
Button { Button {
anchors.centerIn: parent anchors.centerIn: parent
text: "Hello, World!" text: "Hello, World!"
@ -58,7 +55,7 @@ Grid {
} }
} }
Rectangle { Rectangle {
color: "red" color: "#b29dbe"
Text { Text {
anchors.centerIn: parent anchors.centerIn: parent
text: "Hello, World!" text: "Hello, World!"

View File

@ -16,7 +16,7 @@ impl WidgetBuilder for ImportBuilder {
return Box::new(move |id, ctx, row, col, qmlctx| -> Entity { return Box::new(move |id, ctx, row, col, qmlctx| -> Entity {
let qml_doc = parse_qml(format!("./res/{}.qml", import_source).as_str()); let qml_doc = parse_qml(format!("./res/{}.qml", import_source).as_str());
let top_level = qml_doc.children.clone(); let top_level = qml_doc.children.clone();
QmlWidgetBuilder::new().build(id, 0, 0, top_level[0].0.clone(), top_level[0].1.clone(), ctx, qmlctx.borrow_mut()) QmlWidgetBuilder::new().build(id, row, col, top_level[0].0.clone(), top_level[0].1.clone(), ctx, qmlctx.borrow_mut())
}); });
} }
} }