2017-07-19 23:20:32 +02:00
|
|
|
#pragma once
|
2013-08-09 06:57:18 +02:00
|
|
|
|
|
|
|
#include <QGLWidget>
|
|
|
|
class lcGLWidget;
|
|
|
|
|
|
|
|
class lcQGLWidget : public QGLWidget
|
|
|
|
{
|
|
|
|
public:
|
2020-10-03 12:02:27 +02:00
|
|
|
lcQGLWidget(QWidget* Parent, lcGLWidget* Owner, bool IsView, bool IsPreview = false);
|
2013-08-09 06:57:18 +02:00
|
|
|
~lcQGLWidget();
|
|
|
|
|
2020-03-22 23:44:41 +01:00
|
|
|
QSize sizeHint() const override;
|
2013-08-09 06:57:18 +02:00
|
|
|
|
|
|
|
lcGLWidget *widget;
|
|
|
|
QSize preferredSize;
|
2018-01-12 19:50:25 +01:00
|
|
|
bool mIsView;
|
2020-10-03 12:02:27 +02:00
|
|
|
bool mIsPreview;
|
2013-08-09 06:57:18 +02:00
|
|
|
|
2014-04-08 03:04:32 +02:00
|
|
|
float deviceScale()
|
|
|
|
{
|
|
|
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
|
|
|
return windowHandle()->devicePixelRatio();
|
|
|
|
#else
|
|
|
|
return 1.0f;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2020-10-07 12:07:32 +02:00
|
|
|
void SetPreviewPosition(const QRect& ParentRect);
|
|
|
|
|
2014-09-15 00:41:22 +02:00
|
|
|
QTimer mUpdateTimer;
|
|
|
|
|
2013-08-09 06:57:18 +02:00
|
|
|
protected:
|
2020-03-22 23:44:41 +01:00
|
|
|
void initializeGL() override;
|
|
|
|
void resizeGL(int Width, int Height) override;
|
|
|
|
void paintGL() override;
|
|
|
|
void keyPressEvent(QKeyEvent* KeyEvent) override;
|
|
|
|
void keyReleaseEvent(QKeyEvent* KeyEvent) override;
|
|
|
|
void mousePressEvent(QMouseEvent* MouseEvent) override;
|
|
|
|
void mouseReleaseEvent(QMouseEvent* MouseEvent) override;
|
|
|
|
void mouseDoubleClickEvent(QMouseEvent* MouseEvent) override;
|
|
|
|
void mouseMoveEvent(QMouseEvent* MouseEvent) override;
|
|
|
|
void wheelEvent(QWheelEvent* WheelEvent) override;
|
|
|
|
void dragEnterEvent(QDragEnterEvent* DragEnterEvent) override;
|
|
|
|
void dragLeaveEvent(QDragLeaveEvent* DragLeaveEvent) override;
|
|
|
|
void dragMoveEvent(QDragMoveEvent* DragMoveEvent) override;
|
|
|
|
void dropEvent(QDropEvent* DropEvent) override;
|
2015-02-10 23:34:04 +01:00
|
|
|
|
|
|
|
int mWheelAccumulator;
|
2013-08-09 06:57:18 +02:00
|
|
|
};
|
|
|
|
|