This forum has been archived. All content is frozen. Please use KDE Discuss instead.

[SOLVED] QTimer usage

Tags: None
(comma "," separated)
cyberwizzard
Registered Member
Posts
29
Karma
0

[SOLVED] QTimer usage

Tue Jan 27, 2009 4:12 pm
Next up on the list of problems: setTimeout not known.

I found a QTimer class but whatever I try, I keep getting errors. I read somewhere that a QObject should have a setTimeout function - but this also fails.

Does anyone have an example of this? I actually need a timer that fires only once and a timer which fires roughly each second.

I tried a busy loop for the fire once timer but the result is exactly what I expected and ofcourse not what I want... Anyone?

Last edited by cyberwizzard on Thu Jan 29, 2009 2:05 pm, edited 1 time in total.


User avatar
eean
KDE Developer
Posts
1016
Karma
0
OS

Re: QTimer

Wed Jan 28, 2009 10:01 pm
http://amarok.kde.org/qtscriptbindings/qtimer.html has the barebone JavaScript docs. You can see that it doesn't derive from QObject and doesn't have a 'setTimeout' function. Check with these docs when things aren't matching up.


Amarok Developer
cyberwizzard
Registered Member
Posts
29
Karma
0

Re: QTimer

Thu Jan 29, 2009 2:05 pm
I figured it out (yay) - to leave an example for others:
Code: Select all
var qo = new QObject();
qo.count = 0;
qo.event = function(qevent) {
    this.count++;
    if(this.count >= 3) this.killTimer(qo.timerID);
    Amarok.alert("event " + qo.count + " " + qevent);
    return true;
}
qo.timerID = qo.startTimer(3000);




Bookmarks



Who is online

Registered users: bancha, Bing [Bot], daret, Evergrowing, Google [Bot], lockheed, sandyvee, Sogou [Bot]