diff --git a/include/wx/qt/window.h b/include/wx/qt/window.h index 77eca2de6f..a4d49516d8 100644 --- a/include/wx/qt/window.h +++ b/include/wx/qt/window.h @@ -168,6 +168,7 @@ public: static void QtStoreWindowPointer( QWidget *widget, const wxWindowQt *window ); static wxWindowQt *QtRetrieveWindowPointer( const QWidget *widget ); + static void QtSendSetCursorEvent(wxWindowQt* win, wxPoint posClient); #if wxUSE_ACCEL virtual void QtHandleShortcut ( int command ); diff --git a/src/qt/window.cpp b/src/qt/window.cpp index 1f5b35743d..7a31b7a928 100644 --- a/src/qt/window.cpp +++ b/src/qt/window.cpp @@ -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;