Results 1 to 2 of 2

Thread: deleting qaction

  1. #1
    Join Date
    Oct 2006
    Location
    Raleigh, NC
    Posts
    11
    Thanks
    6
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Question deleting qaction

    Hi,

    Do I need to delete QAction after I add them to a QMenu?? The examples don't seem to delete them?

    Will this leak memory?
    Qt Code:
    1. QMenu menu;
    2. menu.addAction(new Action("test", null));
    To copy to clipboard, switch view to plain text mode 

    Thanks
    Hua-Ying

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: deleting qaction

    If you delete a QAction, it will be removed from the menu. But don't pass "null" as a pointer to the parent, but instead use a pointer to some QObject (like the QMenu object you create).

Similar Threads

  1. QAction
    By mickey in forum Qt Programming
    Replies: 7
    Last Post: 17th July 2006, 09:42
  2. Replies: 1
    Last Post: 18th March 2006, 16:37
  3. Replies: 2
    Last Post: 23rd February 2006, 16:38
  4. Replies: 4
    Last Post: 13th February 2006, 11:35

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.