Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved Model for UI objects data

    QML and Qt Quick
    1
    1
    48
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      MiklYarochkin last edited by MiklYarochkin

      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 messy

      I 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?
      1 Reply Last reply Reply Quote 0
      • First post
        Last post