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.

    C++ code

    @if (bin_trigger == 1)
    {
    SetCursorPos(screenXpos, screenYpos);
    ZeroMemory(Input, sizeof(INPUT)* 2);
    Input[0].type = INPUT_MOUSE;
    Input[0].mi.dwFlags = MOUSEEVENTF_LEFTDOWN;
    Input[1].type = INPUT_MOUSE;
    Input[1].mi.dwFlags = MOUSEEVENTF_LEFTUP;
    SendInput(2, Input, sizeof(INPUT));
    }@

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

    Thank you in advance.



  • Hi.
    No..There is no equivalent API.
    but .. You can use the above code in Qt .

    Qt does not provide such events that can be post outside the QWidget.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.