Navigation Menu

Skip to content

Commit

Permalink
+ fix drag and drop of Quarter viewer
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed May 25, 2016
1 parent d3c5a19 commit b3abd0d
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Gui/View3DInventor.cpp
Expand Up @@ -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);
Expand Down Expand Up @@ -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();
Expand Down
41 changes: 41 additions & 0 deletions src/Gui/View3DInventorViewer.cpp
Expand Up @@ -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);
}
4 changes: 4 additions & 0 deletions src/Gui/View3DInventorViewer.h
Expand Up @@ -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();
Expand Down

0 comments on commit b3abd0d

Please sign in to comment.