Results 1 to 5 of 5

Thread: how to distroy child window which parents is zero

  1. #1
    Join Date
    May 2006
    Location
    Bangalore,India
    Posts
    235
    Thanks
    7
    Thanked 25 Times in 24 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Question how to distroy child window which parents is zero

    how to distroy child window which parents is zero, when exiting from application.
    If parent is 0, the new widget becomes a window. then how to distroy explicitly?

    in the following examples, how to distroy uartDetachedWidget ?
    void UartTab::detachWindow()
    {
    uartDetachedWidget = new UartWidget(0,m_uartNo, true);
    uartDetachedWidget->show();
    }

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: how to distroy child window which parents is zero

    Set attribute Qt::WA_DeleteOnClose or store it as a member variable and delete manually in the destructor.
    J-P Nurmi

  3. #3
    Join Date
    May 2006
    Location
    Bangalore,India
    Posts
    235
    Thanks
    7
    Thanked 25 Times in 24 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Question Re: how to distroy child window which parents is zero

    hello JPN,

    how to delete manually in the destructor of parent class?

    Regards
    Rajesh

  4. #4
    Join Date
    Jan 2006
    Location
    Ukraine,Lviv
    Posts
    454
    Thanks
    9
    Thanked 27 Times in 27 Posts
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Exclamation Re: how to distroy child window which parents is zero

    Qt Code:
    1. class UartTab
    2. {
    3. // all others members here
    4.  
    5. private:
    6. QWidget *uartDetachedWidget ;
    7. }
    8.  
    9. UartTab::~UartTab()
    10. {
    11. delete uartDetachedWidget;
    12. }
    To copy to clipboard, switch view to plain text mode 
    a life without programming is like an empty bottle

  5. #5
    Join Date
    May 2006
    Location
    Bangalore,India
    Posts
    235
    Thanks
    7
    Thanked 25 Times in 24 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Exclamation Re: how to distroy child window which parents is zero

    following code not working, means not closing the window.

    UartTab::~UartTab()
    {
    delete uartDetachedWidget;
    }

Similar Threads

  1. cannot make a main window modal
    By Dark_Tower in forum Qt Programming
    Replies: 12
    Last Post: 23rd March 2006, 10:21

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.