summaryrefslogtreecommitdiffstats
path: root/src/gui/text
diff options
context:
space:
mode:
authorShane Kearns <shane.kearns@sosco.com>2009-10-12 16:23:31 (GMT)
committerShane Kearns <shane.kearns@sosco.com>2009-10-12 17:31:51 (GMT)
commit38b95b106cfd3949e6830fd516fbc31333b6ac5f (patch)
tree845a257eedd20ba1cbaa93615d22ee4aaba6d403 /src/gui/text
parent912e8c4ae4f2630a49653c375ac63a71e21e0dd3 (diff)
downloadQt-38b95b106cfd3949e6830fd516fbc31333b6ac5f.zip
Qt-38b95b106cfd3949e6830fd516fbc31333b6ac5f.tar.gz
Qt-38b95b106cfd3949e6830fd516fbc31333b6ac5f.tar.bz2
Make QTextControl give the right default action to Drag manager
When dragging text from a non editable widget, QTextControlPrivate was passing allowed actions = CopyAction, default action = MoveAction. Default action is always used if you don't press any modifier keys, so text could be moved (cut) out of a non editable widget such as QLabel Task-number: QTBUG-4356 Reviewed-by: Aleksandar Sasha Babic
Diffstat (limited to 'src/gui/text')
-rw-r--r--src/gui/text/qtextcontrol.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp
index db4c07c..ee8b751 100644
--- a/src/gui/text/qtextcontrol.cpp
+++ b/src/gui/text/qtextcontrol.cpp
@@ -505,9 +505,13 @@ void QTextControlPrivate::startDrag()
drag->setMimeData(data);
Qt::DropActions actions = Qt::CopyAction;
- if (interactionFlags & Qt::TextEditable)
+ Qt::DropAction action;
+ if (interactionFlags & Qt::TextEditable) {
actions |= Qt::MoveAction;
- Qt::DropAction action = drag->exec(actions, Qt::MoveAction);
+ action = drag->exec(actions, Qt::MoveAction);
+ } else {
+ action = drag->exec(actions, Qt::CopyAction);
+ }
if (action == Qt::MoveAction && drag->target() != contextWidget)
cursor.removeSelectedText();