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. mouseReleaseEvent() not work in QOpenGLWidget....
Forum Updated to NodeBB v4.3 + New Features

mouseReleaseEvent() not work in QOpenGLWidget....

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 4 Posters 2.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.
  • O Offline
    O Offline
    opengpu2
    wrote on last edited by opengpu2
    #1

    mouseReleaseEvent() not work in QOpenGLWidget....
    i override mouseReleaseEvent() in MyOpenGLWidget which is inherite from QOpenGLWidget, but mouseReleaseEvent is not work.....
    however, mousePressEvent and mouseMoveEvent work...
    anyone know the solution?
    thank you!!!

    1 Reply Last reply
    0
    • m.sueM Offline
      m.sueM Offline
      m.sue
      wrote on last edited by
      #2

      Hi,
      please show the code, as I would say that it does work.
      -Michael.

      1 Reply Last reply
      1
      • O Offline
        O Offline
        opengpu2
        wrote on last edited by
        #3

        it's simple, just override virtual func mouseReleaseEvent() in MyOpenGLWidget : public QOpenGLWidget

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

          Hi,

          Like @m-sue asked, please show us how you did that. It's easy to sleep an error there for example a wrong or missing argument.

          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
          • R Offline
            R Offline
            Rondog
            wrote on last edited by
            #5

            The mouse release event does work with a QOpenGLWidget. I use it all the time but I did have a problem with getting a mouse release event if this happened when the mouse was outside the area of the widget.

            If you don't see any events at all it is possible you don't have the mouse events declared properly:

            protected:
            	virtual void mousePressEvent(QMouseEvent *event);
            	virtual void mouseMoveEvent(QMouseEvent *event);
            	virtual void mouseReleaseEvent(QMouseEvent *event);
            
            

            If you are not seeing the mouse release event when the mouse position moves beyond the area of the widget you can change the focus policy in the constructor of your derived class to prevent this from happening:

            	this->setFocusPolicy(Qt::StrongFocus);
            
            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