Results 1 to 3 of 3

Thread: problem reimplementing mouseMoveEvent

  1. #1
    Join Date
    Sep 2008
    Location
    Falmouth, MA, USA
    Posts
    34
    Thanks
    4
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default problem reimplementing mouseMoveEvent

    I have written an application that uses a QGLWidget for stereo image display (Windows XP, QT 2010.01). I am trying to use the mouse to move a synthetic cursor around--in other words, I want to use mouse movements to move a cursor that I will draw in the GL scene. This will let me move a "floating dot" around in the stereo scene.

    I have attempted to reimplement mouseMoveEvent--here's the .h file entry

    Qt Code:
    1. protected:
    2.  
    3. void initializeGL();
    4. void paintGL();
    5. void mousePressEvent(QMouseEvent *event);
    6. void mouseMoveEvent(QMouseEvent *event);
    To copy to clipboard, switch view to plain text mode 

    Here is the mouseMoveEvent:

    Qt Code:
    1. void ImageGLView::mouseMoveEvent(QMouseEvent *event)
    2. {
    3. if(FLOATING_DOT == mouseMode){
    4. // do something
    5. }
    6. else{
    7. QWidget::mouseMoveEvent(event);
    8. }
    9.  
    10.  
    11. }
    To copy to clipboard, switch view to plain text mode 

    the problem is that the reimplemented event function never gets called. I have placed breakpoints in it using the debugger (QT Creator) and it never seems to get the event. I have tried clicking to gain mouse context, etc, to no avail. To the best of my ability to tell, my mouseMoveEvent never gets called

    I am baffled. The approach seems to work when using other types of widgets--is it the OpenGL nature of it that is causing the problem? I tried to follow the on-line examples, as well as various examples in Blanchette and Summerfield, and I suspect I'm doing something really stupid that I just can't see. The same affect seems to happen with mousePressEvent as well

    Thanks in advance for any help

  2. #2
    Join Date
    Sep 2008
    Location
    Falmouth, MA, USA
    Posts
    34
    Thanks
    4
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: problem reimplementing mouseMoveEvent

    a later addition--I tried setting mouse tracking to true, and now I get the events. However, the documentation indicates that I should get events if a mouse button is pressed during a move, and that's what I've been doing. I took out my mousePressEvent handler, in case that was interfering, and it made no difference. So although I can now get events, I don't understand why...

  3. #3
    Join Date
    Sep 2008
    Location
    Falmouth, MA, USA
    Posts
    34
    Thanks
    4
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: problem reimplementing mouseMoveEvent

    Turning on mouse tracking does make the application work. However,I have reimplemented mousePressEvent on the same QGLWidget--and now thatdoesn't work. Same scheme, the mousePressEvent handler never gets called. Is there anything special about QGLWidgets, or stereo that I don't know about?

Similar Threads

  1. Problem in MouseMoveEvent
    By aamer4yu in forum Qt Programming
    Replies: 18
    Last Post: 3rd December 2015, 11:20
  2. Reimplementing a Widgets Look
    By Stobie in forum Qt Programming
    Replies: 8
    Last Post: 11th January 2010, 10:10
  3. mouseMoveEvent problem
    By yagabey in forum Qt Programming
    Replies: 9
    Last Post: 28th November 2008, 12:51
  4. Problem reimplementing QWidget::keyPressEvent
    By jiveaxe in forum Qt Programming
    Replies: 2
    Last Post: 22nd September 2008, 12:02
  5. Problem reimplementing QSpinBox in a custom widget
    By hvengel in forum Qt Programming
    Replies: 1
    Last Post: 30th March 2006, 08:12

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.