Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Simulate clicking with the left mouse button
Forum Updated to NodeBB v4.3 + New Features

Simulate clicking with the left mouse button

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 3.2k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    bvox123
    wrote on last edited by
    #1

    Good morning.
    It's been a while since I started using Qt5 and C ++ for a program that will run on a Linux platform. I have a problem I do not know how to solve and ask for help. My program will only have to engage the left side of the screen while on the right side will be active a firefox window with the web page to enter lottery play.
    When in the left half I click a particular button, the cursor will be placed on the web page and click on a particular area to indicate the number to play the bet. In this way I would like to automate the insertion of some hundreds of bets that my program will process for 3 times a week.
    I could move the cursor to the web page, but I can not play the mouse click in that location. Is there someone who can help me? Thank you very much.

    jsulmJ 1 Reply Last reply
    0
    • B bvox123

      Good morning.
      It's been a while since I started using Qt5 and C ++ for a program that will run on a Linux platform. I have a problem I do not know how to solve and ask for help. My program will only have to engage the left side of the screen while on the right side will be active a firefox window with the web page to enter lottery play.
      When in the left half I click a particular button, the cursor will be placed on the web page and click on a particular area to indicate the number to play the bet. In this way I would like to automate the insertion of some hundreds of bets that my program will process for 3 times a week.
      I could move the cursor to the web page, but I can not play the mouse click in that location. Is there someone who can help me? Thank you very much.

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @bvox123 Why don't you embed the web page in your app using http://doc.qt.io/qt-5/qtwebengine-index.html instead of trying to control Firefox?
      To send mouse signals to other applications you would need to use system APIs as this is outside of Qt scope.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • B Offline
        B Offline
        bvox123
        wrote on last edited by
        #3

        @jsulm said in Simulate clicking with the left mouse button:

        Why don't you embed the web page in your app using http://doc.qt.io/qt-5/qtwebengine-index.html instead of trying to control Firefox?
        To send mouse signals to other applications you would need to use system APIs as this is outside of Qt scope.

        Thank you. I found a solution, but I do not really like it much.
        I've installed xdotool and so I can press the button on the other application (eg, it's in 1000, 800) as follows:
        QCursor :: setPos (1000, 800);
        System ("xdotool click 1");
        If anyone could suggest me a more elegant method, maybe using Qt classes, I would be really grateful.
        Greetings
        bvox

        jsulmJ 1 Reply Last reply
        0
        • VRoninV Offline
          VRoninV Offline
          VRonin
          wrote on last edited by
          #4

          Italian version of the question: https://forum.qt.io/topic/81355/simulare-il-click-del-mouse-su-un-altra-applicazione

          My answer is 100% google translatable with no loss of menaing

          "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
          ~Napoleon Bonaparte

          On a crusade to banish setIndexWidget() from the holy land of Qt

          1 Reply Last reply
          1
          • B bvox123

            @jsulm said in Simulate clicking with the left mouse button:

            Why don't you embed the web page in your app using http://doc.qt.io/qt-5/qtwebengine-index.html instead of trying to control Firefox?
            To send mouse signals to other applications you would need to use system APIs as this is outside of Qt scope.

            Thank you. I found a solution, but I do not really like it much.
            I've installed xdotool and so I can press the button on the other application (eg, it's in 1000, 800) as follows:
            QCursor :: setPos (1000, 800);
            System ("xdotool click 1");
            If anyone could suggest me a more elegant method, maybe using Qt classes, I would be really grateful.
            Greetings
            bvox

            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @bvox123 Again: why don't you embed this web-site into your app using http://doc.qt.io/qt-5/qtwebengine-index.html ?

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved