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. Trapping and releasing mouse input
Forum Updated to NodeBB v4.3 + New Features

Trapping and releasing mouse input

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.1k Views 1 Watching
  • 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.
  • M Offline
    M Offline
    MyQtAccount
    wrote on last edited by
    #1

    I have a widget covering my screen that catches all mouse input. What I want is that when it is clicked, I decide if it should handle the mouse input or allow the mouse input to go through like the widget isn't there.

    I can't just call sendEvent() because I don't know who the input would go to. There are multiple objects underneath the area.

    How can I go about deciding to handle it or just allowing it to pass through?

    1 Reply Last reply
    0
    • raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      i haven't found a good (Qt only) solution for myself either for this problem.
      The only thing i did which seemed to work is:
      @
      this->hide();
      QWidget* widget = QApplication::widgetAt(mosueEvent->globalPos());
      this->show();
      @
      But this only works for widgets inside your application.

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      0
      • M Offline
        M Offline
        MyQtAccount
        wrote on last edited by
        #3

        Thanks.

        I did the following which seems to work:
        QMouseEvent * pMouse = static_cast<QMouseEvent >(e);
        this->hide();
        QWidget
        widget = QApplication::widgetAt(pMouse->globalPos());
        this->show();
        QApplication::sendEvent(widget, pMouse);

        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