started qt6 migration
This commit is contained in:
Submodule cmake-library updated: ab9edd278c...fb43548481
@@ -41,14 +41,14 @@ if ( BUILD_APPS )
|
|||||||
find_package (OpenGL)
|
find_package (OpenGL)
|
||||||
|
|
||||||
# For the apps, we need qt and opengl to build them
|
# For the apps, we need qt and opengl to build them
|
||||||
if (NOT QT5_FOUND)
|
if (NOT QT_FOUND)
|
||||||
set(QT5_REQUIRED_PACKAGES
|
set(QT_REQUIRED_PACKAGES
|
||||||
Qt5Core
|
Core
|
||||||
Qt5Widgets
|
Widgets
|
||||||
Qt5OpenGL
|
OpenGL
|
||||||
Qt5Gui
|
Gui
|
||||||
)
|
)
|
||||||
vci_qt5 ()
|
vci_qt ()
|
||||||
set(CMAKE_AUTOMOC ON)
|
set(CMAKE_AUTOMOC ON)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@@ -57,7 +57,7 @@ if ( BUILD_APPS )
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
# check for OpenGL as our required dependencies
|
# check for OpenGL as our required dependencies
|
||||||
if (( QT5_FOUND ) AND OPENGL_FOUND AND NOT "${CMAKE_GENERATOR}" MATCHES "MinGW Makefiles" )
|
if (( QT_FOUND ) AND OPENGL_FOUND AND NOT "${CMAKE_GENERATOR}" MATCHES "MinGW Makefiles" )
|
||||||
|
|
||||||
add_subdirectory (Decimating/DecimaterGui)
|
add_subdirectory (Decimating/DecimaterGui)
|
||||||
add_subdirectory (QtViewer)
|
add_subdirectory (QtViewer)
|
||||||
@@ -95,8 +95,8 @@ if ( BUILD_APPS )
|
|||||||
|
|
||||||
else () # QT ,Opengl or glut not found
|
else () # QT ,Opengl or glut not found
|
||||||
|
|
||||||
if (NOT QT5_FOUND)
|
if (NOT QT_FOUND)
|
||||||
message ("QT5 not found! Skipping some apps.")
|
message ("QT not found! Skipping some apps.")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if (NOT OPENGL_FOUND)
|
if (NOT OPENGL_FOUND)
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ endif ()
|
|||||||
target_link_libraries (DecimaterGui
|
target_link_libraries (DecimaterGui
|
||||||
OpenMeshCore
|
OpenMeshCore
|
||||||
OpenMeshTools
|
OpenMeshTools
|
||||||
Qt5::OpenGL
|
${QT_TARGET}::OpenGL
|
||||||
${OPENGL_LIBRARIES}
|
${OPENGL_LIBRARIES}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -50,6 +50,7 @@
|
|||||||
#include <OpenMesh/Tools/Utils/getopt.h>
|
#include <OpenMesh/Tools/Utils/getopt.h>
|
||||||
#include <qapplication.h>
|
#include <qapplication.h>
|
||||||
#include <qmessagebox.h>
|
#include <qmessagebox.h>
|
||||||
|
#include <QOpenGLContext>
|
||||||
|
|
||||||
#include "DecimaterViewerWidget.hh"
|
#include "DecimaterViewerWidget.hh"
|
||||||
|
|
||||||
@@ -65,7 +66,11 @@ int main(int argc, char **argv)
|
|||||||
// OpenGL check
|
// OpenGL check
|
||||||
QApplication app(argc,argv);
|
QApplication app(argc,argv);
|
||||||
|
|
||||||
|
#if QT_VERSION_MAJOR < 6
|
||||||
if ( !QGLFormat::hasOpenGL() ) {
|
if ( !QGLFormat::hasOpenGL() ) {
|
||||||
|
#else
|
||||||
|
if ( QOpenGLContext::openGLModuleType() != QOpenGLContext::LibGL ) {
|
||||||
|
#endif
|
||||||
QString msg = "System has no OpenGL support!";
|
QString msg = "System has no OpenGL support!";
|
||||||
QMessageBox::critical( nullptr, "OpenGL", msg + argv[1] );
|
QMessageBox::critical( nullptr, "OpenGL", msg + argv[1] );
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ endif ()
|
|||||||
target_link_libraries ( ProgViewer
|
target_link_libraries ( ProgViewer
|
||||||
OpenMeshCore
|
OpenMeshCore
|
||||||
OpenMeshTools
|
OpenMeshTools
|
||||||
Qt5::OpenGL
|
${QT_TARGET}::OpenGL
|
||||||
${OPENGL_LIBRARIES}
|
${OPENGL_LIBRARIES}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -51,15 +51,20 @@
|
|||||||
#include <OpenMesh/Apps/ProgViewer/ProgViewerWidget.hh>
|
#include <OpenMesh/Apps/ProgViewer/ProgViewerWidget.hh>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QGLWidget>
|
#if QT_VERSION_MAJOR > 5
|
||||||
|
#include <QOpenGLContext>
|
||||||
|
#endif
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
// OpenGL check
|
// OpenGL check
|
||||||
QApplication app(argc,argv);
|
QApplication app(argc,argv);
|
||||||
|
|
||||||
|
#if QT_VERSION_MAJOR < 6
|
||||||
if ( !QGLFormat::hasOpenGL() ) {
|
if ( !QGLFormat::hasOpenGL() ) {
|
||||||
|
#else
|
||||||
|
if ( QOpenGLContext::openGLModuleType() != QOpenGLContext::LibGL ) {
|
||||||
|
#endif
|
||||||
std::cerr << "This system has no OpenGL support.\n";
|
std::cerr << "This system has no OpenGL support.\n";
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ endif ()
|
|||||||
target_link_libraries (QtViewer
|
target_link_libraries (QtViewer
|
||||||
OpenMeshCore
|
OpenMeshCore
|
||||||
OpenMeshTools
|
OpenMeshTools
|
||||||
Qt5::OpenGL
|
${QT_TARGET}::OpenGL
|
||||||
${OPENGL_LIBRARIES}
|
${OPENGL_LIBRARIES}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -233,7 +233,7 @@ bool MeshViewerWidgetT<M>::set_texture( QImage& _texsrc )
|
|||||||
_texsrc = _texsrc.scaled( tex_w, tex_h, Qt::IgnoreAspectRatio, Qt::SmoothTransformation );
|
_texsrc = _texsrc.scaled( tex_w, tex_h, Qt::IgnoreAspectRatio, Qt::SmoothTransformation );
|
||||||
}
|
}
|
||||||
|
|
||||||
QImage texture( QGLWidget::convertToGLFormat ( _texsrc ) );
|
QImage texture = _texsrc.convertToFormat(QImage::Format_ARGB32).rgbSwapped();
|
||||||
|
|
||||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||||
glPixelStorei(GL_UNPACK_SKIP_ROWS, 0);
|
glPixelStorei(GL_UNPACK_SKIP_ROWS, 0);
|
||||||
|
|||||||
@@ -60,6 +60,7 @@
|
|||||||
#include <QImage>
|
#include <QImage>
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
|
#include <QActionGroup>
|
||||||
// --------------------
|
// --------------------
|
||||||
#include <OpenMesh/Apps/QtViewer/QGLViewerWidget.hh>
|
#include <OpenMesh/Apps/QtViewer/QGLViewerWidget.hh>
|
||||||
#include <OpenMesh/Tools/Utils/Timer.hh>
|
#include <OpenMesh/Tools/Utils/Timer.hh>
|
||||||
@@ -68,6 +69,10 @@
|
|||||||
# define M_PI 3.1415926535897932
|
# define M_PI 3.1415926535897932
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if QT_VERSION_MAJOR > 5
|
||||||
|
#define swapBuffers()
|
||||||
|
#endif
|
||||||
|
|
||||||
const double TRACKBALL_RADIUS = 0.6;
|
const double TRACKBALL_RADIUS = 0.6;
|
||||||
|
|
||||||
|
|
||||||
@@ -81,21 +86,22 @@ std::string QGLViewerWidget::nomode_ = "";
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
QGLViewerWidget::QGLViewerWidget( QWidget* _parent )
|
#if QT_VERSION_MAJOR < 6
|
||||||
: QGLWidget( _parent )
|
QGLViewerWidget::QGLViewerWidget( QWidget* _parent ) : QGLWidget( _parent )
|
||||||
|
#else
|
||||||
|
QGLViewerWidget::QGLViewerWidget( QWidget* _parent ) : QOpenGLWidget( _parent )
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
QGLViewerWidget::
|
#if QT_VERSION_MAJOR > 5
|
||||||
QGLViewerWidget( QGLFormat& _fmt, QWidget* _parent )
|
void QGLViewerWidget::updateGL() {
|
||||||
: QGLWidget( _fmt, _parent )
|
update();
|
||||||
{
|
|
||||||
init();
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -330,7 +336,7 @@ QGLViewerWidget::mouseMoveEvent( QMouseEvent* _event )
|
|||||||
|
|
||||||
|
|
||||||
// move in z direction
|
// move in z direction
|
||||||
if ( (_event->buttons() == (LeftButton+MidButton)) ||
|
if ( (_event->buttons() == (LeftButton|MiddleButton)) ||
|
||||||
(_event->buttons() == LeftButton && _event->modifiers() == ControlModifier))
|
(_event->buttons() == LeftButton && _event->modifiers() == ControlModifier))
|
||||||
{
|
{
|
||||||
float value_y = radius_ * dy * 3.0 / h;
|
float value_y = radius_ * dy * 3.0 / h;
|
||||||
@@ -339,7 +345,7 @@ QGLViewerWidget::mouseMoveEvent( QMouseEvent* _event )
|
|||||||
|
|
||||||
|
|
||||||
// move in x,y direction
|
// move in x,y direction
|
||||||
else if ( (_event->buttons() == MidButton) ||
|
else if ( (_event->buttons() == MiddleButton) ||
|
||||||
(_event->buttons() == LeftButton && _event->modifiers() == AltModifier) )
|
(_event->buttons() == LeftButton && _event->modifiers() == AltModifier) )
|
||||||
{
|
{
|
||||||
float z = - (modelview_matrix_[ 2]*center_[0] +
|
float z = - (modelview_matrix_[ 2]*center_[0] +
|
||||||
@@ -417,7 +423,7 @@ void QGLViewerWidget::wheelEvent(QWheelEvent* _event)
|
|||||||
{
|
{
|
||||||
// Use the mouse wheel to zoom in/out
|
// Use the mouse wheel to zoom in/out
|
||||||
|
|
||||||
float d = -(float)_event->delta() / 120.0 * 0.2 * radius_;
|
float d = -(float)( _event->angleDelta().y() / 120.0 * 0.2 * radius_ );
|
||||||
translate(Vec3f(0.0, 0.0, d));
|
translate(Vec3f(0.0, 0.0, d));
|
||||||
updateGL();
|
updateGL();
|
||||||
_event->accept();
|
_event->accept();
|
||||||
|
|||||||
@@ -47,14 +47,15 @@
|
|||||||
|
|
||||||
|
|
||||||
//== INCLUDES =================================================================
|
//== INCLUDES =================================================================
|
||||||
|
|
||||||
|
|
||||||
#include <OpenMesh/Core/Geometry/VectorT.hh>
|
#include <OpenMesh/Core/Geometry/VectorT.hh>
|
||||||
#include <QGLWidget>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#if QT_VERSION_MAJOR < 6
|
||||||
|
#include <QGLWidget>
|
||||||
|
#else
|
||||||
|
#include <QtOpenGLWidgets/QOpenGLWidget>
|
||||||
|
#endif
|
||||||
|
|
||||||
//== FORWARD DECLARATIONS =====================================================
|
//== FORWARD DECLARATIONS =====================================================
|
||||||
|
|
||||||
@@ -64,21 +65,25 @@ class QAction;
|
|||||||
|
|
||||||
//== CLASS DEFINITION =========================================================
|
//== CLASS DEFINITION =========================================================
|
||||||
|
|
||||||
|
#if QT_VERSION_MAJOR < 6
|
||||||
class QGLViewerWidget : public QGLWidget
|
class QGLViewerWidget : public QGLWidget
|
||||||
|
#else
|
||||||
|
class QGLViewerWidget : public QOpenGLWidget
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
#if QT_VERSION_MAJOR < 6
|
||||||
typedef QGLWidget Super;
|
typedef QGLWidget Super;
|
||||||
|
#else
|
||||||
|
typedef QOpenGLWidget Super;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Default constructor.
|
// Default constructor.
|
||||||
explicit QGLViewerWidget( QWidget* _parent=0 );
|
explicit QGLViewerWidget( QWidget* _parent=0 );
|
||||||
|
|
||||||
//
|
|
||||||
QGLViewerWidget( QGLFormat& _fmt, QWidget* _parent=0 );
|
|
||||||
|
|
||||||
// Destructor.
|
// Destructor.
|
||||||
virtual ~QGLViewerWidget();
|
virtual ~QGLViewerWidget();
|
||||||
|
|
||||||
@@ -88,6 +93,11 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
#if QT_VERSION_MAJOR > 5
|
||||||
|
/* Updates the gui - used to provide backwards compability */
|
||||||
|
void updateGL();
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Sets the center and size of the whole scene.
|
/* Sets the center and size of the whole scene.
|
||||||
The _center is used as fixpoint for rotations and for adjusting
|
The _center is used as fixpoint for rotations and for adjusting
|
||||||
the camera/viewer (see view_all()). */
|
the camera/viewer (see view_all()). */
|
||||||
|
|||||||
@@ -44,12 +44,16 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#include <QMenuBar>
|
#include <QMenuBar>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
|
#if QT_VERSION_MAJOR > 5
|
||||||
|
#include <QOpenGLContext>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "MeshViewerWidget.hh"
|
#include "MeshViewerWidget.hh"
|
||||||
|
|
||||||
@@ -62,7 +66,11 @@ int main(int argc, char **argv)
|
|||||||
// OpenGL check
|
// OpenGL check
|
||||||
QApplication app(argc,argv);
|
QApplication app(argc,argv);
|
||||||
|
|
||||||
if ( !QGLFormat::hasOpenGL() ) {
|
#if QT_VERSION_MAJOR < 6
|
||||||
|
if ( !QGLFormat::hasOpenGL() ) {
|
||||||
|
#else
|
||||||
|
if ( QOpenGLContext::openGLModuleType() != QOpenGLContext::LibGL ) {
|
||||||
|
#endif
|
||||||
QString msg = "System has no OpenGL support!";
|
QString msg = "System has no OpenGL support!";
|
||||||
QMessageBox::critical( nullptr, QString("OpenGL"), msg + QString(argv[1]) );
|
QMessageBox::critical( nullptr, QString("OpenGL"), msg + QString(argv[1]) );
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ endif ()
|
|||||||
target_link_libraries (SubdividerGui
|
target_link_libraries (SubdividerGui
|
||||||
OpenMeshCore
|
OpenMeshCore
|
||||||
OpenMeshTools
|
OpenMeshTools
|
||||||
Qt5::OpenGL
|
${QT_TARGET}::OpenGL
|
||||||
${OPENGL_LIBRARIES}
|
${OPENGL_LIBRARIES}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -51,13 +51,20 @@
|
|||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include "SubdivideWidget.hh"
|
#include "SubdivideWidget.hh"
|
||||||
|
#if QT_VERSION_MAJOR > 5
|
||||||
|
#include <QOpenGLContext>
|
||||||
|
#endif
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
// OpenGL check
|
// OpenGL check
|
||||||
QApplication app(argc,argv);
|
QApplication app(argc,argv);
|
||||||
|
|
||||||
|
#if QT_VERSION_MAJOR < 6
|
||||||
if ( !QGLFormat::hasOpenGL() ) {
|
if ( !QGLFormat::hasOpenGL() ) {
|
||||||
|
#else
|
||||||
|
if ( QOpenGLContext::openGLModuleType() != QOpenGLContext::LibGL ) {
|
||||||
|
#endif
|
||||||
QString msg = "System has no OpenGL support!";
|
QString msg = "System has no OpenGL support!";
|
||||||
QMessageBox::critical( nullptr, "OpenGL", msg + argv[1], QMessageBox::Ok );
|
QMessageBox::critical( nullptr, "OpenGL", msg + argv[1], QMessageBox::Ok );
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
@@ -25,6 +25,6 @@ endif ()
|
|||||||
target_link_libraries (Synthesizer
|
target_link_libraries (Synthesizer
|
||||||
OpenMeshCore
|
OpenMeshCore
|
||||||
OpenMeshTools
|
OpenMeshTools
|
||||||
Qt5::OpenGL
|
${QT_TARGET}::OpenGL
|
||||||
${OPENGL_LIBRARIES}
|
${OPENGL_LIBRARIES}
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -49,6 +49,9 @@
|
|||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
#if QT_VERSION_MAJOR > 5
|
||||||
|
#include <QOpenGLContext>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "VDPMSynthesizerViewerWidget.hh"
|
#include "VDPMSynthesizerViewerWidget.hh"
|
||||||
|
|
||||||
@@ -58,7 +61,11 @@ int main(int argc, char **argv)
|
|||||||
QApplication app(argc,argv);
|
QApplication app(argc,argv);
|
||||||
|
|
||||||
|
|
||||||
|
#if QT_VERSION_MAJOR < 6
|
||||||
if ( !QGLFormat::hasOpenGL() ) {
|
if ( !QGLFormat::hasOpenGL() ) {
|
||||||
|
#else
|
||||||
|
if ( QOpenGLContext::openGLModuleType() != QOpenGLContext::LibGL ) {
|
||||||
|
#endif
|
||||||
std::cerr << "This system has no OpenGL support.\n";
|
std::cerr << "This system has no OpenGL support.\n";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user