Refactor to deprecate existing QGLWidget derived widget

Renamed cvfqt::OpenGLWidget to cvfqt::GLWidget_deprecated
Renamed cvfqt::CvfBoundQGLContext to cvfqt::CvfBoundQGLContext_deprecated
Renamed cvfqt::OpenGLContext to cvfqt::OpenGLContext_QGLContextAdapter_deprecated
Added cvf::OpenGLUtils
This commit is contained in:
Sigurd Pettersen
2024-01-09 22:06:20 +01:00
parent ce9a65ee41
commit 5d625223c1
18 changed files with 265 additions and 247 deletions

View File

@@ -42,8 +42,6 @@
#include "QMWidget.h"
#include "cvfqtOpenGLContext.h"
#include <QMouseEvent>
using cvf::ref;
@@ -54,7 +52,7 @@ using cvf::ref;
///
//--------------------------------------------------------------------------------------------------
QMWidget::QMWidget(cvf::OpenGLContextGroup* contextGroup, QWidget* parent)
: cvfqt::OpenGLWidget(contextGroup, QGLFormat(), parent)
: cvfqt::GLWidget_deprecated(contextGroup, QGLFormat(), parent)
{
m_camera = new cvf::Camera;
@@ -130,14 +128,14 @@ void QMWidget::paintEvent(QPaintEvent* /*event*/)
painter.beginNativePainting();
cvfqt::OpenGLContext::saveOpenGLState(currentOglContext);
cvf::OpenGLUtils::pushOpenGLState(currentOglContext);
if (m_renderSequence.notNull())
{
m_renderSequence->render(currentOglContext);
}
cvfqt::OpenGLContext::restoreOpenGLState(currentOglContext);
cvf::OpenGLUtils::popOpenGLState(currentOglContext);
painter.endNativePainting();
}

View File

@@ -44,7 +44,7 @@
#include "cvfScene.h"
#include "cvfOpenGLContextGroup.h"
#include "cvfqtOpenGLWidget.h"
#include "cvfqtGLWidget_deprecated.h"
@@ -53,7 +53,7 @@
//
//
//==================================================================================================
class QMWidget : public cvfqt::OpenGLWidget
class QMWidget : public cvfqt::GLWidget_deprecated
{
Q_OBJECT

View File

@@ -42,8 +42,6 @@
#include "QMVWidget.h"
#include "cvfqtOpenGLContext.h"
#include <QMouseEvent>
using cvf::ref;
@@ -54,7 +52,7 @@ using cvf::ref;
///
//--------------------------------------------------------------------------------------------------
QMVWidget::QMVWidget(cvf::OpenGLContextGroup* contextGroup, const QGLFormat& format, QWidget* parent)
: cvfqt::OpenGLWidget(contextGroup, format, parent)
: cvfqt::GLWidget_deprecated(contextGroup, format, parent)
{
m_trackball = new cvf::ManipulatorTrackball;
}
@@ -64,7 +62,7 @@ QMVWidget::QMVWidget(cvf::OpenGLContextGroup* contextGroup, const QGLFormat& for
///
//--------------------------------------------------------------------------------------------------
QMVWidget::QMVWidget(QMVWidget* shareWidget, QWidget* parent)
: cvfqt::OpenGLWidget(shareWidget, parent)
: cvfqt::GLWidget_deprecated(shareWidget, parent)
{
m_trackball = new cvf::ManipulatorTrackball;
}
@@ -141,7 +139,7 @@ void QMVWidget::paintGL()
CVF_ASSERT(currentOglContext);
CVF_CHECK_OGL(currentOglContext);
cvfqt::OpenGLContext::saveOpenGLState(currentOglContext);
cvf::OpenGLUtils::pushOpenGLState(currentOglContext);
if (m_renderSequence.notNull())
{
@@ -153,7 +151,7 @@ void QMVWidget::paintGL()
glClear(GL_COLOR_BUFFER_BIT);
}
cvfqt::OpenGLContext::restoreOpenGLState(currentOglContext);
cvf::OpenGLUtils::popOpenGLState(currentOglContext);
}

View File

@@ -40,7 +40,7 @@
#include "cvfBase.h"
#include "cvfRenderSequence.h"
#include "cvfManipulatorTrackball.h"
#include "cvfqtOpenGLWidget.h"
#include "cvfqtGLWidget_deprecated.h"
//==================================================================================================
@@ -48,7 +48,7 @@
//
//
//==================================================================================================
class QMVWidget : public cvfqt::OpenGLWidget
class QMVWidget : public cvfqt::GLWidget_deprecated
{
Q_OBJECT

View File

@@ -40,7 +40,6 @@
#include "QSRTranslateEvent.h"
#include "cvfqtPerformanceInfoHud.h"
#include "cvfqtOpenGLContext.h"
#include <math.h>
@@ -54,7 +53,7 @@ using cvfu::TestSnippet;
///
//--------------------------------------------------------------------------------------------------
QSRSnippetWidget::QSRSnippetWidget(TestSnippet* snippet, cvf::OpenGLContextGroup* contextGroup, const QGLFormat& format, QWidget* parent)
: cvfqt::OpenGLWidget(contextGroup, format, parent),
: cvfqt::GLWidget_deprecated(contextGroup, format, parent),
m_drawHUD(false),
m_lastSetRenderMode(DrawableGeo::VERTEX_ARRAY),
m_enableMultisampleWhenDrawing(false)
@@ -595,7 +594,7 @@ void QSRSnippetWidget::paintEvent(QPaintEvent* /*event*/)
painter.beginNativePainting();
CVF_CHECK_OGL(currentOglContext);
cvfqt::OpenGLContext::saveOpenGLState(currentOglContext);
cvf::OpenGLUtils::pushOpenGLState(currentOglContext);
CVF_CHECK_OGL(currentOglContext);
if (m_enableMultisampleWhenDrawing)
@@ -612,7 +611,7 @@ void QSRSnippetWidget::paintEvent(QPaintEvent* /*event*/)
glDisable(GL_MULTISAMPLE);
}
cvfqt::OpenGLContext::restoreOpenGLState(currentOglContext);
cvf::OpenGLUtils::popOpenGLState(currentOglContext);
CVF_CHECK_OGL(currentOglContext);
if (postEventAction == cvfu::REDRAW)

View File

@@ -45,7 +45,7 @@
#include "cvfuTestSnippet.h"
#include "cvfqtOpenGLWidget.h"
#include "cvfqtGLWidget_deprecated.h"
class QTimer;
@@ -55,7 +55,7 @@ class QTimer;
//
//
//==================================================================================================
class QSRSnippetWidget : public cvfqt::OpenGLWidget
class QSRSnippetWidget : public cvfqt::GLWidget_deprecated
{
Q_OBJECT