Is there some kind of destroy/close event for QQuickItem?
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?
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)