Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. DeleteLater() from within activex event handler
Qt 6.12 LTS is out! See what's new in the release blog

DeleteLater() from within activex event handler

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 3.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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    Hi everyone,

    I made a little modification to examples/activeqt/webbrowser example to show my question.

    Add QExample class declaration to webaxwidget.h.
    It does nothing but alert about deferred deletion of itself.

    @class QExample: public QObject {
    public:
    bool event(QEvent* e)
    {
    if (e->type() == QEvent::DeferredDelete)
    QMessageBox::information(0, "1", "DeferredDelete QExample");
    return QObject::event(e);
    }
    };@

    Add member to MainWindow class

    @class MainWindow : public QMainWindow, public Ui::MainWindow
    {
    ...
    public:
    QExample* ex;
    ...
    }@

    Its initialization

    @MainWindow::MainWindow()
    {
    ex = new QExample;
    ...
    }@

    And deleteLater() it from within NavigateComplete event handler.

    @void MainWindow::on_WebBrowser_NavigateComplete(QString)
    {
    ex->deleteLater();
    ...
    }@

    I expected it must be deleted after application returns to main event loop, but deletion occurs only after closing main window.
    Why?

    Qt 4.8.0 OS windows

    Thanks. Sorry for bad english.

    1 Reply Last reply
    0
    • J Offline
      J Offline
      JulienMaille
      wrote on last edited by
      #2

      5 years later, I came across the same issue. Seems like Deferred deletion does not happen in activeqt.

      JonBJ 1 Reply Last reply
      1
      • J JulienMaille

        5 years later, I came across the same issue. Seems like Deferred deletion does not happen in activeqt.

        JonBJ Offline
        JonBJ Offline
        JonB
        wrote on last edited by
        #3

        @JulienMaille
        Good necro :)

        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
        • Unsolved