diff --git a/src/Gui/View3DInventor.cpp b/src/Gui/View3DInventor.cpp index d9e3fc97558d..26b776887587 100644 --- a/src/Gui/View3DInventor.cpp +++ b/src/Gui/View3DInventor.cpp @@ -618,7 +618,7 @@ bool View3DInventor::onMsg(const char* pMsg, const char** ppReturn) else if(strcmp("SetStereoOff",pMsg) == 0 ) { _viewer->setStereoMode(Quarter::SoQTQuarterAdaptor::MONO ); return true; - } + } else if(strcmp("Example1",pMsg) == 0 ) { SoSeparator * root = new SoSeparator; Texture3D(root); @@ -946,7 +946,7 @@ void View3DInventor::dropEvent (QDropEvent * e) void View3DInventor::dragEnterEvent (QDragEnterEvent * e) { - // Here we must allow uri drafs and check them in dropEvent + // Here we must allow uri drags and check them in dropEvent const QMimeData* data = e->mimeData(); if (data->hasUrls()) e->accept(); diff --git a/src/Gui/View3DInventorViewer.cpp b/src/Gui/View3DInventorViewer.cpp index 2634a936b9d5..6f8cf22258af 100644 --- a/src/Gui/View3DInventorViewer.cpp +++ b/src/Gui/View3DInventorViewer.cpp @@ -2749,3 +2749,44 @@ PyObject *View3DInventorViewer::getPyObject(void) Py_INCREF(_viewerPy); return _viewerPy; } +/** + * Drops the event \a e and loads the files into the given document. + */ +void View3DInventorViewer::dropEvent (QDropEvent * e) +{ + const QMimeData* data = e->mimeData(); + if (data->hasUrls() && selectionRoot && selectionRoot->pcDocument) { + getMainWindow()->loadUrls(selectionRoot->pcDocument->getDocument(), data->urls()); + } + else { + inherited::dropEvent(e); + } +} + +void View3DInventorViewer::dragEnterEvent (QDragEnterEvent * e) +{ + // Here we must allow uri drags and check them in dropEvent + const QMimeData* data = e->mimeData(); + if (data->hasUrls()) { + e->accept(); + } + else { + inherited::dragEnterEvent(e); + } +} + +void View3DInventorViewer::dragMoveEvent(QDragMoveEvent *e) +{ + const QMimeData* data = e->mimeData(); + if (data->hasUrls() && selectionRoot && selectionRoot->pcDocument) { + e->accept(); + } + else { + inherited::dragMoveEvent(e); + } +} + +void View3DInventorViewer::dragLeaveEvent(QDragLeaveEvent *e) +{ + inherited::dragLeaveEvent(e); +} diff --git a/src/Gui/View3DInventorViewer.h b/src/Gui/View3DInventorViewer.h index 02b0e6addb1d..5c17d65d28c5 100644 --- a/src/Gui/View3DInventorViewer.h +++ b/src/Gui/View3DInventorViewer.h @@ -354,6 +354,10 @@ class GuiExport View3DInventorViewer : public Quarter::SoQTQuarterAdaptor, publi virtual void setSeekMode(SbBool enable); virtual void afterRealizeHook(void); virtual bool processSoEvent(const SoEvent * ev); + void dropEvent (QDropEvent * e); + void dragEnterEvent (QDragEnterEvent * e); + void dragMoveEvent(QDragMoveEvent *e); + void dragLeaveEvent(QDragLeaveEvent *e); SbBool processSoEventBase(const SoEvent * const ev); void printDimension(); void selectAll();