Home > Mobile >  Why did generate a random number with a delay in the timer
Why did generate a random number with a delay in the timer

Time:11-23

Why the timer generate a random number with a delay in

This time produce a random number, but there are random number change time delay
QTimer * timer=new QTimer (this);
The timer - & gt; Start (1000);
The connect (timer, & amp; QTimer: : timeout, [=] {
int i;
I=rand () % 3.
The UI - & gt; Mdialog - & gt; SetText (QString: : number (I));
});

This is compared to
QTimer * timer1=new QTimer (this);
Timer1 - & gt; Start (1000);
The connect (timer1, & amp; QTimer: : timeout, [=] {
Static int I=0;
The UI - & gt; LineEdit - & gt; SetText (QString: : number (i++));
});
  •  Tags:  
  • Qt
  • Related