Results 1 to 4 of 4

Thread: Interrupt QProcessDialog by other dialog

  1. #1
    Join Date
    May 2011
    Posts
    11
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Interrupt QProcessDialog by other dialog

    hi,

    I have to store a lot of elements into a database. That takes some time and a progress dialog is necessary to give feedback to the user. Sometimes an element is already in the database and the user has to decide to skip or to replace it. Now the dialog querying the users decision pops up and the QProgressDialog shadows it. If the user closes the QProgressDialog to answer the query the progress dialog is flagged as cancelled resulting in an abort of the operation.

    It would need some method to pause the progress dialog, hiding it and passing control to the query dialog and after the user has answered the progress dialog is reactivated again. Probably the solution is easy if I would have a clue what to look for. Any idea? hide() and show() won't work as the hide timeout of the QProgressDialog will interfere.

    thanks

    Oliver

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Interrupt QProcessDialog by other dialog

    You just need pass the progress dialog as the parent to the new dialog.

    Cheers,
    _

  3. #3
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: Interrupt QProcessDialog by other dialog

    Just set the QProgressDialog as the parent of the new dialog which is being showed up.

    A small example
    Qt Code:
    1. int main(int argc, char * argv[])
    2. {
    3. QApplication app(argc, argv);
    4.  
    5.  
    6. int value = 100;
    7. dialog.setMaximum(value);
    8. dialog.show();
    9.  
    10. for(int i = 0; i <= value; i++)
    11. {
    12. app.thread()->msleep(1000);
    13. dialog.setValue(i);
    14. app.processEvents();
    15.  
    16. if((i%10) == 0)
    17. {
    18. QMessageBox::information(&dialog, "Message", "Click OK to Continue");
    19. }
    20. }
    21.  
    22. return 0;
    23. }
    To copy to clipboard, switch view to plain text mode 
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

  4. #4
    Join Date
    May 2011
    Posts
    11
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Interrupt QProcessDialog by other dialog

    Thanks! Oh gosh, why didn't I think of this. I knew this will end up embarrassing for me.

Similar Threads

  1. Interrupt in Qt Event
    By Lisi in forum Qt Programming
    Replies: 4
    Last Post: 29th October 2012, 10:32
  2. How to interrupt QScriptValu::call()
    By QtIsCute in forum Newbie
    Replies: 9
    Last Post: 21st July 2012, 12:05
  3. Replies: 2
    Last Post: 7th June 2011, 08:24
  4. Sending OS I/O interrupt signals!
    By nofortee in forum Qt Programming
    Replies: 6
    Last Post: 13th July 2010, 15:42
  5. Replies: 1
    Last Post: 17th February 2010, 23:17

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.