Results 1 to 2 of 2

Thread: problem with start timer

  1. #1
    Join Date
    Aug 2014
    Posts
    28
    Thanks
    15
    Qt products
    Qt5
    Platforms
    Windows

    Exclamation problem with start timer

    hi
    every time when i press the push Button Timer will Add 1 sec
    I Want To Start Timer And Goes Up Like Stopwatch

    Qt Code:
    1. {
    2. ui->setupUi(this);
    3. _second=0;
    4. _time.setHMS(0,0,0,0);
    5. startTimer(1000);
    6. }
    7.  
    8. MainWindow::~MainWindow()
    9. {
    10. delete ui;
    11. }
    12.  
    13. void MainWindow::on_timerEvent_clicked()
    14. {
    15. _second++;
    16. QTime t= _time.addSecs(_second);
    17. ui->LCurrenTtime->setText(t.toString());
    18. }
    To copy to clipboard, switch view to plain text mode 
    what im doing wrong?

  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: problem with start timer

    I guess you want to use a QTimer, start it on button click and update the display in the slot connected to its timeout() signal.

    Cheers,
    _

Similar Threads

  1. Strange problem with timer
    By nagabathula in forum Qt Programming
    Replies: 12
    Last Post: 13th April 2011, 11:13
  2. timer problem(timer does not work)
    By masuk in forum Newbie
    Replies: 6
    Last Post: 14th February 2011, 06:00
  3. QSerialDevice problem to start in GUi
    By ssaku in forum Qt Quick
    Replies: 9
    Last Post: 6th December 2010, 09:51
  4. Thread, Timer and Socket. Comuication problem
    By ^NyAw^ in forum Qt Programming
    Replies: 6
    Last Post: 17th January 2008, 17:48
  5. Problem about timer in multithread programs
    By vql in forum General Programming
    Replies: 4
    Last Post: 17th October 2007, 16:00

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.