Results 1 to 4 of 4

Thread: What is the best way to popup an option dialog before the program starts?

  1. #1
    Join Date
    Dec 2006
    Posts
    9
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    2

    Default What is the best way to popup an option dialog before the program starts?

    I would like to know what's the best way to popup a dialog, from which the user could select an option before the main window of the program starts.
    I can’t just show both, because the MainWindow needs to know the option selected in the first dialog to work properly, so I need to freeze somehow the process until the user selected the option in the first dialog.
    I was wondering what's the best approach to make this work? Use qthreads, qtimer, use some QCoreApplication commands or maybe there is an ever better way.

    I’m a novice and I don’t know yet the proper way to do it, thank you if you can help me.

  2. #2
    Join Date
    May 2006
    Posts
    32
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    1
    Thanked 5 Times in 4 Posts

    Default Re: What is the best way to popup an option dialog before the program starts?

    Hello,

    I know this well in Qt 3.3.x. You can use this example application under Qt 3.3.3 ..

    /usr/share/doc/qt-devel-3.3.3/examples/i18n/

    You may get some help!

    Regards,

  3. #3
    Join Date
    Jan 2006
    Location
    Kerala
    Posts
    371
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    76
    Thanked 37 Times in 32 Posts

    Default Re: What is the best way to popup an option dialog before the program starts?

    You could do something like this

    Qt Code:
    1. int main( ... ) {
    2. QApplication app( ... );
    3.  
    4. OptionsDialog dlg;
    5. [...]
    6. if( dlg.exec() != QDailog::Accepted )
    7. return 0; // Terminate if Options not set or may be set defaults
    8.  
    9. // Get the Options, could use a structure for that
    10. Options options = dlg.options();
    11. MainWindow w;
    12. w.setOptions( options );
    13. w.show();
    14. app.exec();
    15. }
    To copy to clipboard, switch view to plain text mode 

    you can also try to create the Options Dialog dynamically
    We can't solve problems by using the same kind of thinking we used when we created them

  4. The following user says thank you to sunil.thaha for this useful post:

    Dauntless (22nd February 2007)

  5. #4
    Join Date
    Dec 2006
    Posts
    9
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    2

    Default Re: What is the best way to popup an option dialog before the program starts?

    Great answer sunil.thaha, that's exactly what I wanted. I knew there must be a better way to do this, thank you for giving me such a smart solution.

    Thanks sarode for the reference, it is related to what I needed, but I am glad I found an even cleaner way to do it thanks to sunil.thaha comment.

Similar Threads

  1. QT MySQL
    By sabeeshcs in forum Newbie
    Replies: 6
    Last Post: 12th January 2007, 05:19
  2. how to create a popup dialog
    By Morea in forum Qt Programming
    Replies: 1
    Last Post: 19th November 2006, 17:40
  3. dialog box
    By Bahar in forum Qt Programming
    Replies: 3
    Last Post: 31st January 2006, 15:52

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
  •  
Qt is a trademark of The Qt Company.