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. Qt 5 widgets bug? Mouse tracking doesn't work with OpenGL widget on Mac OS
Forum Update on Monday, May 27th 2025

Qt 5 widgets bug? Mouse tracking doesn't work with OpenGL widget on Mac OS

Scheduled Pinned Locked Moved General and Desktop
9 Posts 4 Posters 5.1k 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.
  • V Offline
    V Offline
    Violet Giraffe
    wrote on 18 Feb 2013, 14:41 last edited by
    #1

    I'm trying to enable mouse tracking for my GL view. It seems to work right from the start, but as I try clicking in the window and moving the cursor in and out, GL widget starts receiving mouse events erratically. Tried on two different Macs with different Macs (10.7 and 10.8).

    "This is the link to a simple test project":http://rghost.ru/download/43893939/c54664b180cc40ed39d91337e41934b2ea35b20f/test.zip illustrating the issue. Mouse events are being logged with qDebug, you should be able to easily tell whether tracking works fine or not by moving and clicking your mouse and looking at the output. I'd appreciate if someone could look at the project and conclude whether this is my error or Qt 5 bug. I seriously suspect the latter.

    P. S. The same code works like charm with Qt 4.8, also works on Windows with Qt 5.

    1 Reply Last reply
    0
    • B Offline
      B Offline
      benhj
      wrote on 20 Feb 2013, 10:59 last edited by
      #2

      I also experienced very weird mouse tracking behaviour in a custom GL view (mac; untested on windows and linux). So much so that I had to downgrade to 4.8 in which everything works beautifully. Really hope it can be fixed soon.

      1 Reply Last reply
      0
      • V Offline
        V Offline
        Violet Giraffe
        wrote on 20 Feb 2013, 11:17 last edited by
        #3

        Same, will have to downgrade... I'd like to find out it's a bug in my code that I can fix, but wasn't able to find any errors on my part (perhaps, someone could verify the test project I've attached?).
        I've reported a bug, no reply so far: https://bugreports.qt-project.org/browse/QTBUG-29751

        1 Reply Last reply
        0
        • B Offline
          B Offline
          benhj
          wrote on 20 Feb 2013, 12:03 last edited by
          #4

          Might be helpful if you uploaded the raw source files somewhere; e.g. on pastebin rather than packaging up in a zip (just a security concern)

          1 Reply Last reply
          0
          • V Offline
            V Offline
            Violet Giraffe
            wrote on 20 Feb 2013, 12:06 last edited by
            #5

            It's a bunch of files. I don't see any other sensible way to upload them.

            1 Reply Last reply
            0
            • B Offline
              B Offline
              benhj
              wrote on 20 Feb 2013, 13:48 last edited by
              #6

              Will have a look when I'm home -- I'm at work right now and would prefer not to download a zip file from a file sharing website that I know nothing about.

              Cheers,
              Ben.

              1 Reply Last reply
              0
              • V Offline
                V Offline
                Violet Giraffe
                wrote on 5 Mar 2013, 15:16 last edited by
                #7

                The bug has been approved and assigned, case closed, I guess.

                1 Reply Last reply
                0
                • D Offline
                  D Offline
                  divide
                  wrote on 27 Apr 2013, 08:21 last edited by
                  #8

                  For anyone like me having the problem, if you cannot wait for Qt 5.1 here's the workaround I've done (for QGLWidget):

                  1/ in your QMainWindow initialization, add:
                  @setMouseTracking(true);@
                  2/ in your QMainWindow header, add:
                  @protected:
                  void mouseMoveEvent(QMouseEvent *event);@
                  3/ in your QMainWindow source, add:
                  @void MainWindow::mouseMoveEvent(QMouseEvent *event)
                  {
                  QWidget *child=childAt(event->pos());
                  QGLWidget *glwidget = qobject_cast<QGLWidget *>(child);
                  if(glwidget) {
                  QMouseEvent *glevent=new QMouseEvent(event->type(),glwidget->mapFromGlobal(event->globalPos()),event->button(),event->buttons(),event->modifiers());
                  QCoreApplication::postEvent(glwidget,glevent);
                  }
                  }@

                  1 Reply Last reply
                  0
                  • T Offline
                    T Offline
                    tower120
                    wrote on 27 Apr 2013, 12:27 last edited by
                    #9

                    I found that it want not work with QQuickItem, too.

                    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