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
135 SF_DECL_PROP_RGRS(QStringList, SceneServer)
136
137 protected:
141 void initializeGL() override;
142
146 void resizeGL(int width, int height) override;
147
151 void paintGL() override;
152
156 void resizeEvent(QResizeEvent* event) override;
157
161 void keyPressEvent(QKeyEvent* event) override;
162
166 void mousePressEvent(QMouseEvent* event) override;
167
171 void mouseReleaseEvent(QMouseEvent* event) override;
172
176 void mouseMoveEvent(QMouseEvent* event) override;
177
181 void wheelEvent(QWheelEvent* event) override;
182
186 void focusInEvent(QFocusEvent* event) override;
187
191 void focusOutEvent(QFocusEvent* event) override;
192
193 SF_DECL_PROP_GRS(QString, Camera)
194 SF_DECL_PROP_GRS(QString, Model)
195 SF_DECL_PROP_GRS(QString, LightPosition)
196 SF_DECL_PROP_GRS(QString, LightDirection)
197
198 private:
199 void notify(void*);
203 typedef QOpenGLWidget Inherited;
207 struct Private;
211 Private* _p{nullptr};
212
213 Q_DISABLE_COPY(OpenGLWidget)
214};
215
216}// 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