Switch to QOpenGLWidget.

This commit is contained in:
Leonardo Zide
2020-12-27 13:05:55 -08:00
parent 2ccdc85f00
commit 4e6cbca31c
14 changed files with 269 additions and 72 deletions
+13 -2
View File
@@ -1,6 +1,12 @@
#pragma once
class lcViewWidget : public QGLWidget
#ifdef LC_USE_QOPENGLWIDGET
typedef QOpenGLWidget lcViewWidgetParent;
#else
typedef QGLWidget lcViewWidgetParent;
#endif
class lcViewWidget : public lcViewWidgetParent
{
Q_OBJECT
@@ -21,13 +27,16 @@ public:
protected:
float GetDeviceScale() const
{
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
#ifdef LC_USE_QOPENGLWIDGET
return devicePixelRatio();
#elif (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
return windowHandle()->devicePixelRatio();
#else
return 1.0f;
#endif
}
void initializeGL() override;
void resizeGL(int Width, int Height) override;
void paintGL() override;
void focusInEvent(QFocusEvent* FocusEvent) override;
@@ -47,4 +56,6 @@ protected:
lcView* mView;
QSize mPreferredSize;
int mWheelAccumulator;
static bool mResourcesLoaded;
};