Results 1 to 2 of 2

Thread: How to trigger a method after closing a dialog box

  1. #1
    Join Date
    Sep 2017
    Posts
    29
    Thanks
    3
    Thanked 2 Times in 2 Posts
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Windows

    Default How to trigger a method after closing a dialog box

    I made a simple tool application. There is a settings button that opens a settings dialog window.
    There is a save button that saves the settings and closes the window. What i want is
    how to make the main window execute a particular function when the dialog is closed.
    I am noob. Are you noob? Lets learn Qt together! https://qtnoobies.blogspot.com/

  2. #2
    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 trigger a method after closing a dialog box

    Is the dialog opened as modal or non-modal (i.e. QDialog::exec() or show()) ?

    If opened modal then simply check the QDialog::exec() return value to see if it was Accepted or Rejected and act accordingly.
    If opened non-modal then connect a slot to the accepted() signal from the dialog and do things there.
    "We can't solve problems by using the same kind of thinking we used when we created them." -- Einstein
    If you are posting code then please use [code] [/code] tags around it - makes addressing the problem easier.

  3. The following user says thank you to ChrisW67 for this useful post:

    GeneCode (21st November 2017)

Similar Threads

  1. Passing data to dialog via dialog or a method
    By mtnbiker66 in forum Qt Programming
    Replies: 2
    Last Post: 3rd February 2012, 01:39
  2. Replies: 0
    Last Post: 8th March 2011, 22:08
  3. Replies: 2
    Last Post: 30th July 2010, 16:44
  4. closing child dialog closes parent dialog
    By sparticus_37 in forum Newbie
    Replies: 2
    Last Post: 28th May 2010, 19:46
  5. Dialog is not closing
    By manmohan in forum Newbie
    Replies: 5
    Last Post: 1st December 2008, 17:04

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.