Skip to content

Instantly share code, notes, and snippets.

@JanisErdmanis
Created March 19, 2023 22:02
Show Gist options
  • Save JanisErdmanis/99df2fa07de4d6a415ffe3d1a5e11a39 to your computer and use it in GitHub Desktop.
Save JanisErdmanis/99df2fa07de4d6a415ffe3d1a5e11a39 to your computer and use it in GitHub Desktop.
Property grouping (none works)
using QML
bank = "TRUST ME BANK"
mutable struct Account
account::String
balance::Int
end
account = Account("ACCOUNT NAME", 123)
accountTwo = JuliaPropertyMap(
"account" => "ACCOUNT TWO",
"balance" => 200
)
accountThree = Dict(
"account" => "ACCOUNT THREE",
"balance" => 300
)
loadqml("Bank.qml"; bridge = JuliaPropertyMap("bank" => bank, "account" => account, "accountTwo" => accountTwo, "accountThree" => accountThree))
exec()
import QtQuick
import QtQuick.Window
import QtQuick.Controls
Window {
id: app
width: 550
height: 700
visible: true
title: "Bank"
Text {
anchors.top : parent.top
anchors.horizontalCenter : parent.horizontalCenter
anchors.topMargin : 16
text : bridge.bank
font.pointSize : 32
}
Column {
anchors.centerIn : parent
width : parent.width * 0.6
Item {
width : parent.width
height : 20
Text {
anchors.left : parent.left
text : "Account"//bridge.account.account
font.weight : Font.Bold
}
Text {
anchors.right : parent.right
text : "Balance"//bridge.account.balance
font.weight : Font.Bold
}
}
Item {
width : parent.width
height : 20
Text {
anchors.left : parent.left
text : "Dummy account"//bridge.account.account
}
Text {
anchors.right : parent.right
text : "100"//bridge.account.balance
}
}
Item {
width : parent.width
height : 20
Text {
anchors.left : parent.left
text : bridge.account.account
}
Text {
anchors.right : parent.right
text : bridge.account.balance
}
}
Item {
width : parent.width
height : 20
Text {
anchors.left : parent.left
text : bridge.accountTwo.account
}
Text {
anchors.right : parent.right
text : bridge.accountTwo.balance
}
}
Item {
width : parent.width
height : 20
Text {
anchors.left : parent.left
text : bridge.accountThree.account
}
Text {
anchors.right : parent.right
text : bridge.accountThree.balance
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment