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. Global Objects With Loaders?

Global Objects With Loaders?

Scheduled Pinned Locked Moved Solved QML and Qt Quick
2 Posts 2 Posters 225 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.
  • B Offline
    B Offline
    bbbb
    wrote on last edited by bbbb
    #1

    I have a program where a user can select between five tabs, and the loader object will load the QML file associated with that tab. Since the tabs appear in all five pages, is there a way I can make these tab objects "global" so I won't have to copy-paste the code for the five tabs into each QML file?

    To get a better idea of how I structured the code, the mainview.qml file loads the first tab upon Component.onCompleted. If the user presses the "Settings" tab, the loader will load the QML file that defines the "Settings" page. And so on. Since all five pages have the five tabs, I was wondering if I could make those tabs "global" in the mainview.qml file so I won't have to repeat the code for them in each QML file.

    1 Reply Last reply
    0
    • Y Offline
      Y Offline
      Yaswanth
      wrote on last edited by
      #2

      Instead of creating 5 diff pages, in the mainview.qml, you can create 2 loaders.
      One loader for 5 buttons and another loader to load the respective page on button selection.

      1 Reply Last reply
      1

      • Login

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