Render surface that hosts InteractiveViews and will call their render method on repaints.
More...
Render surface that hosts InteractiveViews and will call their render method on repaints.
Additionally it distributes user events to the affected views. Until the release event, mouse move events are always sent to the view that received the press event, even if the mouse moves out of the view. The view layout has to be set manually every time a new view is added or the view won't be visible. The DisplayWidget has no dependency on the actual implementation of the InteractiveView and treats all views the same.
- Note
- A DisplayWidget does not hold its own OpenGL context for rendering but rather uses the GlContextManager's main context. Since DisplayWidget is Qt-based, this main context must be originate from Qt as well. This can be ensured by providing a GlQtContext on ApplicationController construction/Framework::init(). If you're using a MainWindowBase as ApplicationController, this is done automatically.
|
| void | setRecording (bool enable, bool reset=true, bool continuous=false) |
| | If enabled and the recording path is not empty, all paintEvent results will be written to disk.
|
| void | setRecordingOutputDir (const QString &path) |
| | Sets the path to the output file used in the recording.
|
|
bool | saveScreenshot (const QString &path) |
| | Saves the current screen content under the given path.
|
| void | layoutViews (bool noAnimation=false) |
| | Layout the views.
|
|
void | resetLayout () |
|
void | fatalError (QString errorMessage) |
|
void | update () |
|
void | setFpsLimit (int fps) |
| | Limits the maximum frequency of display updates.
|
|
void | removeFpsLimit () |
| | Remove the limit on the frequency of display updates.
|
|
double | currentFps () |
| | Returns the current frame rate (independent of any FPS limit).
|
| void | setContainerWidget (QWidget *widget) |
| | Sets the widget this QWindow is wrapped in (if any).
|
|
QWidget * | containerWidget () const |
| bool | event (QEvent *event) override |
| | Handles any display event and hands it to corresponding views.
|
|
void | resizeEvent (QResizeEvent *event) override |
|
QPoint | mapFromOpenGL (const QPoint &point) const |
| | Converts the point from top-left to bottom-left coordinates.
|
|
QPointF | mapFromOpenGL (const QPointF &point) const |
|
QPoint | mapToOpenGL (const QPoint &point) const |
| | Converts the point from bottom-left to top-left coordinates.
|
|
QPointF | mapToOpenGL (const QPointF &point) const |
|
| | DisplayWidget (bool initialize=true, QWindow *parent=nullptr) |
| | Creates a new empty DisplayWidget.
|
|
| ~DisplayWidget () override |
| | Deletes all views.
|
|
void | init () |
| | Initialize the OpenGL context of this DisplayWidget.
|
| void | deinit () |
| | Mark the display as deinitialized so that it will no longer perform any rendering.
|
|
void | setBackgroundColor (const QColor &color) |
|
QColor | backgroundColor () const |
| virtual bool | addView (InteractiveView *view) |
| | Add view and pass ownership. If the view is not removed before this object is deleted it will be deleted too.
|
| virtual bool | removeView (InteractiveView *view) |
| | Remove view. The user is responsible for deleting the view.
|
|
int | numViews () const |
| | Returns the number of views.
|
| int | numVisibleViews () const |
| | Returns the number of visible views if no view is on fullscreen.
|
|
InteractiveView * | viewAt (int i) |
| | Returns the view with the index i or NULL if the view doesn't exist.
|
|
const InteractiveView * | viewAt (int i) const |
|
std::vector< InteractiveView * > | views () const |
|
InteractiveView * | view (int which=0) |
| | Access an interactive view, returns nullptr if which is out of bounds.
|
| void | configure (const Properties *p) override |
| | Set one or multiple properties.
|
| void | configuration (Properties *p) const override |
| | Retrieve the properties of this object.
|
|
bool | makeCurrent () |
| | Makes the underlying OpenGL context current against the QSurface of the display in the current thread.
|
|
void | doneCurrent () |
| | Deactivates any current OpenGL context in the current thread.
|
|
GUI::DisplayLayout * | layout () |
| virtual void | render (bool swapBuffers=true) |
| | Clears the display and renders all views using the current OpenGL context.
|
| QRect | viewport () const |
| | Returns the rendering viewport.
|
| void | setCustomViewport (QRect viewport) |
| | Sets a custom rendering viewport.
|
| std::unique_ptr< TypedImage< unsigned char > > | captureScreenshot (int width=0, int height=0, bool withAlpha=true) |
| | Capture the current content of the display into an image.
|
|
GUI::DisplayBase & | displayBaseAdapter () |
| | Return a helper struct implementing the GUI::DisplayBase interface for this DisplayWidget instance.
|
| virtual void | configureDefaults () |
| | Retrieve the properties of this object, replaces values with their defaults and sets it again.
|
|
void | registerParameter (ParameterBase *param) |
| | Register the given Parameter or SubProperty, so that it will be configured during configure()/configuration().
|
|
void | unregisterParameter (const ParameterBase *param) |
| | Remove the given Parameter or SubProperty from the list of registered parameters.
|
|
| Configurable (const Configurable &rhs) |
|
| Configurable (Configurable &&rhs) noexcept |
|
Configurable & | operator= (const Configurable &) |
|
Configurable & | operator= (Configurable &&) noexcept |
| void ImFusion::DisplayWidget::setContainerWidget |
( |
QWidget * | widget | ) |
|
|
slot |
Sets the widget this QWindow is wrapped in (if any).
If this DisplayWidget is wrapped in a QWidget with QWidget::createWindowContainer, the resulting QWidget can be stored here for convenience. Since the geometry of the QWindow cannot be changed when inside a QWidget, this property is useful to change the geometry through the QWidget (e.g. resize or setGeometry). If you don't use QWidget::createWindowContainer, you can savely ignore this method.
| bool ImFusion::DisplayWidget::event |
( |
QEvent * | event | ) |
|
|
overrideslot |
Handles any display event and hands it to corresponding views.
QMouseEvents, QWheelEvents and QTouchEvents are only passed to the view that contains the event position (in the case of QTouchEvent, all positions). If a view accepted a MouseButtonPress or TouchBegin, it will receive all following events independent of the position until a corresponding MouseButtonRelease or TouchEnd/TouchCancel event (i.e. the view gets an lock on all events). This ensures that dragging events are only handled by one view and don't change target when leaving a view. Views also receive Enter and Leave events when the mouse enters and leaves the view area (but only if no view has the afore mentioned event lock). QMouseEvents and QWheelEvent position are automatically converted from Qt window coordinates (top-left origin) to OpenGL coordinates (bottom-left origin). Because of limitations in Qt, this is not the case for QTouchEvents, which will always be in Qt window coordinates and must be converted when used (see mapToOpenGL).