Results 1 to 3 of 3

Thread: How to close the dialog using close(X) button or cancel push button?

  1. #1
    Join Date
    Mar 2011
    Location
    Coimbatore,TamilNadu,India
    Posts
    382
    Thanks
    10
    Thanked 13 Times in 12 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default How to close the dialog using close(X) button or cancel push button?

    How to close the current dialog using X close button or the cancel push button in the dialog? When pressing either of the buttons, the current dialog should close and the rest of the codes should be ignored?

  2. #2
    Join Date
    Oct 2010
    Location
    Berlin, Germany
    Posts
    358
    Thanks
    18
    Thanked 68 Times in 66 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to close the dialog using close(X) button or cancel push button?

    the "x-Button" behaviour is automatically implemented (assuming you mean the button top right which is generated automatically).

    to close via "cancel", you have to connect the clicked()-signal of this button with the "close()"-slot of your dialog.

  3. #3
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: How to close the dialog using close(X) button or cancel push button?

    Groan. Please read at least a few pages of the documentation and try something for yourself before asking how you can implement default behaviour (the close [X] widget) or behaviour that is adequately covered in the QDialog manual page and any number of the bundled examples.

    You want QDialog::reject() to "cancel" the dialog, or QDialog::accept() to "OK" the dialog.

Similar Threads

  1. Replies: 2
    Last Post: 26th April 2011, 11:44
  2. Close button in a tab
    By mitro in forum Newbie
    Replies: 2
    Last Post: 16th May 2008, 10:22
  3. Remove close button on a Dialog in Linux
    By Krish_ng in forum Qt Programming
    Replies: 5
    Last Post: 20th July 2007, 07:10
  4. Replies: 2
    Last Post: 5th February 2007, 17:42
  5. Replies: 3
    Last Post: 16th November 2006, 12:24

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.