7 #include <Gui/RaGui.hpp>
9 #include <QScopedPointer>
12 #include <glbinding/ProcAddress.h>
31 class ScopedGLContext;
34 explicit WindowQt( QScreen* screen );
37 void resizeEvent( QResizeEvent* event )
override;
38 void showEvent( QShowEvent* event )
override;
39 void exposeEvent( QExposeEvent* event )
override;
42 virtual void enterEvent( QEvent* event );
43 virtual void leaveEvent( QEvent* event );
82 inline ScopedGLContext activateScopedContext();
85 QOpenGLContext* context();
90 bool isOpenGlInitialized()
const {
return m_glInitialized.load(); }
102 void physicalDpiChanged( qreal dpi );
106 std::unique_ptr<QOpenGLContext> m_context;
108 bool m_updatePending;
109 std::atomic_bool m_glInitialized;
112 void resizeInternal( QResizeEvent* event );
119 virtual bool initializeGL();
121 virtual void deinitializeGL();
123 virtual void resizeGL( QResizeEvent* event );
129 static glbinding::ProcAddress getProcAddress(
const char* name );
134 using QWindow::create;
136 static WindowQt* s_getProcAddressHelper;
137 int m_contextActivationCount { 0 };
139 QMetaObject::Connection m_screenObserver;
142 class WindowQt::ScopedGLContext
145 explicit ScopedGLContext(
WindowQt* window ) : m_window( window ) { window->
makeCurrent(); }
146 ~ScopedGLContext() { m_window->doneCurrent(); }
147 ScopedGLContext(
const ScopedGLContext& ) =
delete;
148 ScopedGLContext& operator=( ScopedGLContext
const& ) =
delete;
155 return ScopedGLContext {
this };
Base class for OpenGL widgets, compatble with Qt and globjects/glbindings.
void dpiChanged()
Emitted when physical device changes. Useful for tracking devicePixelRatio() change.
ScopedGLContext activateScopedContext()