Show More
@@ -204,11 +204,21 b' class ConsoleWidget(Configurable, QtGui.QWidget):' | |||||
204 | self._control_key_down(event.modifiers()) and \ |
|
204 | self._control_key_down(event.modifiers()) and \ | |
205 | event.key() in self._shortcuts: |
|
205 | event.key() in self._shortcuts: | |
206 | event.accept() |
|
206 | event.accept() | |
207 | return False |
|
|||
208 |
|
207 | |||
209 | # Prevent text from being moved by drag and drop. |
|
208 | # Ensure that drops are safe. | |
210 | elif etype in (QtCore.QEvent.DragEnter, QtCore.QEvent.DragLeave, |
|
209 | elif etype == QtCore.QEvent.Drop and obj == self._control.viewport(): | |
211 | QtCore.QEvent.DragMove, QtCore.QEvent.Drop): |
|
210 | cursor = self._control.cursorForPosition(event.pos()) | |
|
211 | if self._in_buffer(cursor.position()): | |||
|
212 | # The text cursor is not updated during the drag. | |||
|
213 | self._control.setTextCursor(cursor) | |||
|
214 | ||||
|
215 | # Now we can perform the insertion manually. | |||
|
216 | text = unicode(event.mimeData().text()) | |||
|
217 | self._insert_plain_text_into_buffer(text) | |||
|
218 | ||||
|
219 | # Qt is expecting to get something here--drag and drop occurs in its | |||
|
220 | # own event loop. Send a DragLeave event to end it. | |||
|
221 | QtGui.qApp.sendEvent(obj, QtGui.QDragLeaveEvent()) | |||
212 | return True |
|
222 | return True | |
213 |
|
223 | |||
214 | return super(ConsoleWidget, self).eventFilter(obj, event) |
|
224 | return super(ConsoleWidget, self).eventFilter(obj, event) |
General Comments 0
You need to be logged in to leave comments.
Login now