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
128 SF_DECL_PROP_RGRS(QStringList, SceneServer)
129
130 protected:
134 void initializeGL() override;
135
139 void resizeGL(int width, int height) override;
140
144 void paintGL() override;
145
149 void resizeEvent(QResizeEvent* event) override;
150
154 void keyPressEvent(QKeyEvent* event) override;
155
159 void mousePressEvent(QMouseEvent* event) override;
160
164 void mouseReleaseEvent(QMouseEvent* event) override;
165
169 void mouseMoveEvent(QMouseEvent* event) override;
170
174 void wheelEvent(QWheelEvent* event) override;
175
179 void focusInEvent(QFocusEvent* event) override;
180
184 void focusOutEvent(QFocusEvent* event) override;
185
186 SF_DECL_PROP_GRS(QString, Camera)
187 SF_DECL_PROP_GRS(QString, Model)
188 SF_DECL_PROP_GRS(QString, LightPosition)
189 SF_DECL_PROP_GRS(QString, LightDirection)
190
191 private:
192 void notify(void*);
196 typedef QOpenGLWidget Inherited;
200 struct Private;
204 Private* _p{nullptr};
205
206 Q_DISABLE_COPY(OpenGLWidget)
207};
208
209}// 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:12
Widget for rendering a OpenGHL scene.
Definition OpenGLWidget.h:30
Dialog containing multiple property pages.
Definition qt/PropertySheetDialog.h:14
#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