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. Slots: delete(Later) passed in pointers from signal (in general)?
Forum Updated to NodeBB v4.3 + New Features

Slots: delete(Later) passed in pointers from signal (in general)?

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 2 Posters 169 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.
  • uaniU Offline
    uaniU Offline
    uani
    wrote on last edited by
    #1

    Hi,

    slots can have a pointer parameter set from the signal

    void slotFunction(className* pointerToObjectOfTypeClassName);
    

    Should i delete (or deleteLater) that pointer?

    I shall for QNetworkAccessManager::finished, see https://doc.qt.io/qt-6/qnetworkaccessmanager.html#finished, but "QWheelEvent" documentation does not state so.

    I asked this specifically for QWheelEvent in https://forum.qt.io/topic/140883/qtwheelevent-in-signal-from-handler-should-i-delete-it but perhaps Qt has a general rule about this.

    jsulmJ 1 Reply Last reply
    0
    • uaniU uani

      Hi,

      slots can have a pointer parameter set from the signal

      void slotFunction(className* pointerToObjectOfTypeClassName);
      

      Should i delete (or deleteLater) that pointer?

      I shall for QNetworkAccessManager::finished, see https://doc.qt.io/qt-6/qnetworkaccessmanager.html#finished, but "QWheelEvent" documentation does not state so.

      I asked this specifically for QWheelEvent in https://forum.qt.io/topic/140883/qtwheelevent-in-signal-from-handler-should-i-delete-it but perhaps Qt has a general rule about this.

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @uani said in Slots: delete(Later) passed in pointers from signal (in general)?:

      but "QWheelEvent" documentation does not state so.

      You do not have to delete the events! That is done by Qt.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      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