Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Updating property by value in QML

Updating property by value in QML

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 1 Posters 345 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
    AkshayFP
    wrote on last edited by AkshayFP
    #1

    I have a main screen that pushes another screen on top of it via a button click.

    In my main.qml, I have some custom component, example:

    ScreenOne {
    id: screenOne
    }
    
    ScreenTwo {
    id: screenTwo
    }
    
    StackView {
    id: stackView
        Componenet,onCompleted: {
            // load welcome screen and then load ScreenOne 
        }
    }
    

    ScreenTwo has a default Boolean property as:

    Item {
       property bool isUser: false
    }
    

    In ScreenOne I have a button that does something like this:

    screenTwo.isUser = true
    stackView.push(screenTwo, StackView.Immediate)
    

    For some reason the value of isUser never changes even after setting its value. How should I make sure that this happens?

    Any help on this is appreciated.

    1 Reply Last reply
    0
    • A Offline
      A Offline
      AkshayFP
      wrote on last edited by
      #2

      Figured it out.

      Send in the properties via push.

      Example:

      stackView.push(screenTwo, {"isUser": true}, StackView.Immediate)
      

      More on this is at https://doc.qt.io/qt-5/qml-qtquick-controls2-stackview.html#push-method

      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