forked from qt-creator/qt-creator
Dropping files into the editor shouldn't insert file:///...
On some desktop environments, dragging and dropping a file gives us the url to the file in multiple mime types, including text/plain. This causes the url to be inserted as text by default. Work around this issue by explicitly ignoring drop events for the text editor when they also come with urls. Task-number: QTCREATORBUG-728 Reviewed-by: Friedemann Kleint
This commit is contained in:
@@ -3388,6 +3388,17 @@ void BaseTextEditor::keyReleaseEvent(QKeyEvent *e)
|
||||
QPlainTextEdit::keyReleaseEvent(e);
|
||||
}
|
||||
|
||||
void BaseTextEditor::dragEnterEvent(QDragEnterEvent *e)
|
||||
{
|
||||
// If the drag event contains URLs, we don't want to insert them as text
|
||||
if (e->mimeData()->hasUrls()) {
|
||||
e->ignore();
|
||||
return;
|
||||
}
|
||||
|
||||
QPlainTextEdit::dragEnterEvent(e);
|
||||
}
|
||||
|
||||
void BaseTextEditor::extraAreaLeaveEvent(QEvent *)
|
||||
{
|
||||
// fake missing mouse move event from Qt
|
||||
|
||||
Reference in New Issue
Block a user