NoMeshWidget.cpp 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. // Include own headers
  2. #include "NoMeshWidget.hpp"
  3. #include "../gui/ui_NoMeshWidget.h"
  4. // Include modules
  5. #include "MainWindow.hpp"
  6. // Include dependencies
  7. #include <QFileDialog>
  8. NoMeshWidget::NoMeshWidget(QWidget* parent): QWidget(parent), ui(new Ui::NoMeshWidget) {
  9. ui->setupUi(this);
  10. QObject::connect(ui->noMeshButton, &QPushButton::clicked, this, &NoMeshWidget::loadMeshFile);
  11. QObject::connect(ui->loadProjectButton, &QPushButton::clicked, this, &NoMeshWidget::loadProjectFile);
  12. }
  13. NoMeshWidget::~NoMeshWidget() {
  14. delete ui;
  15. }
  16. void NoMeshWidget::loadMeshFile() {
  17. QString fileName = QFileDialog::getOpenFileName(this, tr("Open a 3D-Object"), "", tr("3D Objects (*.3mf *.stl)"));
  18. std::string meshFile = fileName.toUtf8().constData();
  19. MainWindow::getInstance()->getStore()->loadMesh(meshFile);
  20. }
  21. void NoMeshWidget::loadProjectFile() {
  22. QString fileName = QFileDialog::getOpenFileName(this, tr("Open a TrackpointApp Project"), "", tr("TrackpointApp Projects (*.trackproj)"));
  23. std::string projectFile = fileName.toUtf8().constData();
  24. MainWindow::getInstance()->getStore()->loadProject(projectFile);
  25. }