Use QT MOC from cmake instead of own implementation
This commit is contained in:
@@ -46,8 +46,7 @@
|
||||
* *
|
||||
\*===========================================================================*/
|
||||
|
||||
#ifndef OPENMESHAPPS_VIEWERWIDGET_HH
|
||||
#define OPENMESHAPPS_VIEWERWIDGET_HH
|
||||
#pragma once
|
||||
|
||||
//== INCLUDES =================================================================
|
||||
|
||||
@@ -55,6 +54,7 @@
|
||||
#include <QString>
|
||||
#include <QMessageBox>
|
||||
#include <QFileDialog>
|
||||
#include <iostream>
|
||||
#include <OpenMesh/Tools/Utils/getopt.h>
|
||||
#include <OpenMesh/Tools/Utils/Timer.hh>
|
||||
#include <OpenMesh/Apps/QtViewer/MeshViewerWidgetT.hh>
|
||||
@@ -80,70 +80,24 @@ typedef OpenMesh::TriMesh_ArrayKernelT<MyTraits> MyMesh;
|
||||
class MeshViewerWidget : public MeshViewerWidgetT<MyMesh>
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/// default constructor
|
||||
explicit MeshViewerWidget(QWidget* parent=0) : MeshViewerWidgetT<MyMesh>(parent)
|
||||
{}
|
||||
MeshViewerWidget(QWidget* parent=0);
|
||||
|
||||
OpenMesh::IO::Options& options() { return _options; }
|
||||
const OpenMesh::IO::Options& options() const { return _options; }
|
||||
void setOptions(const OpenMesh::IO::Options& opts) { _options = opts; }
|
||||
|
||||
void open_mesh_gui(QString fname)
|
||||
{
|
||||
OpenMesh::Utils::Timer t;
|
||||
t.start();
|
||||
if ( fname.isEmpty() || !open_mesh(fname.toLocal8Bit(), _options) )
|
||||
{
|
||||
QString msg = "Cannot read mesh from file:\n '";
|
||||
msg += fname;
|
||||
msg += "'";
|
||||
QMessageBox::critical( NULL, windowTitle(), msg);
|
||||
}
|
||||
t.stop();
|
||||
std::cout << "Loaded mesh in ~" << t.as_string() << std::endl;
|
||||
}
|
||||
void open_texture_gui(QString fname)
|
||||
{
|
||||
if ( fname.isEmpty() || !open_texture( fname.toLocal8Bit() ) )
|
||||
{
|
||||
QString msg = "Cannot load texture image from file:\n '";
|
||||
msg += fname;
|
||||
msg += "'\n\nPossible reasons:\n";
|
||||
msg += "- Mesh file didn't provide texture coordinates\n";
|
||||
msg += "- Texture file does not exist\n";
|
||||
msg += "- Texture file is not accessible.\n";
|
||||
QMessageBox::warning( NULL, windowTitle(), msg );
|
||||
}
|
||||
}
|
||||
void open_mesh_gui(QString fname);
|
||||
|
||||
void open_texture_gui(QString fname);
|
||||
|
||||
public slots:
|
||||
void query_open_mesh_file() {
|
||||
QString fileName = QFileDialog::getOpenFileName(this,
|
||||
tr("Open mesh file"),
|
||||
tr(""),
|
||||
tr("OBJ Files (*.obj);;"
|
||||
"OFF Files (*.off);;"
|
||||
"STL Files (*.stl);;"
|
||||
"All Files (*)"));
|
||||
if (!fileName.isEmpty())
|
||||
open_mesh_gui(fileName);
|
||||
}
|
||||
void query_open_texture_file() {
|
||||
QString fileName = QFileDialog::getOpenFileName(this,
|
||||
tr("Open texture file"),
|
||||
tr(""),
|
||||
tr("PNG Files (*.png);;"
|
||||
"BMP Files (*.bmp);;"
|
||||
"GIF Files (*.gif);;"
|
||||
"JPEG Files (*.jpg);;"
|
||||
"TIFF Files (*.tif);;"
|
||||
"All Files (*)"));
|
||||
if (!fileName.isEmpty())
|
||||
open_texture_gui(fileName);
|
||||
}
|
||||
void query_open_mesh_file();
|
||||
|
||||
void query_open_texture_file();
|
||||
private:
|
||||
OpenMesh::IO::Options _options;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user