Results 1 to 10 of 10

Thread: Mouse Right or Left click ???

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2011
    Location
    India
    Posts
    7
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Lightbulb Mouse Right or Left click ???

    Dear Friends,

    How do I perform mouse Right or Left click through code ???
    Been scratching my head from the last two days but cannot seem to get through this

    all I am trying to do is when a button is clicked then the mouse Right Click should happen:

    Qt Code:
    1. void Widget::on_pushButton_6_clicked()
    2. {
    3. QPoint point(cur.pos().x(), cur.pos().y());
    4.  
    5. QApplication::postEvent(QApplication::desktop()->window(), new QMouseEvent(QMouseEvent::MouseButtonPress,point,Qt::RightButton, Qt::RightButton,Qt::NoModifier));
    6.  
    7. QApplication::postEvent(QApplication::desktop()->window(), new QMouseEvent(QMouseEvent::MouseButtonRelease,point,Qt::RightButton, Qt::RightButton,Qt::NoModifier));
    8.  
    9. }
    To copy to clipboard, switch view to plain text mode 

    First I get the current cursor position and then I am trying to perform a Right Click event...but nothing happens
    Last edited by anjanu; 26th August 2011 at 20:54.

Similar Threads

  1. Replies: 8
    Last Post: 2nd September 2010, 15:49
  2. Replies: 4
    Last Post: 29th August 2010, 18:16
  3. Qtablewidget left mouse click event in python
    By gerocampo in forum Newbie
    Replies: 0
    Last Post: 23rd July 2010, 17:05
  4. Replies: 4
    Last Post: 30th May 2010, 12:55
  5. Emulating Enter key with left mouse click
    By wconstan in forum Newbie
    Replies: 6
    Last Post: 30th December 2009, 16:16

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.