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. Qt::QueuedConnection from QML
Forum Updated to NodeBB v4.3 + New Features

Qt::QueuedConnection from QML

Scheduled Pinned Locked Moved QML and Qt Quick
5 Posts 3 Posters 4.2k 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.
  • B Offline
    B Offline
    beemaster
    wrote on last edited by
    #1

    0 down vote favorite
    share [g+] share [fb] share [tw]

    I have C++ class emitting signal and QML slot. I need to execute slot in the same thread after program returns to the event loop.
    How can I achieve something like this?

    @Connections {
    target: box2dCppEngine
    onBulletCollided: box2dCppEngine.deleteObject(bullet)
    connectionType: Qt.QueuedConnection
    }
    @

    I need this because I can not execute deleteObject, while processing the collision, I need to do this after world step.

    1 Reply Last reply
    0
    • C Offline
      C Offline
      capisce
      wrote on last edited by
      #2

      Maybe you could make deleteObject() itself use deleteLater() ?

      1 Reply Last reply
      0
      • B Offline
        B Offline
        beemaster
        wrote on last edited by
        #3

        Maybe, but this forces me to make all my objects derived from QObject, which I don't like.

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mlong
          wrote on last edited by
          #4

          bq. Maybe, but this forces me to make all my objects derived from QObject, which I don’t like.

          Why don't you like it? Any particular reasons? QObjects are pretty ubiquitous. :-)

          Software Engineer
          My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

          1 Reply Last reply
          0
          • C Offline
            C Offline
            capisce
            wrote on last edited by
            #5

            Or make box2dCppEngine.deleteObject() add the object to a list and trigger a 0-timer to delete the objects in the list.

            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