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