[Qt-interest] how to set up loop with timer
Hannu Shemeikka
hps at shemeikka.org
Thu May 6 09:55:49 CEST 2010
Hi,
You could use something like this:
timer = new QTimer(this);
connect(this->timer, SIGNAL(timeout()), rThread, SLOT(yourSlotName()));
this->timer->start(2000); // 1 = 1 ms
This fires slot 'yourSlotName' in rThread (another QThread class) every
2 seconds.
Or in the constructor of your thread:
timer = new QTimer(this);
connect(this->timer, SIGNAL(timeout()), this, SLOT(yourSlotName()));
this->timer->start(2000); // 1 = 1 ms
- Hannu
On Thu, 2010-05-06 at 10:48 +0300, Meir Yanovich wrote:
> Yes i was reading the docs but there is a lots of options to implement
> timers
> what will be the simple way to to that ?
> you have the :
>
> QObject::startTimer also
>
>
> On Thu, May 6, 2010 at 10:36 AM, Guido Seifert <Wargand at gmx.de> wrote:
>
> Hi,
> definitely NOT using a loop like in your example. You might
> want to read up on
> QTimer: http://doc.qt.nokia.com/4.6/qtimer.html
>
> Guido
>
>
>
>
> > Hello all
> > as beginner in QT framework i have thread that needs to
> invoke function
> > every N seconds
> > what will be the best way and memory officiant to implement
> it in QT
> > something like :
> >
> > while(1)
> > {
> > ... somekind OT timer invoking function every N seconds ...
> > }
>
>
> --
> GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
> Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
More information about the Qt-interest-old
mailing list