Results 1 to 9 of 9

Thread: Simulate mouse click

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2011
    Posts
    5
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Question Simulate mouse click

    Hi ,

    I'm trying to do an eye mouse controlled.
    I want to simulate the click when the eye is closed.

    I already have the cursor position. i'm having problems with the mouse click simulation.

    I've tried this:

    QTestEventList *eventos = new QTestEventList();
    eventos->addMouseClick(Qt::LeftButton, 0, QPoint(x, y), -1);
    eventos->simulate(this);

    and this:

    QTest::mouseClick(this, Qt::LeftButton, 0, QPoint(x, y), -1);

    and:

    QMouseEvent *p = new QMouseEvent(QEvent::MouseButtonPress, QPoint(x, y), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
    QCoreApplication::sendEvent(this, p);
    QMouseEvent *r = new QMouseEvent(QEvent::MouseButtonRelease, QPoint(x, y), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
    QCoreApplication::sendEvent(this, r);

    Nothing works. I think it's because of the receiver, it's a QMainWindow. The thing is, I don't know in which button the mouse is over.

    Thanks.
    Last edited by Merylin; 20th July 2011 at 17:08.

Similar Threads

  1. How to simulate QTouchEvent using mouse
    By dpatel in forum Qt Programming
    Replies: 5
    Last Post: 28th April 2016, 01:40
  2. how to simulate mouse click behavior?
    By hashb in forum Qt Programming
    Replies: 2
    Last Post: 31st August 2010, 07:53
  3. Replies: 4
    Last Post: 15th March 2010, 14:49
  4. mouse click in QGprahicsScene
    By Morea in forum Qt Programming
    Replies: 11
    Last Post: 21st December 2006, 08:21
  5. mouse click event
    By vijay anandh in forum Qt Programming
    Replies: 1
    Last Post: 1st May 2006, 09:24

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.