Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED] Will parent delete QAction created with new QAction(this)?
Qt 6.11 is out! See what's new in the release blog

[SOLVED] Will parent delete QAction created with new QAction(this)?

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

    Hi all,
    have following question answer of which I can't find in Qt docs:
    If I create QAction instance like:
    @QAction * act = new QAction(this);@
    and this is an subclass of QObject(in my situation it is an subclass of QWebView), will be this QAction instance deleted on destruction of it parent(this), or should I take care of it?

    And one more question: what will be the behavior of deleteLater if the object got deleted before deleteLater slot will be executed? Is there any checks or maybe it gots disconnected from all signals on destruction?

    God is Real unless explicitly declared as Integer.

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

      Yes, QAction inherits QObject, it will be deleted just like every other QObject in parent-child hierarchy.

      As for deleteLater() - I don't know. You can always check :)

      (Z(:^

      1 Reply Last reply
      0
      • A Offline
        A Offline
        AcerExtensa
        wrote on last edited by
        #3

        OK, thanks siedzio, I'll try it out... :)

        God is Real unless explicitly declared as Integer.

        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