On Sunday 14 March 2010 01:36:58 pm Dushan Savich wrote:
> Hi Hilary,
> 
>  No, you can't .  At least I always get this segmentation fault :-)   .
> 
> On 14 March 2010 16:17, Hilary Cheng <[email protected]> wrote:
> > Dear All,
> >
> >     Does the WTimer can work without the GUI ? Just like the Qt QTimer ?
> >
> > Regards,
> >
> > Hilary
> >

WTimer works great in the gui, just like QTimer.   Just connect the connect 
the timer "timeout( WMouseEvent )" signal to an appropriate slot in your gui 
class and it will be called when the timer times out.

Example:

class MyGuiClass, public WContainerWidget;
{
public:
        MyGuiClass( WContainerWidget* parent );
public slots:
        timerslot( WMouseEvent wme );
};

MyGuiClass::MyGuiClass( WObject* parent ) : WContainerWidget( parent ) 
{
// Full config
        WTimer* t = new WTimer( this );
        t->setInterval( 2000 );
        t->timeout().connect(SLOT( this, MyGuiClass::timerslot ));
        t->start();
// Or convenience method
        WTimer::singleShot( 2000, SLOT( this, MyGuiClass::timerslot ));

// They both do the same thing, just one is more configurable
}

MyGuiClass:: timerslot( WMouseEvent wme )
{
        // executes 2 seconds (2000 ms) after t->start()
}

Fun fun fun,
Mike

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to