QObject::startTimer(), what this QTimer or QBasicTimer? Why "Wyggly" example use QBasicTimer instead QObject::startTimer()?
QObject::startTimer(), what this QTimer or QBasicTimer? Why "Wyggly" example use QBasicTimer instead QObject::startTimer()?
QBasicTimer is light-weight; there's no signals and slots involved like in QTimer. QBasicTimer is still a bit more convenient to use than startTimer().
J-P Nurmi
J-P Nurmi
QObject::startTimer() don't use QTimer or QBasicTimer:
startTimer()->eventDispatcher->SetTimer() (winapi)
so QObject::startTimer more lightweight than QTimer or QBasicTimer and i don't understand why QBasicTimer used in "Wyggly" example. May be this just don't good example.
Isn't that what I just said?
startTimer()->eventDispatcher->SetTimer() (winapi)
so QObject::startTimer more lightweight than QTimer or QBasicTimer and i don't understand why QBasicTimer used in "Wyggly" example. May be this just don't good example.
- QObject::startTimer() is the lowest-level timer available in Qt.
- QBasicTimer brings more convenience, but it's basically the same than using QObject::startTimer() but more convenient.
- QTimer is a high-level timer class. Very easy and convenient to use. Hides the timer events from the application developer. Just create a timer object, connect signals and slots, start the timer and you're done.
- The Wyggle example was chosen to demonstrate the usage of QBasicTimer. Isn't it nice that there is at least some example using QBasicTimer? Most of them use QTimer instead, just like recommended by QBasicTimer docs.
J-P Nurmi
Yes, i see your post after my reply. But this very strange:
Qt Code:
{ ... if (interval < 0) { qWarning("QObject::startTimer: QTimer cannot have a negative interval"); return 0; }To copy to clipboard, switch view to plain text mode
Don't used, but talking about QTimer.
Well, I admit that the comment looks peculiar at first sight, but it really makes sense because QObject::startTimer() is rarely used directly, but mostly via QTimer. Besides, this way the warning is fully understandable to both QObject::startTimer() and QTimer users, isn't it?
J-P Nurmi
Bookmarks