Results 1 to 2 of 2

Thread: Little Qtimer problem

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jun 2010
    Posts
    19
    Qt products
    Qt4
    Platforms
    Windows

    Default Little Qtimer problem

    Hi !

    if a situation meeting certain conditions occurs, I display a warning message (with a QMessageBox). I use a QTimer to remind the user 5 minutes later that the situation is still happening :

    Qt Code:
    1. void data::data()
    2. {
    3. warning1=true;
    4. }
    5.  
    6. void data::event ()
    7. {
    8. Qtimer *timer2 = new QTimer(this);
    9. QObject::connect( timer2, SIGNAL(timeout()),this,SLOT(warning1_timer2()));
    10.  
    11. if (((condition1)||(condition2))&&(warning1) ) //Conditions
    12. {
    13. warning1=false;
    14. int answer = QMessageBox::warning(this, "Problem detected",QMessageBox::Ok);
    15. if (answer == QMessageBox::Ok)
    16. {
    17. timer2->start(300000);
    18.  
    19. }
    20.  
    21. }
    22. }
    23.  
    24. void Data::warning1_timer2()
    25. {
    26.  
    27. warning1=true;
    28. }
    To copy to clipboard, switch view to plain text mode 

    This works when the situation occurs once...If the situation is still occuring five minutes later, the QMessageBox appears once again but freezes..I know this is due to the statement timer2->start();, but I can't find how to solve my problem!!!

    Thanks for your help !!!
    Last edited by gen_mass; 22nd July 2010 at 20:42.

Similar Threads

  1. problem in qtimer
    By mohanakrishnan in forum Qt Programming
    Replies: 4
    Last Post: 26th November 2009, 11:55
  2. Problem with QTimer
    By hosseinyounesi in forum Qt Programming
    Replies: 4
    Last Post: 10th April 2009, 21:51
  3. problem with QTimer
    By salmanmanekia in forum Qt Programming
    Replies: 1
    Last Post: 13th August 2008, 13:22
  4. Problem about QTimer
    By pawer in forum Qt Programming
    Replies: 5
    Last Post: 22nd January 2008, 13:02
  5. QTimer problem
    By vv in forum Qt Programming
    Replies: 9
    Last Post: 3rd July 2007, 08: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
  •  
Qt is a trademark of The Qt Company.