Results 1 to 2 of 2

Thread: Close window on close()

  1. #1

    Default Close window on close()

    I have a QWidget object, with a cancel button connected to a cancelClicked() slot. this slot is doing a widget->close(). Earlier, when i create this widget, I also set attribute:
    Qt Code:
    1. this->setAttribute(Qt::WA_DeleteOnClose) ;
    To copy to clipboard, switch view to plain text mode 
    .

    On click on cancel, the most part of the widget closes, but it remains an ugly header (or ribbon if you prefer), with on the left the words "Form" and on the right a cross to close the widget. If i click on the cross, this ribbon disappears.

    Do you know how to programmatically delete this ribbon as well ?

    Thanks

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: Close window on close()

    One quick try would to hide() the widget before close().

    As such the problem appears to do someting with QWidget parent/child relationship of the ribbon widget. I guess you are implmenting a custom QWidget with custom ribbon (and or other widget on it), make sure the widgets are properly assigned with proper parent.
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

Similar Threads

  1. X11 close window by WId
    By webstar2568 in forum Qt Programming
    Replies: 3
    Last Post: 22nd May 2014, 09:57
  2. midi child does not close when I call close()
    By qlands in forum Qt Programming
    Replies: 7
    Last Post: 29th July 2011, 22:25
  3. Qt4 - How to close a window?
    By ankeetguha in forum Newbie
    Replies: 1
    Last Post: 30th May 2011, 09:42
  4. Replies: 2
    Last Post: 17th December 2010, 19:01
  5. Replies: 9
    Last Post: 16th May 2010, 16:21

Tags for this Thread

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.