Results 1 to 5 of 5

Thread: How to come out of the execution when cancel button is clicked??

  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 come out of the execution when cancel button is clicked??

    I am having a function in which it executes another dialog with its class name. In that dialog there is a cancel button. I need to do is, when the cancel button is clicked it should come out of the entire thing. How to do this??

  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 come out of the execution when cancel button is clicked??

    connect the "clicked()"-signal of the button with the "close()"-slot of your dialog

  3. #3
    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 Re: How to come out of the execution when cancel button is clicked??

    I am executing the dialog from other dialog class using its object. How to connect with the clicked() signal??

  4. #4
    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 come out of the execution when cancel button is clicked??

    sorry, were going back to your old problem. please, describe more precisely, what you want.

    you have dialog A and dialog B. which dialog has the close()-button? which dialog do you want to close when the button is clicked?

  5. #5
    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 come out of the execution when cancel button is clicked??

    If you want a button/tool button/menu to attempt to quit the entire program connect its clicked() or triggered() signal to the QApplication::quit() slot. It doesn't matter if the button is on a dialog (or which dialog), a tool bar or menu.

    To anticipate your next question: you access the application object through the global qApp pointer.

Similar Threads

  1. QFileDialog::getSaveFileName Cancel Button
    By penny in forum Qt Programming
    Replies: 1
    Last Post: 8th April 2011, 16:46
  2. QRunnable - how to cancel execution?
    By TorAn in forum Qt Programming
    Replies: 1
    Last Post: 3rd March 2010, 19:11
  3. Replies: 1
    Last Post: 17th February 2010, 23:17
  4. QDialog, editingFinished, and Cancel Button.
    By jeffpogo in forum Qt Programming
    Replies: 8
    Last Post: 3rd June 2009, 03:22
  5. How to show QProgressDialog without cancel button
    By rajesh in forum Qt Programming
    Replies: 1
    Last Post: 30th January 2007, 09:53

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.