View Full Version : unsetCursor( )

15th October 2007, 18:41
I am having problems getting unsetCursor( ) to work properly. Inside my QGLWidget, my cursor changes because of various reasons. But when I leave the widget I want to set the cursor back to normal. I have 2 QGLWidgets separated by a QSplitter so one widget is above the other. My code looks like this simple thing:

@param event The pointer to the QEvent

@return void

@brief Checks to see if mouse cursor has left the widget

Checks to see if mouse cursor has left the widget so it
can reset the cursor to normal.
void Plot::leaveEvent( QEvent* event )
unsetCursor( );

This is all I want to do in my leaveEvent for now. Plot is a QGLWidget. But if I move from the bottom of the top widget to the splitter with a unique cursor, the mouse changes to the split cursor for the QSplitter and then when I enter the other Plot object, the cursor goes back to the unique cursor although I never tell it to in the bottom object. Why does the cursor seem not to reset when I leave the top object even though my leaveEvent tells it to? Thanks again!

16th October 2007, 18:01
Are you sure the declaration of the handler is correct?
Make sure it is protected in you class.

16th October 2007, 18:39
Yeah I have it under the "protected" section in my .h file. I know it gets entered into because I have put fprintf statements into it, and they print out.

One weird thing that occurred was if I set a break point in the code, and then continued after hitting the break point, the cursor would reset most the time. It didn't always reset but it would reset at least 9/10 times. But without the breakpoint, it would never reset. That to me is very strange.