×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Regular Contributor
    Join Date
    Nov 2009
    Posts
    83

    Simulate Mouse Move Events Accurately?

    Hi,

    I am trying to simulate the mouse click-move-release events without actually touch the mouse on a drawing application. What I did is
    Code:
    QMouseEvent event_click(QEvent::MouseButtonPress, old_pos, Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
    
    QApplication::sendEvent(label, &event_click);
    
    QMouseEvent event_move(QEvent::MouseMove, new_pos, Qt::NoButton, Qt::LeftButton, Qt::NoModifier);	
    
    QApplication::sendEvent(label, &event_move);
    I find that it's easy to make the click and move events happen with a timer. However, the mouse move event took place instantly. I couldn't see the process while the mouse was moving. How could I simulate the mouse move event more accurately, just like I drag a mouse when clicked. I would like to make the mouse move by itself at different speed and in different path. I hope I've made myself clear enough.

    Thank you.

  2. #2
    Super Contributor
    Join Date
    Nov 2009
    Location
    Minnesota, USA
    Posts
    3,209

    Re: Simulate Mouse Move Events Accurately?

    You'll have to animate it.

  3. #3
    Regular Contributor
    Join Date
    Nov 2009
    Posts
    83

    Re: Simulate Mouse Move Events Accurately?

    Yes, that's what I would like to ask about. You have any idea or good sources on how to do the animation? Cheers.

  4. #4
    Super Contributor
    Join Date
    Nov 2009
    Location
    Minnesota, USA
    Posts
    3,209

    Re: Simulate Mouse Move Events Accurately?

    One of the QAbstractAnimation subclasses, I would guess. Subclassing QVariantAnimation would seem to be the best choice, offhand.

Similar Threads

  1. Replies: 12
    Last Post: 2011-03-29, 16:38
  2. mouse move events in n810
    By aksheyjawa in forum Nokia N9
    Replies: 2
    Last Post: 2009-11-25, 13:33
  3. Mouse Events N810
    By dunff2k in forum Mobile Java General
    Replies: 4
    Last Post: 2009-06-07, 09:31
  4. How to move mouse with camera motion & bluetooth?
    By Satyajit in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2007-12-11, 14:37
  5. Replies: 0
    Last Post: 2007-12-11, 14:12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×