2017-07-19 14:20:32 -07:00
|
|
|
#pragma once
|
2013-08-09 04:57:18 +00:00
|
|
|
|
2020-12-27 13:05:55 -08:00
|
|
|
#ifdef LC_USE_QOPENGLWIDGET
|
|
|
|
typedef QOpenGLWidget lcViewWidgetParent;
|
|
|
|
#else
|
|
|
|
typedef QGLWidget lcViewWidgetParent;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
class lcViewWidget : public lcViewWidgetParent
|
2013-08-09 04:57:18 +00:00
|
|
|
{
|
2020-12-26 18:15:35 -08:00
|
|
|
Q_OBJECT
|
|
|
|
|
2013-08-09 04:57:18 +00:00
|
|
|
public:
|
2020-12-25 10:54:33 -08:00
|
|
|
lcViewWidget(QWidget* Parent, lcView* View);
|
2020-12-17 17:59:11 -08:00
|
|
|
~lcViewWidget();
|
2013-08-09 04:57:18 +00:00
|
|
|
|
2020-12-25 10:54:33 -08:00
|
|
|
lcView* GetView() const
|
2020-12-13 12:05:54 -08:00
|
|
|
{
|
|
|
|
return mView;
|
|
|
|
}
|
2013-08-09 04:57:18 +00:00
|
|
|
|
2020-12-25 10:54:33 -08:00
|
|
|
void SetView(lcView* View);
|
2020-12-13 12:05:54 -08:00
|
|
|
|
|
|
|
QSize sizeHint() const override;
|
2013-08-09 04:57:18 +00:00
|
|
|
|
2020-12-13 12:05:54 -08:00
|
|
|
protected:
|
2020-12-05 08:45:29 -08:00
|
|
|
float GetDeviceScale() const
|
2014-04-08 01:04:32 +00:00
|
|
|
{
|
2020-12-27 13:05:55 -08:00
|
|
|
#ifdef LC_USE_QOPENGLWIDGET
|
|
|
|
return devicePixelRatio();
|
|
|
|
#elif (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
2014-04-08 01:04:32 +00:00
|
|
|
return windowHandle()->devicePixelRatio();
|
|
|
|
#else
|
|
|
|
return 1.0f;
|
|
|
|
#endif
|
2020-12-17 17:59:11 -08:00
|
|
|
}
|
2014-04-08 01:04:32 +00:00
|
|
|
|
2020-12-27 13:05:55 -08:00
|
|
|
void initializeGL() override;
|
2020-03-22 15:44:41 -07:00
|
|
|
void resizeGL(int Width, int Height) override;
|
|
|
|
void paintGL() override;
|
2020-12-11 18:01:04 -08:00
|
|
|
void focusInEvent(QFocusEvent* FocusEvent) override;
|
|
|
|
void focusOutEvent(QFocusEvent* FocusEvent) override;
|
2020-03-22 15:44:41 -07:00
|
|
|
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 22:34:04 +00:00
|
|
|
|
2020-12-25 10:54:33 -08:00
|
|
|
lcView* mView;
|
2020-11-14 12:47:55 -08:00
|
|
|
QSize mPreferredSize;
|
2015-02-10 22:34:04 +00:00
|
|
|
int mWheelAccumulator;
|
2013-08-09 04:57:18 +00:00
|
|
|
};
|