Results 1 to 2 of 2

Thread: Mouse lock inside window/widget

  1. #1

    Default Mouse lock inside window/widget

    I am trying to stop the mouse from leaving the window. This is useful for first person cameras in OpenGL, as well as full screen applications with multiple monitors. I mostly am just looking to keep it inside the window, however keeping the mouse inside a widget could also be useful to know.

  2. #2
    Join Date
    Jan 2012
    Location
    Dortmund, Germany
    Posts
    159
    Thanks
    69
    Thanked 10 Times in 8 Posts
    Qt products
    Qt4
    Platforms
    Windows Android

    Default Re: Mouse lock inside window/widget

    http://qt-project.org/doc/qt-4.8/qwidget.html
    You are looking vor leaveEvent().

    So: just reimplement the leaveEvent, grab your mouse pointer by its neck and put it back where it belongs, I'd say.
    For that: http://qt-project.org/doc/qt-4.8/qcursor.html
    But done that I never have....

Similar Threads

  1. Replies: 2
    Last Post: 13th December 2012, 13:56
  2. Replies: 1
    Last Post: 14th July 2012, 08:59
  3. Replies: 2
    Last Post: 1st January 2012, 23:22
  4. Mouse move inside control/Widget
    By squidge in forum Newbie
    Replies: 0
    Last Post: 27th September 2009, 16:56
  5. How to embed coin widget inside qt window?
    By jwieland in forum Qt Programming
    Replies: 2
    Last Post: 24th February 2009, 15:50

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.