Results 1 to 3 of 3

Thread: Qt Deletelater

  1. #1
    Join Date
    Jan 2007
    Location
    Paris
    Posts
    459
    Thanks
    98
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4 Qt5

    Default Qt Deletelater

    Hey there,

    One of my widget is emiting a "deleteMe" signal on the mouse release event.

    I've come up to this to avoid the "do not delete an object in his event" Qt warning,

    Qt Code:
    1. //=============================================================================
    2. //=============================================================================
    3.  
    4. /* virtual */ void ZeContactWidget::mouseReleaseEvent(QMouseEvent * event)
    5. {
    6. QTimer::singleShot(1, this, SLOT(onEmitClick()));
    7. }
    To copy to clipboard, switch view to plain text mode 

    but I'm not sure that the proper way to do it, even if not crashing :S.
    Do I have to call deleteLater() to delete that widget ?

    Thanks.

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt Deletelater

    Yes, it is best to call deleteLater, if you have no other choices.

    Regards

  3. #3
    Join Date
    Jan 2007
    Location
    Paris
    Posts
    459
    Thanks
    98
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4 Qt5

    Default Re: Qt Deletelater

    And what could other choices be ?

Similar Threads

  1. DeleteLater works... but why?
    By TheGrimace in forum Qt Programming
    Replies: 11
    Last Post: 6th June 2007, 15:14

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.