leocad/qt/lc_qglwidget.h
2016-12-28 13:30:31 -08:00

49 lines
1.1 KiB
C++

#ifndef _LC_QGLWIDGET_H_
#define _LC_QGLWIDGET_H_
#include <QGLWidget>
class lcGLWidget;
class lcQGLWidget : public QGLWidget
{
public:
lcQGLWidget(QWidget *parent, lcGLWidget *owner, bool view);
~lcQGLWidget();
QSize sizeHint() const;
lcGLWidget *widget;
QSize preferredSize;
bool isView;
float deviceScale()
{
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
return windowHandle()->devicePixelRatio();
#else
return 1.0f;
#endif
}
QTimer mUpdateTimer;
protected:
void initializeGL();
void resizeGL(int x, int h);
void paintGL();
void keyPressEvent(QKeyEvent *event);
void keyReleaseEvent(QKeyEvent *event);
void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
void mouseDoubleClickEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
void wheelEvent(QWheelEvent *event);
void dragEnterEvent(QDragEnterEvent *event);
void dragLeaveEvent(QDragLeaveEvent *event);
void dragMoveEvent(QDragMoveEvent *event);
void dropEvent(QDropEvent *event);
int mWheelAccumulator;
};
#endif // _LC_VIEWWIDGET_H_