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. C++/QML interaction, lifecycle, ...
Forum Updated to NodeBB v4.3 + New Features

C++/QML interaction, lifecycle, ...

Scheduled Pinned Locked Moved Solved QML and Qt Quick
4 Posts 3 Posters 495 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.
  • TryumT Offline
    TryumT Offline
    Tryum
    wrote on last edited by
    #1

    I created a helper class to upload data from QML, instantiated as an element of a page.

    When the upload is finnished, the C++ object emits a uploadSuccess
    signal, which is bound in QML to a stack.pop() action, which make my app crash.

    By poping the page that holds the instantiated C++ object, am I deleting an object in the call stack ?

    As a work-around, I use a Timer that is started on the uploadSuccess and calls stack.pop() afterward.
    I guess there are beter ways to achieve that, but I have no clue how, any suggestion ?

    Thanks.

    T.

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      Yes, StackView owns the items, as stated in the docs.

      You can use Qt.callLater() doc to defer the call to pop().

      Or, if you are stuck on COntrols v1, you can set the StackView to keep objects alive: see destroOnPop property. I think it also (unofficially) works with new controls, but I'm not sure.

      (Z(:^

      TryumT 1 Reply Last reply
      2
      • GrecKoG Offline
        GrecKoG Offline
        GrecKo
        Qt Champions 2018
        wrote on last edited by
        #3

        Use a debugger and find out why your application crashes. I guess your c++ helper is misbehaving

        1 Reply Last reply
        0
        • sierdzioS sierdzio

          Yes, StackView owns the items, as stated in the docs.

          You can use Qt.callLater() doc to defer the call to pop().

          Or, if you are stuck on COntrols v1, you can set the StackView to keep objects alive: see destroOnPop property. I think it also (unofficially) works with new controls, but I'm not sure.

          TryumT Offline
          TryumT Offline
          Tryum
          wrote on last edited by
          #4

          @sierdzio said in C++/QML interaction, lifecycle, ...:

          Yes, StackView owns the items, as stated in the docs.

          You can use Qt.callLater() doc to defer the call to pop().

          Or, if you are stuck on COntrols v1, you can set the StackView to keep objects alive: see destroOnPop property. I think it also (unofficially) works with new controls, but I'm not sure.

          Thanks ! I was actually thinking of doing some queued connection... but didn't know how to do that whith QML, Qt.callLater() gives a nice alternative !

          @GrecKo said in C++/QML interaction, lifecycle, ...:

          Use a debugger and find out why your application crashes. I guess your c++ helper is misbehaving

          I tried to, but got no symboles to help with the stack trace.

          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