Scanframe Modular Application 0.1.0
Loading...
Searching...
No Matches
OpenGLWidget.h
Go to the documentation of this file.
1#pragma once
2#include <QOpenGLDebugLogger>
3#include <QOpenGLWidget>
4#include <QtUiPlugin/QDesignerCustomWidgetInterface>
5#include <QtUiPlugin/QDesignerExportWidget>
6#include <gii/qt//Namespace.h>
8#include <misc/qt/Macros.h>
12
13// Forward declaration.
14class QOpenGLShaderProgram;
15
16namespace sf
17{
18
22class OpenGLRenderer;
23
27class QDESIGNER_WIDGET_EXPORT OpenGLWidget final
28 : public QOpenGLWidget
29 , public ObjectExtension
30{
31
32 public:
33 Q_OBJECT
34 Q_PROPERTY(sf::SceneOptions sceneOptions READ getSceneOptions WRITE setSceneOptions)
35 Q_PROPERTY(QStringList sceneServer READ getSceneServer WRITE setSceneServer)
36 Q_PROPERTY(QColor clearColor READ getClearColor WRITE setClearColor)
37 Q_PROPERTY(QString camera READ getCamera WRITE setCamera)
38 Q_PROPERTY(QString model READ getModel WRITE setModel)
39 Q_PROPERTY(QString lightPositon READ getLightPosition WRITE setLightPosition)
40 Q_PROPERTY(QString lightDirection READ getLightDirection WRITE setLightDirection)
41
42 public:
46 explicit OpenGLWidget(QWidget* parent = nullptr);
47
51 ~OpenGLWidget() override;
52
56 SceneOptions getSceneOptions() const;
57
61 QSize minimumSizeHint() const override;
62
66 void setSceneOptions(SceneOptions flags);
67
71 void setRenderer(OpenGLRenderer* renderer);
72
78 const QMatrix4x4& getMatrix(OrbitMode mode) const;
79
85 QMatrix4x4& getMatrix(OrbitMode mode);
86
91 const QMatrix4x4& getProjectionMatrix() const;
92
98 const QColor& getClearColor() const;
99
104 void setClearColor(const QColor& color);
105
111 void storeSettings(QSettings& settings, bool read);
112
116 void addPropertyPages(PropertySheetDialog* sheet) override;
117
121 OpenGLRenderer* getRenderer();
122
126 bool isRequiredProperty(const QString& name) override;
127
132 Q_SIGNAL void rendererChanged();
133
134 SF_DECL_PROP_RGRS(QStringList, SceneServer)
135
136 protected:
140 void initializeGL() override;
141
145 void resizeGL(int width, int height) override;
146
150 void paintGL() override;
151
155 void resizeEvent(QResizeEvent* event) override;
156
160 void keyPressEvent(QKeyEvent* event) override;
161
165 void mousePressEvent(QMouseEvent* event) override;
166
170 void mouseReleaseEvent(QMouseEvent* event) override;
171
175 void mouseMoveEvent(QMouseEvent* event) override;
176
180 void wheelEvent(QWheelEvent* event) override;
181
185 void focusInEvent(QFocusEvent* event) override;
186
190 void focusOutEvent(QFocusEvent* event) override;
191
192 SF_DECL_PROP_GRS(QString, Camera)
193 SF_DECL_PROP_GRS(QString, Model)
194 SF_DECL_PROP_GRS(QString, LightPosition)
195 SF_DECL_PROP_GRS(QString, LightDirection)
196
197 private:
202 void notify(void*);
203
207 typedef QOpenGLWidget Inherited;
211 struct Private;
215 Private* _p{nullptr};
216
217 Q_DISABLE_COPY(OpenGLWidget)
218};
219
220}// namespace sf
Interface class to multiple inherit when the sf::FormWriter class needs to be restricted in writing o...
Definition ObjectExtension.h:17
Pure virtual class to implement rendering separated from the widget and makes the sf::OpenGLWidget th...
Definition OpenGLRenderer.h:13
Widget for rendering an OpenGL scene.
Definition OpenGLWidget.h:30
Dialog containing multiple property pages.
Definition qt/PropertySheetDialog.h:15
#define SF_DECL_PROP_RGRS(Type, Name)
Declares referenced getter and referenced setter for a property.
Definition misc/qt/Macros.h:26
#define SF_DECL_PROP_GRS(Type, Name)
Declares unreferenced getter and referenced setter for a property.
Definition misc/qt/Macros.h:17
Definition Application.h:10
OrbitMode
Modes for changing an OpenGL property of a scene. Use a full namespace type path when specifying a Q_...
Definition OpenGLTypes.h:32