From cbdf46098dba75530ac8d240670a030ffaadfde2 Mon Sep 17 00:00:00 2001 From: f4exb Date: Fri, 18 Mar 2022 18:13:08 +0100 Subject: [PATCH] Replace obsolete QGLWidget by QOpenGLWidget --- sdrgui/gui/glscope.cpp | 5 +++-- sdrgui/gui/glscope.h | 4 ++-- sdrgui/gui/glspectrum.cpp | 8 ++++---- sdrgui/gui/glspectrum.h | 4 ++-- sdrgui/gui/tvscreen.cpp | 4 ++-- sdrgui/gui/tvscreen.h | 4 ++-- sdrgui/gui/tvscreenanalog.cpp | 12 ++++++++---- sdrgui/gui/tvscreenanalog.h | 4 ++-- 8 files changed, 25 insertions(+), 20 deletions(-) diff --git a/sdrgui/gui/glscope.cpp b/sdrgui/gui/glscope.cpp index 8d6daefc2..9373ff3db 100644 --- a/sdrgui/gui/glscope.cpp +++ b/sdrgui/gui/glscope.cpp @@ -39,7 +39,8 @@ const GLfloat GLScope::m_q3RadiiConst[] = { 1.0f, 0.75f, 0.0f, 0.25f // 150 }; -GLScope::GLScope(QWidget *parent) : QGLWidget(parent), +GLScope::GLScope(QWidget *parent) : + QOpenGLWidget(parent), m_tracesData(nullptr), m_traces(nullptr), m_projectionTypes(nullptr), @@ -195,7 +196,7 @@ void GLScope::initializeGL() } } - connect(glCurrentContext, &QOpenGLContext::aboutToBeDestroyed, this, &GLScope::cleanup); // TODO: when migrating to QOpenGLWidget + connect(glCurrentContext, &QOpenGLContext::aboutToBeDestroyed, this, &GLScope::cleanup); QOpenGLFunctions *glFunctions = QOpenGLContext::currentContext()->functions(); glFunctions->initializeOpenGLFunctions(); diff --git a/sdrgui/gui/glscope.h b/sdrgui/gui/glscope.h index ec670e400..65c7df0f6 100644 --- a/sdrgui/gui/glscope.h +++ b/sdrgui/gui/glscope.h @@ -19,7 +19,7 @@ #ifndef SDRBASE_GUI_GLSCOPENG_H_ #define SDRBASE_GUI_GLSCOPENG_H_ -#include +#include #include #include #include @@ -40,7 +40,7 @@ class QPainter; -class SDRGUI_API GLScope: public QGLWidget, public GLScopeInterface +class SDRGUI_API GLScope: public QOpenGLWidget, public GLScopeInterface { Q_OBJECT diff --git a/sdrgui/gui/glspectrum.cpp b/sdrgui/gui/glspectrum.cpp index 7b306026b..d9b846398 100644 --- a/sdrgui/gui/glspectrum.cpp +++ b/sdrgui/gui/glspectrum.cpp @@ -40,7 +40,7 @@ const float GLSpectrum::m_maxFrequencyZoom = 10.0f; const float GLSpectrum::m_annotationMarkerHeight = 20.0f; GLSpectrum::GLSpectrum(QWidget* parent) : - QGLWidget(parent), + QOpenGLWidget(parent), m_markersDisplay(SpectrumSettings::MarkersDisplaySpectrum), m_cursorState(CSNormal), m_cursorChannel(0), @@ -697,7 +697,7 @@ void GLSpectrum::initializeGL() return; } - connect(glCurrentContext, &QOpenGLContext::aboutToBeDestroyed, this, &GLSpectrum::cleanup); // TODO: when migrating to QOpenGLWidget + connect(glCurrentContext, &QOpenGLContext::aboutToBeDestroyed, this, &GLSpectrum::cleanup); QOpenGLFunctions *glFunctions = QOpenGLContext::currentContext()->functions(); glFunctions->initializeOpenGLFunctions(); @@ -3034,14 +3034,14 @@ void GLSpectrum::enterEvent(QEvent* event) { m_mouseInside = true; update(); - QGLWidget::enterEvent(event); + QOpenGLWidget::enterEvent(event); } void GLSpectrum::leaveEvent(QEvent* event) { m_mouseInside = false; update(); - QGLWidget::enterEvent(event); + QOpenGLWidget::enterEvent(event); } void GLSpectrum::tick() diff --git a/sdrgui/gui/glspectrum.h b/sdrgui/gui/glspectrum.h index 7663a4e5c..a7676afd9 100644 --- a/sdrgui/gui/glspectrum.h +++ b/sdrgui/gui/glspectrum.h @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include "gui/scaleengine.h" #include "gui/glshadersimple.h" #include "gui/glshadertextured.h" @@ -43,7 +43,7 @@ class QOpenGLShaderProgram; class MessageQueue; class SpectrumVis; -class SDRGUI_API GLSpectrum : public QGLWidget, public GLSpectrumInterface { +class SDRGUI_API GLSpectrum : public QOpenGLWidget, public GLSpectrumInterface { Q_OBJECT public: diff --git a/sdrgui/gui/tvscreen.cpp b/sdrgui/gui/tvscreen.cpp index b8a9e1f7d..ad49c773d 100644 --- a/sdrgui/gui/tvscreen.cpp +++ b/sdrgui/gui/tvscreen.cpp @@ -33,7 +33,7 @@ // Note: When this object is created, QWidget* is converted to bool TVScreen::TVScreen(bool color, QWidget* parent) : - QGLWidget(parent), + QOpenGLWidget(parent), m_mutex(QMutex::Recursive), m_glShaderArray(color) { @@ -156,7 +156,7 @@ void TVScreen::initializeGL() &QOpenGLContext::aboutToBeDestroyed, this, &TVScreen::cleanup - ); // TODO: when migrating to QOpenGLWidget + ); m_glContextInitialized = true; } diff --git a/sdrgui/gui/tvscreen.h b/sdrgui/gui/tvscreen.h index b93d9676b..eadc25cde 100644 --- a/sdrgui/gui/tvscreen.h +++ b/sdrgui/gui/tvscreen.h @@ -22,7 +22,7 @@ #ifndef INCLUDE_TVSCREEN_H #define INCLUDE_TVSCREEN_H -#include +#include #include #include #include @@ -36,7 +36,7 @@ class QPainter; -class SDRGUI_API TVScreen: public QGLWidget +class SDRGUI_API TVScreen: public QOpenGLWidget { Q_OBJECT diff --git a/sdrgui/gui/tvscreenanalog.cpp b/sdrgui/gui/tvscreenanalog.cpp index 6c196aead..7fdbf24ae 100644 --- a/sdrgui/gui/tvscreenanalog.cpp +++ b/sdrgui/gui/tvscreenanalog.cpp @@ -64,8 +64,8 @@ static const char* fragmentShaderSource = " gl_FragColor = vec4(p);\n" "}\n"; -TVScreenAnalog::TVScreenAnalog(QWidget *parent) - : QGLWidget(parent), +TVScreenAnalog::TVScreenAnalog(QWidget *parent) : + QOpenGLWidget(parent), m_shader(nullptr), m_imageTexture(nullptr), m_lineShiftsTexture(nullptr) @@ -134,8 +134,12 @@ void TVScreenAnalog::initializeGL() { initializeOpenGLFunctions(); - connect(QOpenGLContext::currentContext(), &QOpenGLContext::aboutToBeDestroyed, - this, &TVScreenAnalog::cleanup); // TODO: when migrating to QOpenGLWidget + connect( + QOpenGLContext::currentContext(), + &QOpenGLContext::aboutToBeDestroyed, + this, + &TVScreenAnalog::cleanup + ); m_shader = new QOpenGLShaderProgram(this); diff --git a/sdrgui/gui/tvscreenanalog.h b/sdrgui/gui/tvscreenanalog.h index 6640d80b0..3d1f6a2c3 100644 --- a/sdrgui/gui/tvscreenanalog.h +++ b/sdrgui/gui/tvscreenanalog.h @@ -27,7 +27,7 @@ #include #include -#include +#include #include #include #include @@ -108,7 +108,7 @@ private: int* m_outOfBoundsLine; }; -class SDRGUI_API TVScreenAnalog : public QGLWidget, protected QOpenGLFunctions +class SDRGUI_API TVScreenAnalog : public QOpenGLWidget, protected QOpenGLFunctions { Q_OBJECT