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. Is there some kind of destroy/close event for QQuickItem?
Forum Updated to NodeBB v4.3 + New Features

Is there some kind of destroy/close event for QQuickItem?

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 2 Posters 1.3k 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.
  • C Offline
    C Offline
    clementvuchener
    wrote on last edited by
    #1

    I need to send a HTTP request when my custom QQuickItem is destroyed. I did it in the destructor but when I exit the app, QNetworkManager::post is called but the request is not sent (according to Wireshark). I think that is because the event loop already exited. Is there a signal or event triggered when the application exits or the item is destroyed that I can catch from a QQuickItem?

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

      Handle the close event in the QQuickWindow or QQuickView. You have to reimplement event() in a subclass since there is no virtual closeEvent() function in QWindow. Then handle QEvent::Close, call the base class implementation for all other event types. In the Close event handler change the event's accepted flag to false so the window won't actually close. Then initate whatever you need doing. When it's done, exit the app (and make sure your close event handler recognizes this and accepts the event)

      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