PDA

View Full Version : problem with start timer



ramin.lich
30th August 2014, 19:35
hi
every time when i press the push Button Timer will Add 1 sec
I Want To Start Timer And Goes Up Like Stopwatch


{
ui->setupUi(this);
_second=0;
_time.setHMS(0,0,0,0);
startTimer(1000);
}

MainWindow::~MainWindow()
{
delete ui;
}

void MainWindow::on_timerEvent_clicked()
{
_second++;
QTime t= _time.addSecs(_second);
ui->LCurrenTtime->setText(t.toString());
}

what im doing wrong?

anda_skoa
31st August 2014, 13:57
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,
_