Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved mouse handling change in qt5 possibly broke my code

    General and Desktop
    grabmouse
    2
    3
    444
    Loading More Posts
    • 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
      Meyer Sound last edited by

      I've inherited a large codebase built off of Qt4.8, which has a framework built on top of the Qt framework. Due to Qt5 changes in the mouse handling, different functions are now being called in a particular context. The specific case is the left-mouse has been pressed, and is being used to rotate a 'knob'. The user moves off of the knob component, still holding the left mouse button, and then, at the same time, presses the right mouse button. Previously the knob component contextMenuEvent was getting called, but with Qt5 that isn't the case. As I didn't write this underlying framework, it is a bit daunting to go mess with it's innards.

      otoh, if I use grabMouse/releaseMouse, I get the previous, and expected, behavior. But, I am concerned based on the warnings in the documentation for grabMouse. My quick tests using grabMouse/releaseMouse work, but obviously I don't knowhow to test for the dangers warned against.

      Any advice? Is grabMouse really that dangerous? Are there some known conditions I can test against?

      Thank in advance.

      -Chris Roberts
      Meyer Sound
      Senior Software Engineer

      1 Reply Last reply Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        Hi,

        Well, the best testing is intensive testing. Let your co-worker toy with the software to see if anything bad happens. You can also write unit tests to automate that part.

        If you don't do anything funky you should not get bitten by grabMouse.

        In any case, I'd rather take a look at that underlying framework. If you are inheriting its maintenance, then it's better to know it.

        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 Reply Quote 0
        • M
          Meyer Sound last edited by

          @SGaist said:

          If you don't do anything funky you should not get bitten by grabMouse.

          Thank you oh mighty Qt Champ! ;)

          I fully agree that rectifying the framework with the new mouse handling is the proper fix, but, as usual, I am balancing this against a schedule that lines up with shipping hardware.

          Your input allows me to speak more intelligently about our options, and help our group decide the best way to spend our time.

          Thank you.

          1 Reply Last reply Reply Quote 0
          • First post
            Last post