![]() |
ImFusion SDK 4.3
|
#include <ImFusion/GUI/QtDisplayWindow.h>
Specialization of a QWindow
that allows for rendering the contents of a Display directly into the window framebuffer.
More...
Specialization of a QWindow
that allows for rendering the contents of a Display directly into the window framebuffer.
Using a QWindow
as backend is the most flexible approach as it should support integration into either a QtWidgets-based application, into a QML-based application, or as a freestanding window. Other integrations such as the QtDisplayWidget may perform better depending on your use case.
QtDisplayWindow will always use main context of the ImFusion SDK for rendering. Due to limitations of the underlying QWindow
this main context must be of type GlContextQt. Thus, you must use that during SDK initialization, for instance:
Furthermore, this class requires a two-step initialization process: you must call init() once the main context has been initialized. If you are embedding this class into a QtWidgets-based application using QWidget::createWindowContainer()
you should do this before calling init() unless you use an old Qt version.
Public Member Functions | |
QtDisplayWindow (Display &display, QWindow *parent=nullptr) | |
Create a new QtDisplayWindow showing the given display. | |
void | init () |
Initialize the underlying window/display surface with the format of the main OpenGL context. | |
void | deinit () |
Deinitialize the surface, which will effectively disable any rendering. | |
void | render () |
bool | event (QEvent *event) override |
void | resizeEvent (QResizeEvent *event) override |
QPointF | mapToGlobal (const QPointF &pos) const final override |
Implementations shall forward to Qt's mapToGlobal() function of the wrapper class. | |
![]() | |
QtDisplayWrapperBase (Display &display) | |
Constructor will subscribe to the Display::signalUpdateRequested signal. | |
Display & | display () |
Returns the Display shown by this widget. | |
QPointF | mapFromOpenGL (const vec2 &point) const |
Converts point from ImFusion::GUI's bottom-left-origin coordinates to Qt's top-left-origin coordinates. | |
vec2 | mapToOpenGL (const QPointF &point) const |
Converts point from Qt's top-left-origin coordinates to ImFusion::GUI's bottom-left-origin coordinates. | |
![]() | |
SignalReceiver ()=default | |
Default constructor. | |
SignalReceiver (const SignalReceiver &other) | |
Copy constructor, does not copy any existing signal connections from other. | |
SignalReceiver & | operator= (SignalReceiver rhs) |
Assignment operator, disconnects all existing connections, does not copy any existing signal connections from rhs. | |
virtual | ~SignalReceiver () |
Virtual destructor disconnects from all connected signals. | |
Protected Member Functions | |
void | onDisplayUpdateRequested () final override |
Implementations shall make Qt rerender the display. | |
double | getDevicePixelRatio () const final override |
Return the device pixel ratio of the screen the display is shown on. | |
int | getHeight () const final override |
Return the height of the display wrapper in pixels. | |
void | setCursor (const QCursor &cursor) final override |
Implementations shall forward to Qt's setCursor() function of the wrapper class. | |
![]() | |
bool | handleInputEvent (QEvent *event) |
![]() | |
void | disconnectAll () |
Disconnects all existing connections. | |
Additional Inherited Members | |
![]() | |
Display * | m_display |
QtDisplayWindow | ( | Display & | display, |
QWindow * | parent = nullptr ) |
Create a new QtDisplayWindow showing the given display.
std::runtime_error | if the GL::ContextManager::mainContext() is not a GlContextQt (see class description). |
void init | ( | ) |
Initialize the underlying window/display surface with the format of the main OpenGL context.
QWidget::createWindowContainer()
.QWidget::createWindowContainer()
. void deinit | ( | ) |
Deinitialize the surface, which will effectively disable any rendering.
This function is called implicitly by the destructor.
|
finaloverridevirtual |
Implementations shall forward to Qt's mapToGlobal() function of the wrapper class.
Implements QtDisplayWrapperBase.
|
finaloverrideprotectedvirtual |
Implementations shall make Qt rerender the display.
Implements QtDisplayWrapperBase.
|
finaloverrideprotectedvirtual |
Return the device pixel ratio of the screen the display is shown on.
Implements QtDisplayWrapperBase.
|
finaloverrideprotectedvirtual |
Return the height of the display wrapper in pixels.
Implements QtDisplayWrapperBase.
|
finaloverrideprotectedvirtual |
Implementations shall forward to Qt's setCursor() function of the wrapper class.
Implements QtDisplayWrapperBase.