From 111a37fd737560c0894fabdc89bd83cf37ab455c Mon Sep 17 00:00:00 2001 From: Jay Nabonne Date: Wed, 30 Jan 2019 16:09:18 +0000 Subject: [PATCH] Get rid of another switch/default issue by avoiding switch altogther. Makes the code more readable (I think) actually. --- src/qt/dnd.cpp | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/src/qt/dnd.cpp b/src/qt/dnd.cpp index 2b4794e2e9..8186a3d951 100644 --- a/src/qt/dnd.cpp +++ b/src/qt/dnd.cpp @@ -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)); }