[Qt-interest] Capture mouse Event
Ankit Agarwal
ankit17.ag at gmail.com
Thu Jan 29 11:16:29 CET 2009
Hi Ivan,
Thanks for the reply.
I have never worked with the event filter thing. Can you please give an
example or where can i get an example on that.
On Thu, Jan 29, 2009 at 3:41 PM, Ivan Kharin <korsar.akvis at gmail.com> wrote:
> > Ankit.
>
> > Hi,
> > I have my GUI made in Qt. The app has multiple views(pages).
> > Problem:
> > If the user is not performing any operation for a specified amount
> > of time, say 10 min, then i need to exit the application. How can i
> achive this?
>
> > One way of doing this is reimplement mouseMoveEvent() for every
> > view I have, and then maintain a timer. every time the user moves
> > the mouse, the timer resets. If the timer expires, then the application
> exits.
> > Is there a bteer way to implement the same.
>
> 0. Declare variable: int idleMinutes = 0;
> 1. Set event filter to qApp
> 2. In event_filter body, reset idleMinutes to zero if event is QInputEvent
> (keyboard or mouse)
> 3. Set QTimer with one minute interval
> 4. In timer_slot body, increment idleMinutes and call qApp->quit() if
> idleMinutes >= 10
>
> --
> Ivan Kharin
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
--
Regards,
Ankit Agarwal
SW Engineer
Vegayan Systems
email : ankit_agarwal at vegayan.com
Blog : http://ankit17.wordpress.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090129/a3c1958c/attachment.html
More information about the Qt-interest-old
mailing list