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_cursorStop, Qt::IgnoreAction);
Qt::DropActions actions = Qt::CopyAction | Qt::MoveAction;
Qt::DropAction defaultAction = Qt::CopyAction;
switch ( flags )
{
case wxDrag_CopyOnly:
actions = Qt::CopyAction;
break;
case wxDrag_DefaultMove:
defaultAction = Qt::MoveAction;
break;
default:
break;
}
const Qt::DropActions actions =
flags == wxDrag_CopyOnly
? Qt::CopyAction
: Qt::CopyAction | Qt::MoveAction;
const Qt::DropAction defaultAction =
flags == wxDrag_DefaultMove
? Qt::MoveAction
: Qt::CopyAction;
return DropActionToDragResult(drag.exec(actions, defaultAction));
}