File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed
liteidex/src/plugins/liteeditor Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -454,3 +454,30 @@ void LiteEditorWidget::updateFont(const QFont &font)
454
454
this ->m_completer ->popup ()->setFont (font);
455
455
}
456
456
}
457
+
458
+ void LiteEditorWidget::dropEvent (QDropEvent *event)
459
+ {
460
+ QList<QUrl> urls = event->mimeData ()->urls ();
461
+ if (urls.isEmpty ()) {
462
+ LiteEditorWidgetBase::dropEvent (event);
463
+ return ;
464
+ }
465
+ bool hasFile = false ;
466
+ foreach (QUrl url, urls) {
467
+ QString fileName = url.toLocalFile ();
468
+ if (!fileName.isEmpty ()) {
469
+ QFileInfo info (fileName);
470
+ if (info.isFile ()) {
471
+ m_liteApp->fileManager ()->openEditor (fileName,true );
472
+ } else if (info.isDir ()) {
473
+ m_liteApp->fileManager ()->addFolderList (fileName);
474
+ }
475
+ hasFile = true ;
476
+ }
477
+ }
478
+ if (hasFile) {
479
+ event->accept ();
480
+ return ;
481
+ }
482
+ LiteEditorWidgetBase::dropEvent (event);
483
+ }
Original file line number Diff line number Diff line change @@ -65,6 +65,7 @@ public slots:
65
65
QString wordUnderCursor () const ;
66
66
QString textUnderCursor (QTextCursor tc) const ;
67
67
QString importUnderCursor (QTextCursor tc) const ;
68
+ virtual void dropEvent (QDropEvent *event);
68
69
protected:
69
70
LiteApi::ICompleter *m_completer;
70
71
QMenu *m_contextMenu;
You can’t perform that action at this time.
0 commit comments