mod_geo-tp/src/main_window.cpp

36 lines
1.0 KiB
C++
Raw Normal View History

2021-09-20 20:36:29 +02:00
#include "main_window.h"
2021-10-02 20:47:02 +02:00
#include "mesh_processor.h"
2021-09-20 20:36:29 +02:00
#include <QApplication>
#include <QFileDialog>
MainWindow::MainWindow(QWidget *parent)
:QMainWindow(parent),
2021-10-03 00:24:20 +02:00
toolbar(this),
mesh_viewer(this) {
connect(&mesh_viewer, &MeshViewer::initialized, [&]() {
open_action->setEnabled(true);
});
2021-09-20 20:36:29 +02:00
setCentralWidget(&mesh_viewer);
addToolBar(Qt::RightToolBarArea, &toolbar);
open_action = toolbar.addAction("Ouvrir…", [&](){
2021-10-02 20:47:02 +02:00
emit open(QFileDialog::getOpenFileName(this, "Ouvrir un maillage"));
2021-09-20 20:36:29 +02:00
});
// toolbar_actions.append(toolbar.addAction("Fractionner", [&](){
// QVector<QPair<MyMesh::Point, MyMesh>> fragments = shatter(mesh);
// mesh_viewer.removeOpenGLMesh(glm);
// for (auto &[pos, fragment] : fragments) {
// fragment.triangulate();
// QMatrix4x4 mat;
// float scale = 1.2;
// mat.translate(pos[0] * scale, pos[1] * scale, pos[2] * scale);
// mesh_viewer.addOpenGLMeshFromOpenMesh(&fragment, mat);
// }
// }));
open_action->setEnabled(false);
for (QAction *a : toolbar_actions) {
a->setEnabled(false);
}
}