{
setWindowTitle("fstl");
+ setAcceptDrops(true);
QFile styleFile(":/qt/style.qss");
styleFile.open( QFile::ReadOnly );
loader->start();
return true;
}
+
+void Window::dragEnterEvent(QDragEnterEvent *event)
+{
+ if (event->mimeData()->hasUrls())
+ {
+ auto urls = event->mimeData()->urls();
+ if (urls.size() == 1 && urls.front().path().endsWith(".stl"))
+ event->acceptProposedAction();
+ }
+}
+
+void Window::dropEvent(QDropEvent *event)
+{
+ load_stl(event->mimeData()->urls().front().toLocalFile());
+}
explicit Window(QWidget* parent=0);
bool load_stl(const QString& filename);
+protected:
+ void dragEnterEvent(QDragEnterEvent* event);
+ void dropEvent(QDropEvent* event);
+
public slots:
void on_open();
void on_about();