Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. How to make a widget recieve mouseevent?
Forum Updated to NodeBB v4.3 + New Features

How to make a widget recieve mouseevent?

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
6 Posts 2 Posters 504 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.
  • W Offline
    W Offline
    wohehe
    wrote on last edited by
    #1

    Hello everyone! I am facing a confused issue, I use 3 widget3, one is the under other widgets, the other widgets (widget A and widgetB) are used without parent. The issue is when I use A->show() to show A, I use A->close(),then I use B->show(), A->show(), the A widget is on the top, but QApplication::notify shows that when I click the screen, B widget recieved the event. Do you know why? My Qt is 5.11.x . And I have used activateWindow() and setFocus() , they don't make sense.

    1 Reply Last reply
    0
    • W Offline
      W Offline
      wohehe
      wrote on last edited by
      #2

      I have used qDebug()<<A->isActiveWindow(), and qDebug()<<A->hasFocus. Both were true. But B still recieved all click events.

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi and welcome to devnet,

        Does one of these widgets have their focus handling changed ?

        Can you provide a minimal compilable example that shows that behaviour ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        W 2 Replies Last reply
        0
        • SGaistS SGaist

          Hi and welcome to devnet,

          Does one of these widgets have their focus handling changed ?

          Can you provide a minimal compilable example that shows that behaviour ?

          W Offline
          W Offline
          wohehe
          wrote on last edited by
          #4

          @SGaist Hi , do you need the code?
          By the way, I face this issue on embeded system, when I use this code on PC, seems everything works well.

          SGaistS 1 Reply Last reply
          0
          • SGaistS SGaist

            Hi and welcome to devnet,

            Does one of these widgets have their focus handling changed ?

            Can you provide a minimal compilable example that shows that behaviour ?

            W Offline
            W Offline
            wohehe
            wrote on last edited by
            #5

            @SGaist Oh, I use qDebug<<B->hasFoucus(). When A's hasFocus is true, B's is false.

            1 Reply Last reply
            0
            • W wohehe

              @SGaist Hi , do you need the code?
              By the way, I face this issue on embeded system, when I use this code on PC, seems everything works well.

              SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @wohehe said in How to make a widget recieve mouseevent?:

              @SGaist Hi , do you need the code?
              By the way, I face this issue on embeded system, when I use this code on PC, seems everything works well.

              A minimal compilable example would be good.

              Embedded device ?
              Which device ?
              Which OS ?
              Which QPA backend ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - 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