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 variable JS saved between runs with Settings

Global variable JS saved between runs with Settings

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
settingsqml + js
1 Posts 1 Posters 375 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.
  • A Offline
    A Offline
    arjun30
    wrote on 31 Jul 2020, 00:17 last edited by
    #1

    I have been working on a projet where I have used a StackView to switch between different pages. These pages are on different qml files. For one thing, I needed a variable accessible and editable to all the qml files/pages. I did a bit of research online and essentially created a separate JS file with .pragma library and the variable I needed. I then imported the file into each of my qml files and edited that variable. This was working fine. However, I ran into a problem. For a normal property defined inside the qml file, I can use a Settings object to save the value between runs. However, I cannot figure out how to do the same thing with my new variable in the javascript file without getting an error.
    Does anyone know any alternative ways for me to have a variable to use between qml files or a solution for me to save the value of that variable between runs?

    1 Reply Last reply
    0

    1/1

    31 Jul 2020, 00: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