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. How to show different data in qml depending on backend objects

How to show different data in qml depending on backend objects

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
qml
2 Posts 2 Posters 233 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.
  • D Offline
    D Offline
    developa
    wrote on 28 Feb 2020, 21:31 last edited by developa
    #1

    Let's say I have my gui running on a remote vehicle controller with a screen. I want to be able to show different views/data to the user depending on what vehicle I am driving. I am able to use the same controller to drive a car, air plane and submarine. But I want to draw a canvas in qml when connected to the car and show a text when connected to air plane and show a different text when connected to the submarine. Those "vehicles" will be different objects in the back-end.
    The way I achieve this currently is using if-else statements in qml, but this is not feasible as the number of vehicles grows.
    Is there a way to achieve this mechanism using models instead of using if-else?

    Thanks

    1 Reply Last reply
    1
    • M Offline
      M Offline
      MajidKamali
      wrote on 29 Feb 2020, 23:09 last edited by
      #2

      use file selectors for showing completely different UI
      https://doc.qt.io/qt-5/qfileselector.html#adding-selectors

      You can also add extra selectors at runtime for custom behavior. These will be used in any future calls to select(). If the extra selectors list has been changed, calls to select() will use the new list and may return differently.

      1 Reply Last reply
      1

      1/2

      28 Feb 2020, 21:31

      • Login

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