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. QGraphicsView::mousePressEvent not triggering
Forum Updated to NodeBB v4.3 + New Features

QGraphicsView::mousePressEvent not triggering

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 3 Posters 64 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.
  • J Offline
    J Offline
    james b-s
    wrote last edited by
    #1

    Qt 5.15
    I have some code which runs on both linux and windows. When I run it on windows and perform certain actions, which includes a right mouse click and release, I see the mousePressEvent and mouseReleaseEvent for my graphicsView class being called. When I do the exact same thing with the linux build, I do not see either of these methods called.

    I then overrode QGraphicsView::event to try to track down where the linux build was failing. I do not see MyGraphicsView::event being called for either a mouse press or a mouse release, yet somehow mousePressEvent and mouseReleaseEvent are being called.

    From my reading of the Qt code, these methods are called from QGraphicsView::event. They must be being called from somewhere else. Anyone know where?

    Also, does anyone have suggestions on what is swallowing the mouse events on linux? Its not a general problem, most things work, but I'm tracking whether the code is in the middle of processing a mouse event, and that code isn't working, since the methods aren't called.

    I am verifying that mouse events are enabled. They are.

    On windows, mouseReleaseEvent seems to be immediately preceded by a paint event, InputMethodQuery event, and FocusAboutToChange. Not sure if that's relevant.

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

      Hi,

      Which Linux distribution are you using ?
      With which window manager ?
      Are you using the Qt version coming with your distribution ?

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

      J 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        Which Linux distribution are you using ?
        With which window manager ?
        Are you using the Qt version coming with your distribution ?

        J Offline
        J Offline
        james b-s
        wrote last edited by
        #3

        @SGaist I don't know the answer to those questions.

        I believe we are using straight 5.15, the non-paid version. Whatever Qt is distributing. I don't think we built anything ourselves.

        1 Reply Last reply
        0
        • J Offline
          J Offline
          james b-s
          wrote last edited by james b-s
          #4

          I have a bit more information. The graphicsview mouse events are coming from the scene. On both windows and linux, cSI_QTN_GRAPHICS_SCENE::event receives event 156 (GraphicsSceneMousePress) just before the view's mousePressEvent which makes sense. On windows, cSI_QTN_GRAPHICS_SCENE::event receives event 157 (GraphicsSceneMouseRelease) just before the mouseReleaseEvent. Event 157 does not show up on the linux build.

          1 Reply Last reply
          0
          • J Offline
            J Offline
            james b-s
            wrote last edited by
            #5

            So this is what I think is happening.
            In order for me to see this problem, I right-mouse-click, bring up a context menu and select an item.
            On windows, this results in a mouse press event, a context menu event, and then a mouse release event.
            On linux, this results in a mouse press event, and then a context menu event. There is no mouse release event.

            JonBJ 1 Reply Last reply
            0
            • J james b-s

              So this is what I think is happening.
              In order for me to see this problem, I right-mouse-click, bring up a context menu and select an item.
              On windows, this results in a mouse press event, a context menu event, and then a mouse release event.
              On linux, this results in a mouse press event, and then a context menu event. There is no mouse release event.

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote last edited by
              #6

              @james-b-s
              I don't know whether or why this would differ from Windows to some Linux window manager, or whether there is anything different in the Qt implementation, but maybe in Linux WM the mouse release event is going to the context menu?

              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