Results 1 to 4 of 4

Thread: QDialog - OnInitDialog equivalent

  1. #1
    Join Date
    Aug 2008
    Location
    Texas, USA
    Posts
    44
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default QDialog - OnInitDialog equivalent

    Is there a signal that gets emitted when a QDialog has it's exec() called? Basically I want it so that when the dialog is displayed I want to initalize some settings that I don't necessarily want to do in the constructor of my subclassed QDialog.

    In MFC a dialog would have it's OnInitDialog function called.

    If there is no signal do I just override exec()......do my inital updates in there then call the base classes exec() ?

    Thanks

  2. #2
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QDialog - OnInitDialog equivalent

    Thats what I would do. Just note that exec() isn't virtual (Not really a problem in most cases, as you'll typically be passing around your subclassed type anyway).

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

    GimpMaster (31st March 2010)

  4. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QDialog - OnInitDialog equivalent

    You can reimplement showEvent() or use QMetaObject::invokeMethod() with QueuedConnection to execute a slot when the control returns to the event loop (so definitely after the constructor has already finished).
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #4
    Join Date
    Aug 2008
    Location
    Texas, USA
    Posts
    44
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QDialog - OnInitDialog equivalent

    Thank you both.

Similar Threads

  1. closing a Qdialog called from a Qdialog
    By OverTheOCean in forum Qt Programming
    Replies: 3
    Last Post: 28th September 2009, 08:02
  2. equivalent
    By deepa.selvaraj in forum Qt Programming
    Replies: 3
    Last Post: 12th November 2007, 18:33
  3. Qt-equivalent of pthread_once
    By ShaChris23 in forum Newbie
    Replies: 1
    Last Post: 15th October 2007, 21:57
  4. CMapWordToOb QT4 equivalent
    By steg90 in forum Newbie
    Replies: 3
    Last Post: 10th May 2007, 08:10
  5. setRasterOp Equivalent
    By vermarajeev in forum Qt Programming
    Replies: 22
    Last Post: 31st March 2007, 13:13

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.