Get rid of another switch/default issue by avoiding switch altogther. Makes the code more readable (I think) actually.

This commit is contained in:
Jay Nabonne
2019-01-30 16:09:18 +00:00
parent 653979936b
commit 111a37fd73

View File

@@ -372,19 +372,15 @@ wxDragResult wxDropSource::DoDragDrop(int flags /*=wxDrag_CopyOnly*/)
SetDragCursor(drag, m_cursorMove, Qt::MoveAction); SetDragCursor(drag, m_cursorMove, Qt::MoveAction);
SetDragCursor(drag, m_cursorStop, Qt::IgnoreAction); SetDragCursor(drag, m_cursorStop, Qt::IgnoreAction);
Qt::DropActions actions = Qt::CopyAction | Qt::MoveAction; const Qt::DropActions actions =
Qt::DropAction defaultAction = Qt::CopyAction; flags == wxDrag_CopyOnly
switch ( flags ) ? Qt::CopyAction
{ : Qt::CopyAction | Qt::MoveAction;
case wxDrag_CopyOnly:
actions = Qt::CopyAction; const Qt::DropAction defaultAction =
break; flags == wxDrag_DefaultMove
case wxDrag_DefaultMove: ? Qt::MoveAction
defaultAction = Qt::MoveAction; : Qt::CopyAction;
break;
default:
break;
}
return DropActionToDragResult(drag.exec(actions, defaultAction)); return DropActionToDragResult(drag.exec(actions, defaultAction));
} }