fix open button
This commit is contained in:
parent
31a97e7c2e
commit
e56eed0a16
14
src/main.cpp
14
src/main.cpp
@ -31,11 +31,15 @@ int main(int argc, char *argv[]) {
|
|||||||
} else if (argc == 2) {
|
} else if (argc == 2) {
|
||||||
mesh_processor = new MeshProcessor(argv[1]);
|
mesh_processor = new MeshProcessor(argv[1]);
|
||||||
}
|
}
|
||||||
// QObject::connect(&main_window, &MainWindow::open,
|
QObject::connect(&main_window, &MainWindow::open,
|
||||||
// [&](const QString &path) {
|
[&](const QString &path) {
|
||||||
// if (mesh_processor) delete mesh_processor;
|
if (mesh_processor) {
|
||||||
// mesh_processor = new MeshProcessor(path);
|
mesh_viewer->removeMesh(mesh_processor->mesh);
|
||||||
// });
|
delete mesh_processor;
|
||||||
|
}
|
||||||
|
mesh_processor = new MeshProcessor(path);
|
||||||
|
mesh_viewer->addMesh(mesh_processor->mesh);
|
||||||
|
});
|
||||||
main_window.show();
|
main_window.show();
|
||||||
return app.exec();
|
return app.exec();
|
||||||
}
|
}
|
||||||
|
@ -7,9 +7,11 @@
|
|||||||
|
|
||||||
MainWindow::MainWindow(QWidget *parent)
|
MainWindow::MainWindow(QWidget *parent)
|
||||||
:QMainWindow(parent),
|
:QMainWindow(parent),
|
||||||
mesh_viewer(this),
|
toolbar(this),
|
||||||
toolbar(this) {
|
mesh_viewer(this) {
|
||||||
connect(&mesh_viewer, &MeshViewer::initialized, this, &MainWindow::meshViewerInitialized);
|
connect(&mesh_viewer, &MeshViewer::initialized, [&]() {
|
||||||
|
open_action->setEnabled(true);
|
||||||
|
});
|
||||||
setCentralWidget(&mesh_viewer);
|
setCentralWidget(&mesh_viewer);
|
||||||
addToolBar(Qt::RightToolBarArea, &toolbar);
|
addToolBar(Qt::RightToolBarArea, &toolbar);
|
||||||
open_action = toolbar.addAction("Ouvrir…", [&](){
|
open_action = toolbar.addAction("Ouvrir…", [&](){
|
||||||
@ -31,8 +33,3 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
a->setEnabled(false);
|
a->setEnabled(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MainWindow::meshViewerInitialized() {
|
|
||||||
open_action->setEnabled(true);
|
|
||||||
}
|
|
||||||
|
@ -15,9 +15,6 @@ class MainWindow : public QMainWindow {
|
|||||||
QAction *open_action;
|
QAction *open_action;
|
||||||
QList<QAction *> toolbar_actions;
|
QList<QAction *> toolbar_actions;
|
||||||
|
|
||||||
private slots:
|
|
||||||
void meshViewerInitialized();
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void open(const QString &path);
|
void open(const QString &path);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user