Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Model for UI objects data
Forum Update on Monday, May 27th 2025

Model for UI objects data

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 143 Views
  • 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 Offline
    M Offline
    MiklYarochkin
    wrote on 4 Aug 2020, 11:17 last edited by MiklYarochkin 8 Apr 2020, 11:17
    #1

    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
    0

    1/1

    4 Aug 2020, 11:17

    • Login

    • Login or register to search.
    1 out of 1
    • First post
      1/1
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved