Hmm so you want the timer to act out of session?
I'm not sure if it is possible. Looks like it is but you should test it.

void WTimer::start()
> {
>   if (!active_) {
>
>     /* See here? It seems that if there is a session it adds the widget to
> the session, but I don't see that it uses it anywhere else or throws an
> exception if there is no available session */
>
>     WApplication *app = WApplication::instance();
>     if (app && app->timerRoot())
>       app->timerRoot()->addWidget(timerWidget_);
>     active_ = true;
>     *timeout_ = Time() + interval_;
>
>     bool jsRepeat = !timeout().isExposedSignal() && !singleShot_;
>
>     timerWidget_->timerStart(jsRepeat);
>
>     if (timeout().isExposedSignal() && !timeoutConnected_) {
>       timeout().connect(SLOT(this, WTimer::gotTimeout));
>       timeoutConnected_ = true;
>     }
>   }
> }
>
> It might be possible.
The question itself is interesting enough but you should just make a test
case first.

2010/3/15 Hilary Cheng <[email protected]>

> Dear Mike,
>
>     I wanna to run without GUI. It means it can start the Timer after
> server is starting up and do some background jobs.
>
> Regards,
>
> Hilary
>
>
> On Mon, Mar 15, 2010 at 07:54, Mike Teehan <[email protected]> wrote:
>
>> 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
>>
>
>
>
> ------------------------------------------------------------------------------
> 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
>
>
------------------------------------------------------------------------------
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