diff libgui/src/m-editor/octave-qscintilla.cc @ 25796:052a0d5dfd2c stable

Reenable drag and drop of editor text (Bug #54495) * libgui/src/m-editor/octave-qscintilla.h, libgui/src/m-editor/octave-qscintilla.cc (dragEnterEvent): new function to reject url mime drags * libgui/src/m-editor/file-editor-tab.cc: (file_editor_tab): remove disable for editor accept drops
author John Donoghue
date Wed, 15 Aug 2018 13:29:52 -0400
parents 5daeb4049088
children 94b8dc8292af 7a507e71d922
line wrap: on
line diff
--- a/libgui/src/m-editor/octave-qscintilla.cc	Tue Aug 14 22:42:14 2018 -0700
+++ b/libgui/src/m-editor/octave-qscintilla.cc	Wed Aug 15 13:29:52 2018 -0400
@@ -50,6 +50,8 @@
 #include <QToolTip>
 #include <QVBoxLayout>
 
+#include <QMimeData>
+
 // FIXME: hardwired marker numbers?
 #include "marker.h"
 
@@ -962,6 +964,21 @@
 
     insertAt (QString (start, ' ') + next_line, linenr + 2, 0);
   }
+
+  void octave_qscintilla::dragEnterEvent (QDragEnterEvent *e)
+  {
+    // if is not dragging a url, pass to qscintilla to handle,
+    // otherwise ignore it so that it will be handled by
+    // the parent
+    if (!e->mimeData ()->hasUrls ())
+      {
+        QsciScintilla::dragEnterEvent (e);
+      }
+    else
+      {
+        e->ignore();
+      }
+  }
 }
 
 #endif