]> git.sur5r.net Git - fstl/commitdiff
Cross-thread lambda functions fail on win32
authorMatt Keeter <matt.j.keeter@gmail.com>
Fri, 21 Mar 2014 21:30:54 +0000 (17:30 -0400)
committerMatt Keeter <matt.j.keeter@gmail.com>
Fri, 21 Mar 2014 21:30:54 +0000 (17:30 -0400)
src/canvas.cpp
src/canvas.h
src/window.cpp
src/window.h

index 4c31c6c8896efab5eeb25986d64a6fe782648848..930fd2cde13402b6c0b2bbd37eb803103fdf6a6f 100644 (file)
@@ -41,6 +41,12 @@ void Canvas::set_status(const QString &s)
     update();
 }
 
+void Canvas::clear_status()
+{
+    status = "";
+    update();
+}
+
 void Canvas::initializeGL()
 {
     mesh_shader.addShaderFromSourceFile(QGLShader::Vertex, ":/gl/mesh.vert");
index 6507dca5b0d166872cd27c0a255376aa20399c38..810c334d7cb6acf531805b8f15d5277083235f19 100644 (file)
@@ -23,6 +23,7 @@ public:
 
 public slots:
     void set_status(const QString& s);
+    void clear_status();
     void load_mesh(Mesh* m);
 
 
index 203fff93533c6d4776810b91e3b0b6614b7f493d..15ffb0324d32000b4685b7e125b1718c254949db 100644 (file)
@@ -69,6 +69,16 @@ void Window::on_about()
         "   style=\"color: #93a1a1;\">matt.j.keeter@gmail.com</a></p>");
 }
 
+void Window::enable_open()
+{
+    open_action->setEnabled(true);
+}
+
+void Window::disable_open()
+{
+    open_action->setEnabled(false);
+}
+
 bool Window::load_stl(const QString& filename)
 {
     if (!open_action->isEnabled())  return false;
@@ -77,7 +87,7 @@ bool Window::load_stl(const QString& filename)
 
     Loader* loader = new Loader(this, filename);
     connect(loader, &Loader::started,
-            [=](){ open_action->setEnabled(false); });
+              this, &Window::disable_open);
 
     connect(loader, &Loader::got_mesh,
             canvas, &Canvas::load_mesh);
@@ -85,14 +95,14 @@ bool Window::load_stl(const QString& filename)
     connect(loader, &Loader::finished,
             loader, &Loader::deleteLater);
     connect(loader, &Loader::finished,
-            [=](){ open_action->setEnabled(true); });
+              this, &Window::enable_open);
     connect(loader, &Loader::finished,
-            [=](){ canvas->set_status(""); });
+            canvas, &Canvas::clear_status);
 
     if (filename[0] != ':')
     {
         connect(loader, &Loader::loaded_file,
-                this, &Window::setWindowTitle);
+                  this, &Window::setWindowTitle);
     }
 
     loader->start();
index 866e1033697e848f2a27aa9c4137412d388860d2..22c35cb1737dd992e0004ab8a80664146963bb32 100644 (file)
@@ -16,6 +16,9 @@ public slots:
     void on_open();
     void on_about();
 
+    void enable_open();
+    void disable_open();
+
 private:
     QAction* const open_action;
     QAction* const about_action;