Send set cursor events whenever there is mouse movement
This is required in order to allow application code to change the cursor dynamically. Closes https://github.com/wxWidgets/wxWidgets/pull/1549
This commit is contained in:
committed by
Vadim Zeitlin
parent
99bbc523f7
commit
f608b340c2
@@ -215,6 +215,30 @@ static const char WINDOW_POINTER_PROPERTY_NAME[] = "wxWindowPointer";
|
||||
return const_cast< wxWindowQt * >( ( variant.value< const wxWindow * >() ));
|
||||
}
|
||||
|
||||
/* static */
|
||||
void wxWindowQt::QtSendSetCursorEvent(wxWindowQt* win, wxPoint posScreen)
|
||||
{
|
||||
wxWindowQt* w = win;
|
||||
for ( ;; )
|
||||
{
|
||||
const wxPoint posClient = w->ScreenToClient(posScreen);
|
||||
wxSetCursorEvent event(posClient.x, posClient.y);
|
||||
event.SetEventObject(w);
|
||||
|
||||
const bool processedEvtSetCursor = w->ProcessWindowEvent(event);
|
||||
if ( processedEvtSetCursor && event.HasCursor() )
|
||||
{
|
||||
win->SetCursor(event.GetCursor());
|
||||
return;
|
||||
}
|
||||
|
||||
w = w->GetParent();
|
||||
if ( w == NULL )
|
||||
break;
|
||||
}
|
||||
win->SetCursor(wxCursor(wxCURSOR_ARROW));
|
||||
}
|
||||
|
||||
static wxWindowQt *s_capturedWindow = NULL;
|
||||
|
||||
/* static */ wxWindowQt *wxWindowBase::DoFindFocus()
|
||||
@@ -1517,6 +1541,8 @@ bool wxWindowQt::QtHandleMouseEvent ( QWidget *handler, QMouseEvent *event )
|
||||
|
||||
ProcessWindowEvent( e );
|
||||
}
|
||||
|
||||
QtSendSetCursorEvent(this, wxQtConvertPoint( event->globalPos()));
|
||||
}
|
||||
|
||||
m_mouseInside = mouseInside;
|
||||
|
Reference in New Issue
Block a user