leocad/common/lc_viewwidget.h

47 lines
1.3 KiB
C
Raw Normal View History

#pragma once
2013-08-09 06:57:18 +02:00
2021-01-08 20:25:24 +01:00
class lcViewWidget : public QOpenGLWidget
2013-08-09 06:57:18 +02:00
{
2020-12-27 03:15:35 +01:00
Q_OBJECT
2013-08-09 06:57:18 +02:00
public:
2020-12-25 19:54:33 +01:00
lcViewWidget(QWidget* Parent, lcView* View);
2021-02-28 22:11:54 +01:00
~lcViewWidget();
2013-08-09 06:57:18 +02:00
lcView* GetView() const;
2020-12-25 19:54:33 +01:00
void SetView(lcView* View);
2020-12-13 21:05:54 +01:00
QSize sizeHint() const override;
2013-08-09 06:57:18 +02:00
2020-12-13 21:05:54 +01:00
protected:
2020-12-05 17:45:29 +01:00
float GetDeviceScale() const
2014-04-08 03:04:32 +02:00
{
2021-01-08 20:25:24 +01:00
#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
return devicePixelRatioF();
2014-04-08 03:04:32 +02:00
#else
2021-01-08 20:25:24 +01:00
return devicePixelRatio();
2014-04-08 03:04:32 +02:00
#endif
2020-12-18 02:59:11 +01:00
}
2014-04-08 03:04:32 +02:00
2020-12-27 22:05:55 +01:00
void initializeGL() override;
void resizeGL(int Width, int Height) override;
void paintGL() override;
2020-12-12 03:01:04 +01:00
void focusInEvent(QFocusEvent* FocusEvent) override;
void focusOutEvent(QFocusEvent* FocusEvent) 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
2021-02-28 19:57:14 +01:00
std::unique_ptr<lcView> mView;
2020-11-14 21:47:55 +01:00
QSize mPreferredSize;
2021-02-28 19:57:14 +01:00
int mWheelAccumulator = 0;
2013-08-09 06:57:18 +02:00
};