From 26d21d85a2c6e2b17fbcbf799d0c23865553b3cc Mon Sep 17 00:00:00 2001 From: Matt Keeter Date: Fri, 7 Mar 2014 11:45:07 -0600 Subject: [PATCH] Set window title to filename --- src/loader.cpp | 1 + src/loader.h | 1 + src/window.cpp | 5 ++++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/loader.cpp b/src/loader.cpp index 8666161..4131d02 100644 --- a/src/loader.cpp +++ b/src/loader.cpp @@ -9,4 +9,5 @@ Loader::Loader(QObject* parent, const QString& filename) void Loader::run() { emit got_mesh(Mesh::load_stl(filename)); + emit loaded_file(filename); } diff --git a/src/loader.h b/src/loader.h index 29508f0..350985c 100644 --- a/src/loader.h +++ b/src/loader.h @@ -13,6 +13,7 @@ public: void run(); signals: + void loaded_file(QString filename); void got_mesh(Mesh* m); private: diff --git a/src/window.cpp b/src/window.cpp index 6b12563..1b3530b 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -77,13 +77,16 @@ void Window::disable_open_action() void Window::load_stl(const QString &filename) { - disable_open_action(); Loader* loader = new Loader(this, filename); + connect(loader, SIGNAL(started()), + this, SLOT(disable_open_action())); connect(loader, SIGNAL(got_mesh(Mesh*)), canvas, SLOT(load_mesh(Mesh*))); connect(loader, SIGNAL(finished()), loader, SLOT(deleteLater())); connect(loader, SIGNAL(finished()), this, SLOT(enable_open_action())); + connect(loader, SIGNAL(loaded_file(QString)), + this, SLOT(setWindowTitle(QString))); loader->start(); } -- 2.39.5