diff options
Diffstat (limited to 'doc/html/tqtimer.html')
-rw-r--r-- | doc/html/tqtimer.html | 199 |
1 files changed, 199 insertions, 0 deletions
diff --git a/doc/html/tqtimer.html b/doc/html/tqtimer.html new file mode 100644 index 000000000..d72f394b4 --- /dev/null +++ b/doc/html/tqtimer.html @@ -0,0 +1,199 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/kernel/tqtimer.cpp:42 --> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> +<title>TQTimer Class</title> +<style type="text/css"><!-- +fn { margin-left: 1cm; text-indent: -1cm; } +a:link { color: #004faf; text-decoration: none } +a:visited { color: #672967; text-decoration: none } +body { background: #ffffff; color: black; } +--></style> +</head> +<body> + +<table border="0" cellpadding="0" cellspacing="0" width="100%"> +<tr bgcolor="#E5E5E5"> +<td valign=center> + <a href="index.html"> +<font color="#004faf">Home</font></a> + | <a href="classes.html"> +<font color="#004faf">All Classes</font></a> + | <a href="mainclasses.html"> +<font color="#004faf">Main Classes</font></a> + | <a href="annotated.html"> +<font color="#004faf">Annotated</font></a> + | <a href="groups.html"> +<font color="#004faf">Grouped Classes</font></a> + | <a href="functions.html"> +<font color="#004faf">Functions</font></a> +</td> +<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>TQTimer Class Reference</h1> + +<p>The TQTimer class provides timer signals and single-shot timers. +<a href="#details">More...</a> +<p><tt>#include <<a href="tqtimer-h.html">tqtimer.h</a>></tt> +<p>Inherits <a href="tqobject.html">TQObject</a>. +<p><a href="tqtimer-members.html">List of all member functions.</a> +<h2>Public Members</h2> +<ul> +<li class=fn><a href="#TQTimer"><b>TQTimer</b></a> ( TQObject * parent = 0, const char * name = 0 )</li> +<li class=fn><a href="#~TQTimer"><b>~TQTimer</b></a> ()</li> +<li class=fn>bool <a href="#isActive"><b>isActive</b></a> () const</li> +<li class=fn>int <a href="#start"><b>start</b></a> ( int msec, bool sshot = FALSE )</li> +<li class=fn>void <a href="#changeInterval"><b>changeInterval</b></a> ( int msec )</li> +<li class=fn>void <a href="#stop"><b>stop</b></a> ()</li> +<li class=fn>int <a href="#timerId"><b>timerId</b></a> () const</li> +</ul> +<h2>Signals</h2> +<ul> +<li class=fn>void <a href="#timeout"><b>timeout</b></a> ()</li> +</ul> +<h2>Static Public Members</h2> +<ul> +<li class=fn>void <a href="#singleShot"><b>singleShot</b></a> ( int msec, TQObject * receiver, const char * member )</li> +</ul> +<hr><a name="details"></a><h2>Detailed Description</h2> + + +The TQTimer class provides timer signals and single-shot timers. +<p> + + +<p> It uses <a href="tqtimerevent.html">timer events</a> internally to +provide a more versatile timer. TQTimer is very easy to use: +create a TQTimer, call <a href="#start">start</a>() to start it and connect its +<a href="#timeout">timeout</a>() to the appropriate slots. When the time is up it will +emit the timeout() signal. +<p> Note that a TQTimer object is destroyed automatically when its +parent object is destroyed. +<p> Example: +<pre> + TQTimer *timer = new TQTimer( myObject ); + <a href="tqobject.html#connect">connect</a>( timer, TQ_SIGNAL(<a href="#timeout">timeout</a>()), myObject, TQ_SLOT(timerDone()) ); + timer-><a href="#start">start</a>( 2000, TRUE ); // 2 seconds single-shot timer + </pre> + +<p> You can also use the static <a href="#singleShot">singleShot</a>() function to create a +single shot timer. +<p> As a special case, a TQTimer with timeout 0 times out as soon as +all the events in the window system's event queue have been +processed. +<p> This can be used to do heavy work while providing a snappy +user interface: +<pre> + TQTimer *t = new TQTimer( myObject ); + <a href="tqobject.html#connect">connect</a>( t, TQ_SIGNAL(<a href="#timeout">timeout</a>()), TQ_SLOT(processOneThing()) ); + t-><a href="#start">start</a>( 0, FALSE ); + </pre> + +<p> myObject->processOneThing() will be called repeatedly and should +return quickly (typically after processing one data item) so that +TQt can deliver events to widgets and stop the timer as soon as it +has done all its work. This is the traditional way of +implementing heavy work in GUI applications; multi-threading is +now becoming available on more and more platforms, and we expect +that null events will eventually be replaced by threading. +<p> Note that TQTimer's accuracy depends on the underlying operating +system and hardware. Most platforms support an accuracy of 20ms; +some provide more. If TQt is unable to deliver the requested +number of timer clicks, it will silently discard some. +<p> An alternative to using TQTimer is to call <a href="tqobject.html#startTimer">TQObject::startTimer</a>() +for your object and reimplement the <a href="tqobject.html#timerEvent">TQObject::timerEvent</a>() event +handler in your class (which must, of course, inherit <a href="tqobject.html">TQObject</a>). +The disadvantage is that <a href="tqobject.html#timerEvent">timerEvent</a>() does not support such +high-level features as single-shot timers or signals. +<p> Some operating systems limit the number of timers that may be +used; TQt tries to work around these limitations. +<p>See also <a href="events.html">Event Classes</a> and <a href="time.html">Time and Date</a>. + +<hr><h2>Member Function Documentation</h2> +<h3 class=fn><a name="TQTimer"></a>TQTimer::TQTimer ( <a href="tqobject.html">TQObject</a> * parent = 0, const char * name = 0 ) +</h3> +Constructs a timer called <em>name</em>, with the parent <em>parent</em>. +<p> Note that the parent object's destructor will destroy this timer +object. + +<h3 class=fn><a name="~TQTimer"></a>TQTimer::~TQTimer () +</h3> +Destroys the timer. + +<h3 class=fn>void <a name="changeInterval"></a>TQTimer::changeInterval ( int msec ) +</h3> +Changes the timeout interval to <em>msec</em> milliseconds. +<p> If the timer signal is pending, it will be stopped and restarted; +otherwise it will be started. +<p> <p>See also <a href="#start">start</a>() and <a href="#isActive">isActive</a>(). + +<h3 class=fn>bool <a name="isActive"></a>TQTimer::isActive () const +</h3> + +<p> Returns TRUE if the timer is running (pending); otherwise returns +FALSE. + +<p>Example: <a href="tutorial1-11.html#x2376">t11/cannon.cpp</a>. +<h3 class=fn>void <a name="singleShot"></a>TQTimer::singleShot ( int msec, <a href="tqobject.html">TQObject</a> * receiver, const char * member )<tt> [static]</tt> +</h3> +This static function calls a slot after a given time interval. +<p> It is very convenient to use this function because you do not need +to bother with a <a href="tqobject.html#timerEvent">timerEvent</a> or +to create a local TQTimer object. +<p> Example: +<pre> + #include <<a href="qapplication-h.html">ntqapplication.h</a>> + #include <<a href="tqtimer-h.html">tqtimer.h</a>> + + int main( int argc, char **argv ) + { + <a href="ntqapplication.html">TQApplication</a> a( argc, argv ); + TQTimer::<a href="#singleShot">singleShot</a>( 10*60*1000, &a, TQ_SLOT(<a href="ntqapplication.html#quit">quit</a>()) ); + ... // create and show your widgets + return a.<a href="ntqapplication.html#exec">exec</a>(); + } + </pre> + +<p> This sample program automatically terminates after 10 minutes (i.e. +600000 milliseconds). +<p> The <em>receiver</em> is the receiving object and the <em>member</em> is the +slot. The time interval is <em>msec</em>. + +<h3 class=fn>int <a name="start"></a>TQTimer::start ( int msec, bool sshot = FALSE ) +</h3> +Starts the timer with a <em>msec</em> milliseconds timeout, and returns +the ID of the timer, or zero when starting the timer failed. +<p> If <em>sshot</em> is TRUE, the timer will be activated only once; +otherwise it will continue until it is stopped. +<p> Any pending timer will be stopped. +<p> <p>See also <a href="#singleShot">singleShot</a>(), <a href="#stop">stop</a>(), <a href="#changeInterval">changeInterval</a>(), and <a href="#isActive">isActive</a>(). + +<p>Examples: <a href="aclock-example.html#x1204">aclock/aclock.cpp</a>, <a href="dirview-example.html#x1704">dirview/dirview.cpp</a>, <a href="distributor-example.html#x2671">distributor/distributor.ui.h</a>, <a href="forever-example.html#x1053">forever/forever.cpp</a>, <a href="hello-example.html#x1639">hello/hello.cpp</a>, <a href="tutorial1-11.html#x2377">t11/cannon.cpp</a>, and <a href="tutorial1-13.html#x2407">t13/cannon.cpp</a>. +<h3 class=fn>void <a name="stop"></a>TQTimer::stop () +</h3> +Stops the timer. +<p> <p>See also <a href="#start">start</a>(). + +<p>Examples: <a href="dirview-example.html#x1705">dirview/dirview.cpp</a>, <a href="tutorial1-11.html#x2378">t11/cannon.cpp</a>, <a href="tutorial1-12.html#x2400">t12/cannon.cpp</a>, and <a href="tutorial1-13.html#x2408">t13/cannon.cpp</a>. +<h3 class=fn>void <a name="timeout"></a>TQTimer::timeout ()<tt> [signal]</tt> +</h3> + +<p> This signal is emitted when the timer is activated. + +<p>Examples: <a href="aclock-example.html#x1205">aclock/aclock.cpp</a>, <a href="dirview-example.html#x1706">dirview/dirview.cpp</a>, <a href="distributor-example.html#x2672">distributor/distributor.ui.h</a>, <a href="forever-example.html#x1054">forever/forever.cpp</a>, <a href="hello-example.html#x1640">hello/hello.cpp</a>, and <a href="tutorial1-11.html#x2379">t11/cannon.cpp</a>. +<h3 class=fn>int <a name="timerId"></a>TQTimer::timerId () const +</h3> + +<p> Returns the ID of the timer if the timer is running; otherwise returns +-1. + +<!-- eof --> +<hr><p> +This file is part of the <a href="index.html">TQt toolkit</a>. +Copyright © 1995-2007 +<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center> +<table width=100% cellspacing=0 border=0><tr> +<td>Copyright © 2007 +<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a> +<td align=right><div align=right>TQt 3.3.8</div> +</table></div></address></body> +</html> |