1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2025-02-03 09:44:01 -05:00

Replace obsolete QGLWidget by QOpenGLWidget

This commit is contained in:
f4exb 2022-03-18 18:13:08 +01:00
parent 60d4b2f126
commit cbdf46098d
8 changed files with 25 additions and 20 deletions

View File

@ -39,7 +39,8 @@ const GLfloat GLScope::m_q3RadiiConst[] = {
1.0f, 0.75f, 0.0f, 0.25f // 150 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_tracesData(nullptr),
m_traces(nullptr), m_traces(nullptr),
m_projectionTypes(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(); QOpenGLFunctions *glFunctions = QOpenGLContext::currentContext()->functions();
glFunctions->initializeOpenGLFunctions(); glFunctions->initializeOpenGLFunctions();

View File

@ -19,7 +19,7 @@
#ifndef SDRBASE_GUI_GLSCOPENG_H_ #ifndef SDRBASE_GUI_GLSCOPENG_H_
#define SDRBASE_GUI_GLSCOPENG_H_ #define SDRBASE_GUI_GLSCOPENG_H_
#include <QGLWidget> #include <QOpenGLWidget>
#include <QPen> #include <QPen>
#include <QTimer> #include <QTimer>
#include <QMutex> #include <QMutex>
@ -40,7 +40,7 @@
class QPainter; class QPainter;
class SDRGUI_API GLScope: public QGLWidget, public GLScopeInterface class SDRGUI_API GLScope: public QOpenGLWidget, public GLScopeInterface
{ {
Q_OBJECT Q_OBJECT

View File

@ -40,7 +40,7 @@ const float GLSpectrum::m_maxFrequencyZoom = 10.0f;
const float GLSpectrum::m_annotationMarkerHeight = 20.0f; const float GLSpectrum::m_annotationMarkerHeight = 20.0f;
GLSpectrum::GLSpectrum(QWidget* parent) : GLSpectrum::GLSpectrum(QWidget* parent) :
QGLWidget(parent), QOpenGLWidget(parent),
m_markersDisplay(SpectrumSettings::MarkersDisplaySpectrum), m_markersDisplay(SpectrumSettings::MarkersDisplaySpectrum),
m_cursorState(CSNormal), m_cursorState(CSNormal),
m_cursorChannel(0), m_cursorChannel(0),
@ -697,7 +697,7 @@ void GLSpectrum::initializeGL()
return; 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(); QOpenGLFunctions *glFunctions = QOpenGLContext::currentContext()->functions();
glFunctions->initializeOpenGLFunctions(); glFunctions->initializeOpenGLFunctions();
@ -3034,14 +3034,14 @@ void GLSpectrum::enterEvent(QEvent* event)
{ {
m_mouseInside = true; m_mouseInside = true;
update(); update();
QGLWidget::enterEvent(event); QOpenGLWidget::enterEvent(event);
} }
void GLSpectrum::leaveEvent(QEvent* event) void GLSpectrum::leaveEvent(QEvent* event)
{ {
m_mouseInside = false; m_mouseInside = false;
update(); update();
QGLWidget::enterEvent(event); QOpenGLWidget::enterEvent(event);
} }
void GLSpectrum::tick() void GLSpectrum::tick()

View File

@ -27,7 +27,7 @@
#include <QOpenGLBuffer> #include <QOpenGLBuffer>
#include <QOpenGLVertexArrayObject> #include <QOpenGLVertexArrayObject>
#include <QMatrix4x4> #include <QMatrix4x4>
#include <QGLWidget> #include <QOpenGLWidget>
#include "gui/scaleengine.h" #include "gui/scaleengine.h"
#include "gui/glshadersimple.h" #include "gui/glshadersimple.h"
#include "gui/glshadertextured.h" #include "gui/glshadertextured.h"
@ -43,7 +43,7 @@ class QOpenGLShaderProgram;
class MessageQueue; class MessageQueue;
class SpectrumVis; class SpectrumVis;
class SDRGUI_API GLSpectrum : public QGLWidget, public GLSpectrumInterface { class SDRGUI_API GLSpectrum : public QOpenGLWidget, public GLSpectrumInterface {
Q_OBJECT Q_OBJECT
public: public:

View File

@ -33,7 +33,7 @@
// Note: When this object is created, QWidget* is converted to bool // Note: When this object is created, QWidget* is converted to bool
TVScreen::TVScreen(bool color, QWidget* parent) : TVScreen::TVScreen(bool color, QWidget* parent) :
QGLWidget(parent), QOpenGLWidget(parent),
m_mutex(QMutex::Recursive), m_mutex(QMutex::Recursive),
m_glShaderArray(color) m_glShaderArray(color)
{ {
@ -156,7 +156,7 @@ void TVScreen::initializeGL()
&QOpenGLContext::aboutToBeDestroyed, &QOpenGLContext::aboutToBeDestroyed,
this, this,
&TVScreen::cleanup &TVScreen::cleanup
); // TODO: when migrating to QOpenGLWidget );
m_glContextInitialized = true; m_glContextInitialized = true;
} }

View File

@ -22,7 +22,7 @@
#ifndef INCLUDE_TVSCREEN_H #ifndef INCLUDE_TVSCREEN_H
#define INCLUDE_TVSCREEN_H #define INCLUDE_TVSCREEN_H
#include <QGLWidget> #include <QOpenGLWidget>
#include <QPen> #include <QPen>
#include <QTimer> #include <QTimer>
#include <QMutex> #include <QMutex>
@ -36,7 +36,7 @@
class QPainter; class QPainter;
class SDRGUI_API TVScreen: public QGLWidget class SDRGUI_API TVScreen: public QOpenGLWidget
{ {
Q_OBJECT Q_OBJECT

View File

@ -64,8 +64,8 @@ static const char* fragmentShaderSource =
" gl_FragColor = vec4(p);\n" " gl_FragColor = vec4(p);\n"
"}\n"; "}\n";
TVScreenAnalog::TVScreenAnalog(QWidget *parent) TVScreenAnalog::TVScreenAnalog(QWidget *parent) :
: QGLWidget(parent), QOpenGLWidget(parent),
m_shader(nullptr), m_shader(nullptr),
m_imageTexture(nullptr), m_imageTexture(nullptr),
m_lineShiftsTexture(nullptr) m_lineShiftsTexture(nullptr)
@ -134,8 +134,12 @@ void TVScreenAnalog::initializeGL()
{ {
initializeOpenGLFunctions(); initializeOpenGLFunctions();
connect(QOpenGLContext::currentContext(), &QOpenGLContext::aboutToBeDestroyed, connect(
this, &TVScreenAnalog::cleanup); // TODO: when migrating to QOpenGLWidget QOpenGLContext::currentContext(),
&QOpenGLContext::aboutToBeDestroyed,
this,
&TVScreenAnalog::cleanup
);
m_shader = new QOpenGLShaderProgram(this); m_shader = new QOpenGLShaderProgram(this);

View File

@ -27,7 +27,7 @@
#include <QMutex> #include <QMutex>
#include <QTimer> #include <QTimer>
#include <QGLWidget> #include <QOpenGLWidget>
#include <QOpenGLTexture> #include <QOpenGLTexture>
#include <QOpenGLFunctions> #include <QOpenGLFunctions>
#include <QOpenGLShaderProgram> #include <QOpenGLShaderProgram>
@ -108,7 +108,7 @@ private:
int* m_outOfBoundsLine; int* m_outOfBoundsLine;
}; };
class SDRGUI_API TVScreenAnalog : public QGLWidget, protected QOpenGLFunctions class SDRGUI_API TVScreenAnalog : public QOpenGLWidget, protected QOpenGLFunctions
{ {
Q_OBJECT Q_OBJECT