Model for UI objects data
Unsolved
QML and Qt Quick
-
Hello,
On Ui I have Labels, SpinBoxes, Buttons,... for visualization of some stuff from Controller
I wrap it in custom types and now it looks something like this:
CommandPushButton{image: "concrete density hard"; control: "DensityHard"} CommandDelayButton{image: "center"; control: "HeaderRollLeftSearch"} ParameterSpinBox{parameter: "DistanceBeforeStartBoomIn"; unit: "" } ParameterBigView{parameter: "FinePullSpeed"; label: qsTr("Fine pull speed"); unit: "%"; image: "pull speed"; }
So, for every element, I need to specify properties in QML file in the element itself
It is working fine, but when I have 20 objects on the screen looks messyI am looking for DataModel what can hold all these details inside. Something like this:
BestQmlDataModelEver{ id: modelForAllDataOnUi BestEverDataModelElement{id: "DensityHard"; image: "concrete density hard"} BestEverDataModelElement{id: "HeaderRollLeftSearch"; image: "center"} BestEverDataModelElement{id: "DistanceBeforeStartBoomIn"; unit: ""} BestEverDataModelElement{id: "FinePullSpeed"; label: qsTr("Fine pull speed"); unit: "%"; image: "pull speed"; } }
And use it like this in QML file:
CommandPushButton{id: "DensityHard"} CommandDelayButton{id: "HeaderRollLeftSearch"} ParameterSpinBox{id: "DistanceBeforeStartBoomIn"} ParameterBigView{id: "FinePullSpeed"}
Problems I see (probably more exist what I don't see now :) ):
- does this model exists in Qt Quick
- can I find element inside of my custom types by Id: modelForAllDataOnUi.FindByName(id)
- will I lose translation possibility?