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. [SOLVED] Define states into separate QML file
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] Define states into separate QML file

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 1 Posters 529 Views 1 Watching
  • 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.
  • F Offline
    F Offline
    frankem
    wrote on last edited by frankem
    #1

    Dear all,

    is there any way how to achieve this. I would like to have a separate QML component consisting only of a list of states, so that I can write something like this:

    Item {
      states: States{}
    }
    

    Thanks and best regards,
    Markus

    1 Reply Last reply
    0
    • F Offline
      F Offline
      frankem
      wrote on last edited by frankem
      #2

      Meanwhile I found a solution by myself as follows:

      main.qml

      States { id: states }
      states: states.myStates
      

      States.qml

      Item {
          property list<State> myStates: [
              State {},
              State {},
              State {}
          }
      }
      

      Is this already the best way to achieve what I want or are there any better solutions?

      Thanks and best regards,
      Markus

      1 Reply Last reply
      0

      • Login

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