Results 1 to 2 of 2

Thread: QMdiSubWindows - Deleting

  1. #1
    Join Date
    Aug 2009
    Posts
    14
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default QMdiSubWindows - Deleting

    I'm writing an application using QT that involves using the QMdiArea and consequently the creation of QMdiSubwindows.

    Creating a sub window is fine, using QMdiArea::createSubWindow but when it comes to deleting them I have one question puzzling me.

    My child windows are created automatically when a device is plugged into a USB port, and similarly the window is automatically closed should the device be detached from the USB port, and I do this with the QMdiArea::removeSubWindow(). I notice in the QT documentation that this function does not delete the QMdiSubWindow passed to it, and if I try

    Qt Code:
    1. delete mdiSubWindow
    To copy to clipboard, switch view to plain text mode 

    The application crashes.. so just how am I supposed to delete it from memory, or have I misunderstood the documentation ?

  2. #2
    Join Date
    Mar 2008
    Posts
    27
    Thanks
    1
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QMdiSubWindows - Deleting

    Does it help if you use deleteLater() instead of delete directly?
    Also, perhaps the subwindow gets removed from the mdiArea automatically after it has been deleted.

Similar Threads

  1. Deleting objects in their event handler
    By drhex in forum Qt Programming
    Replies: 7
    Last Post: 6th May 2009, 16:08
  2. deleting all elements in a qlist
    By reshma in forum Qt Programming
    Replies: 4
    Last Post: 12th March 2009, 20:27
  3. Replies: 1
    Last Post: 2nd August 2008, 10:05
  4. Deleting a scene from QGraphicsItem mouseEvent
    By JonathanForQT4 in forum Qt Programming
    Replies: 5
    Last Post: 10th April 2007, 11:27
  5. 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.