diff --git a/include/wx/qt/dnd.h b/include/wx/qt/dnd.h index 0c0b954692..4f5c2a4cbd 100644 --- a/include/wx/qt/dnd.h +++ b/include/wx/qt/dnd.h @@ -8,7 +8,7 @@ #ifndef _WX_QT_DND_H_ #define _WX_QT_DND_H_ -#define wxDROP_ICON(name) wxICON(name) +#define wxDROP_ICON(name) wxCursor(name##_xpm) class WXDLLIMPEXP_CORE wxDropTarget : public wxDropTargetBase { @@ -34,15 +34,15 @@ class WXDLLIMPEXP_CORE wxDropSource: public wxDropSourceBase { public: wxDropSource( wxWindow *win = NULL, - const wxIcon © = wxNullIcon, - const wxIcon &move = wxNullIcon, - const wxIcon &none = wxNullIcon); + const wxCursor © = wxNullCursor, + const wxCursor &move = wxNullCursor, + const wxCursor &none = wxNullCursor); wxDropSource( wxDataObject& data, wxWindow *win, - const wxIcon © = wxNullIcon, - const wxIcon &move = wxNullIcon, - const wxIcon &none = wxNullIcon); + const wxCursor © = wxNullCursor, + const wxCursor &move = wxNullCursor, + const wxCursor &none = wxNullCursor); virtual wxDragResult DoDragDrop(int flags = wxDrag_CopyOnly); diff --git a/src/qt/dnd.cpp b/src/qt/dnd.cpp index 58d20d53c5..7d42adeea4 100644 --- a/src/qt/dnd.cpp +++ b/src/qt/dnd.cpp @@ -81,6 +81,12 @@ namespace return mimeData; } + + void SetDragCursor(QDrag& drag, const wxCursor& cursor, Qt::DropAction action) + { + if ( cursor.IsOk() ) + drag.setDragCursor(cursor.GetHandle().pixmap(), action); + } } namespace @@ -310,19 +316,21 @@ void wxDropTarget::Disconnect() //############################################################################## wxDropSource::wxDropSource(wxWindow *win, - const wxIcon &WXUNUSED(copy), - const wxIcon &WXUNUSED(move), - const wxIcon &WXUNUSED(none)) - : m_parentWindow(win) + const wxCursor ©, + const wxCursor &move, + const wxCursor &none) + : wxDropSourceBase(copy, move, none), + m_parentWindow(win) { } wxDropSource::wxDropSource(wxDataObject& data, wxWindow *win, - const wxIcon &WXUNUSED(copy), - const wxIcon &WXUNUSED(move), - const wxIcon &WXUNUSED(none)) - : m_parentWindow(win) + const wxCursor ©, + const wxCursor &move, + const wxCursor &none) + : wxDropSourceBase(copy, move, none), + m_parentWindow(win) { SetData(data); } @@ -335,6 +343,10 @@ wxDragResult wxDropSource::DoDragDrop(int flags /*=wxDrag_CopyOnly*/) QDrag drag(m_parentWindow->GetHandle()); drag.setMimeData(CreateMimeData(m_data)); + SetDragCursor(drag, m_cursorCopy, Qt::CopyAction); + SetDragCursor(drag, m_cursorMove, Qt::MoveAction); + SetDragCursor(drag, m_cursorStop, Qt::IgnoreAction); + Qt::DropActions actions = Qt::CopyAction | Qt::MoveAction; Qt::DropAction defaultAction = Qt::CopyAction; switch ( flags )