I have Problem when i activate QTimer
To Show A clock inside a Qlabel
, my small software will use around 25 to 40 % of CPU Power (I3 4160) so how to solve it to take less hardware resources?
QTimer *timer1 = new QTimer(this);
connect(timer1,SIGNAL(timeout()),this,SLOT(showtime()));
timer1->start();
and this is my showtime() function
void Findlistrecord::showtime(){
QTime time = QTime::currentTime();
QString time_totext = time.toString("hh : mm : ss");
ui->timelabel->setText(time_totext);
}
As I see you didn't set an interval for you timer, so your timer will trigger as soon as it can. If you want to show the time with seconds accuracy I recommend that to use interval of 1000ms to reduce the process overhead.
timer1->start(1000);