commit 41d81ccd8f85da838b4ba41c7a5d2f55157ef349
parent e67c0435557d48b79e05fca9d71cf75de4ef3b43
Author: Matt Keeter <matt.j.keeter@gmail.com>
Date: Fri, 21 Mar 2014 17:30:54 -0400
Cross-thread lambda functions fail on win32
Diffstat:
4 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/src/canvas.cpp b/src/canvas.cpp
@@ -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");
diff --git a/src/canvas.h b/src/canvas.h
@@ -23,6 +23,7 @@ public:
public slots:
void set_status(const QString& s);
+ void clear_status();
void load_mesh(Mesh* m);
diff --git a/src/window.cpp b/src/window.cpp
@@ -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();
diff --git a/src/window.h b/src/window.h
@@ -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;