Disable open when load is in progress
This commit is contained in:
parent
26a0a6eaf2
commit
4ec6bf9f95
2 changed files with 24 additions and 2 deletions
|
@ -17,12 +17,12 @@ Window::Window(QWidget *parent) :
|
||||||
canvas = new Canvas(format, this);
|
canvas = new Canvas(format, this);
|
||||||
setCentralWidget(canvas);
|
setCentralWidget(canvas);
|
||||||
|
|
||||||
QAction* open_action = new QAction("Open", this);
|
open_action = new QAction("Open", this);
|
||||||
open_action->setShortcut(QKeySequence::Open);
|
open_action->setShortcut(QKeySequence::Open);
|
||||||
QObject::connect(open_action, SIGNAL(triggered()),
|
QObject::connect(open_action, SIGNAL(triggered()),
|
||||||
this, SLOT(on_open()));
|
this, SLOT(on_open()));
|
||||||
|
|
||||||
QAction* quit_action = new QAction("Quit", this);
|
quit_action = new QAction("Quit", this);
|
||||||
quit_action->setShortcut(QKeySequence::Quit);
|
quit_action->setShortcut(QKeySequence::Quit);
|
||||||
QObject::connect(quit_action, SIGNAL(triggered()),
|
QObject::connect(quit_action, SIGNAL(triggered()),
|
||||||
this, SLOT(close()));
|
this, SLOT(close()));
|
||||||
|
@ -44,12 +44,29 @@ void Window::on_open()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Window::enable_open_action()
|
||||||
|
{
|
||||||
|
open_action->setEnabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Window::disable_open_action()
|
||||||
|
{
|
||||||
|
|
||||||
|
open_action->setEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Window::load_stl(const QString &filename)
|
void Window::load_stl(const QString &filename)
|
||||||
{
|
{
|
||||||
|
disable_open_action();
|
||||||
Loader* loader = new Loader(this, filename);
|
Loader* loader = new Loader(this, filename);
|
||||||
connect(loader, SIGNAL(got_mesh(Mesh*)),
|
connect(loader, SIGNAL(got_mesh(Mesh*)),
|
||||||
canvas, SLOT(load_mesh(Mesh*)));
|
canvas, SLOT(load_mesh(Mesh*)));
|
||||||
connect(loader, SIGNAL(finished()),
|
connect(loader, SIGNAL(finished()),
|
||||||
loader, SLOT(deleteLater()));
|
loader, SLOT(deleteLater()));
|
||||||
|
connect(loader, SIGNAL(finished()),
|
||||||
|
this, SLOT(enable_open_action()));
|
||||||
loader->start();
|
loader->start();
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,8 +14,13 @@ public:
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void on_open();
|
void on_open();
|
||||||
|
void disable_open_action();
|
||||||
|
void enable_open_action();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
QAction* open_action;
|
||||||
|
QAction* quit_action;
|
||||||
|
|
||||||
Canvas* canvas;
|
Canvas* canvas;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue