Results 1 to 3 of 3

Thread: QT Mouse Event outside Window/Widget

  1. #1
    Join Date
    Nov 2014
    Posts
    12
    Thanks
    4

    Default QT Mouse Event outside Window/Widget

    Hi,
    Im trying to make my mouse click in some screen coordinates when my program receives a trigger for do it.

    Ive made it in C++ before, now Im trying to make it in Qt, heres a small example of what i mean.

    Qt Code:
    1. C++ code
    2.  
    3. if (bin_trigger == 1)
    4. {
    5. SetCursorPos(screenXpos, screenYpos);
    6. ZeroMemory(Input, sizeof(INPUT)* 2);
    7. Input[0].type = INPUT_MOUSE;
    8. Input[0].mi.dwFlags = MOUSEEVENTF_LEFTDOWN;
    9. Input[1].type = INPUT_MOUSE;
    10. Input[1].mi.dwFlags = MOUSEEVENTF_LEFTUP;
    11. SendInput(2, Input, sizeof(INPUT));
    12. }
    To copy to clipboard, switch view to plain text mode 

    I would be happy to get some tips or some pseudo-code from someone who have made somthing similar.

    Thank you in advance.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QT Mouse Event outside Window/Widget

    Qt is as C++ library so your application is still a C++ application.
    Why don't you just use the code that you know to work?

    Cheers,
    _

  3. The following user says thank you to anda_skoa for this useful post:

    digimonkey (5th November 2014)

  4. #3
    Join Date
    Nov 2014
    Posts
    12
    Thanks
    4

    Default Re: QT Mouse Event outside Window/Widget

    There could be some kind of function already implemented in QT that I didnt knew. Thank you I will try to implement it with what i have.

Similar Threads

  1. Making a mouse click event close the window
    By Momergil in forum Qt Programming
    Replies: 2
    Last Post: 17th February 2013, 18:58
  2. Replies: 10
    Last Post: 16th July 2011, 12:29
  3. Mouse event handling beyond/outside the widget
    By keyur259 in forum Qt Programming
    Replies: 7
    Last Post: 20th January 2010, 05:14
  4. Replies: 7
    Last Post: 14th January 2010, 08:47
  5. pass mouse event information to another widget
    By Rooster in forum Qt Programming
    Replies: 5
    Last Post: 12th July 2008, 04:23

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.