add drag and drop support
This commit is contained in:
@@ -93,9 +93,18 @@ void OglViewerWidget::wheelEvent(QWheelEvent *e)
|
||||
update();
|
||||
}
|
||||
|
||||
void OglViewerWidget::dragEnterEvent(QDragEnterEvent *e)
|
||||
{
|
||||
if (e->mimeData()->hasUrls())
|
||||
if(e->mimeData()->urls().size() == 1)
|
||||
if(e->mimeData()->urls().first().toLocalFile().endsWith(".msh"))
|
||||
e->acceptProposedAction();
|
||||
|
||||
}
|
||||
|
||||
void OglViewerWidget::dropEvent(QDropEvent * e)
|
||||
{
|
||||
std::cout << e->mimeData()->text().toStdString() << std::endl;
|
||||
emit loadFile(e->mimeData()->urls().first().toLocalFile().toStdString().c_str());
|
||||
}
|
||||
|
||||
void OglViewerWidget::keyPressEvent(QKeyEvent *e)
|
||||
@@ -127,6 +136,7 @@ void OglViewerWidget::initializeGL()
|
||||
m_dataEngine = new GeometryEngine;
|
||||
connect(m_dataEngine, &GeometryEngine::requestResetView, this, &OglViewerWidget::resetView);
|
||||
connect(parentWidget(), SIGNAL(loadFile(const char*)), m_dataEngine, SLOT(loadFile(const char*)));
|
||||
connect(this, SIGNAL(loadFile(const char*)), m_dataEngine, SLOT(loadFile(const char*)));
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user