Results 1 to 4 of 4

Thread: How to move the mouse ?

  1. #1
    Join Date
    Oct 2008
    Posts
    4
    Qt products
    Qt4
    Platforms
    MacOS X

    Default How to move the mouse ?

    Hi there,

    I want to manipulate the current mouse pointer position and wonder, how this would be done. The QTestLib framework module provides this functionality with QTest::mouseMove but this is no unit test. And without unit tests I don't want to use the QTest module (e.g. this needs the CONFIG variable to be extended by "qtestlib" in the *.pro file).

    Maybe someone knows a better solution using the QtCore module? Searching the API I did not find any similar to QTest::mouseMove.

    Greets.

  2. #2
    Join Date
    Oct 2008
    Posts
    70
    Thanks
    1
    Thanked 9 Times in 9 Posts

    Default Re: How to move the mouse ?

    Hello!

    Did you try this method?

    Qt Code:
    1. void QCursor::setPos ( int x, int y ) [static]
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Oct 2008
    Posts
    4
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: How to move the mouse ?

    No, I did not. But yes, this will work. The only pitfall is that the set cursor position will be interpreted as a global point. But it should be possible to map from widget coordinates to global ones.

    Thanks.

  4. #4
    Join Date
    Oct 2008
    Posts
    70
    Thanks
    1
    Thanked 9 Times in 9 Posts

    Default Re: How to move the mouse ?

    You're welcome!

    Quote Originally Posted by shad0w View Post
    But it should be possible to map from widget coordinates to global ones.
    Yes, it will be possible with QWidget::map* methods

Similar Threads

  1. Replies: 7
    Last Post: 17th July 2008, 21:47
  2. Tool Tip on mouse move in QTreeWidget?
    By vishal.chauhan in forum Qt Programming
    Replies: 1
    Last Post: 27th June 2007, 08:42
  3. Mouse Move Event
    By merry in forum Newbie
    Replies: 5
    Last Post: 3rd June 2007, 06:26
  4. Move Rectangle on mouse Move
    By vermarajeev in forum Qt Programming
    Replies: 24
    Last Post: 14th May 2007, 05:34
  5. how to display full tree item name on mouse move ?
    By rajesh in forum Qt Programming
    Replies: 5
    Last Post: 15th November 2006, 08:41

Tags for this Thread

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.