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. QML pop return value
Qt 6.11 is out! See what's new in the release blog

QML pop return value

Scheduled Pinned Locked Moved Solved QML and Qt Quick
5 Posts 2 Posters 830 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
    felipefontes
    wrote on last edited by
    #1

    I'm using stackview to open a barcode reading page through a form.

    How do I after reading, go back to the previous page and put the reading result in a field on the page?

    raven-worxR 1 Reply Last reply
    0
    • F felipefontes

      I'm using stackview to open a barcode reading page through a form.

      How do I after reading, go back to the previous page and put the reading result in a field on the page?

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by raven-worx
      #2

      @felipefontes

      1. define signal in your page you want to push
      2. when you are done trigger the signal and call Stackview.view.pop() (note the attached property)
      3. when/before pushing connect to that signal and do whatever you want with it

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      F 1 Reply Last reply
      0
      • raven-worxR raven-worx

        @felipefontes

        1. define signal in your page you want to push
        2. when you are done trigger the signal and call Stackview.view.pop() (note the attached property)
        3. when/before pushing connect to that signal and do whatever you want with it
        F Offline
        F Offline
        felipefontes
        wrote on last edited by
        #3

        @raven-worx can you give an example?

        raven-worxR 1 Reply Last reply
        0
        • F felipefontes

          @raven-worx can you give an example?

          raven-worxR Offline
          raven-worxR Offline
          raven-worx
          Moderators
          wrote on last edited by raven-worx
          #4

          @felipefontes

          // MyComponent.qml
          Item {
              signal mySignal(var value)
          
              // somewhere in your code:
              function finish() {
                 mySignal(someValue)
                 Stackview.view.pop()
              }
          }
          
          Item {
              Component {
                id: myComp
               MyComponent {
                 onMySignal: {
                      // do something with "value"
                      // you can also call pop() on the stackview here (instead of in MyComponent)
                }
              }
             
              function pushPage() {
                 myStackView.push( myComp )
              }
          }
          

          --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
          If you have a question please use the forum so others can benefit from the solution in the future

          F 1 Reply Last reply
          2
          • raven-worxR raven-worx

            @felipefontes

            // MyComponent.qml
            Item {
                signal mySignal(var value)
            
                // somewhere in your code:
                function finish() {
                   mySignal(someValue)
                   Stackview.view.pop()
                }
            }
            
            Item {
                Component {
                  id: myComp
                 MyComponent {
                   onMySignal: {
                        // do something with "value"
                        // you can also call pop() on the stackview here (instead of in MyComponent)
                  }
                }
               
                function pushPage() {
                   myStackView.push( myComp )
                }
            }
            
            F Offline
            F Offline
            felipefontes
            wrote on last edited by
            #5

            @raven-worx thank you

            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