Editor API
UnigineEditor public API
Editor::RenderWindow Class Reference

This class is used to represent a window widget to which an image can be rendered by the Engine. For example, to render node or texture previews, frame sequences, etc. More...

#include <RenderWindow.h>

Inheritance diagram for Editor::RenderWindow:
Editor::EngineGuiWindow

Public Types

enum  RENDERING_POLICY { RENDERING_POLICY_WINDOW_VISIBLE = 0, RENDERING_POLICY_WINDOW_VISIBLE_AND_FOCUSED, RENDERING_POLICY_ALWAYS }
 Rendering policy for the window that defines when it should be rendered depending on its visibility and focus status. More...
 
using CallbackId = Callback *
 

Signals

void focusChanged ()
 This signal is emitted when the focus has changed because the user pressed the tab-key, clicked into a widget or changed the active window. More...
 

Public Member Functions

 RenderWindow (QWidget *parent=nullptr)
 
 ~RenderWindow () override
 
CallbackId addUpdateCallback (Unigine::CallbackBase *update_func)
 Adds a callback to be fired for the Render Window on Engine::update(). As an alternative you can inherit your class from the RenderWindow and override the onUpdate() method. More...
 
CallbackId addRenderCallback (Unigine::CallbackBase *render_func)
 Adds a callback to be fired for the Render Window on Engine::render(). As an alternative you can inherit your class from the RenderWindow and override the onRender() method. More...
 
CallbackId addSwapCallback (Unigine::CallbackBase *swap_func)
 Adds a callback to be fired for the Render Window on Engine::swap(). As an alternative you can inherit your class from the RenderWindow and override the onSwap() method. More...
 
CallbackId addFocusChangedCallback (Unigine::CallbackBase *focus_changed_func)
 Adds a callback to be fired when the focus of the Render Window changes. More...
 
CallbackId addFocusInChangedCallback (Unigine::CallbackBase *focus_in_func)
 Adds a callback to be fired when the focus of the Render Window becomes focused. As an alternative you can inherit your class from the RenderWindow and override the focusInEvent() method. More...
 
CallbackId addFocusOutChangedCallback (Unigine::CallbackBase *focus_out_func)
 Adds a callback to be fired when the Render Window loses focus. As an alternative you can inherit your class from the RenderWindow and override the focusOutEvent() method. More...
 
CallbackId addDragEnterCallback (Unigine::CallbackBase1< QDragEnterEvent * > *drag_enter_func)
 Adds a callback to be fired when something is dragged into the Render Window. The callback function receives a QDragEnterEvent instance. For more details please refer to Qt documentation. As an alternative you can inherit your class from the RenderWindow and override the dragEnterEvent() method. More...
 
CallbackId addDragMoveCallback (Unigine::CallbackBase1< QDragMoveEvent * > *drag_move_func)
 Adds a callback to be fired when something is dragged within the Render Window. The callback function receives a QDragMoveEvent instance. For more details please refer to Qt documentation. As an alternative you can inherit your class from the RenderWindow and override the dragMoveEvent() method. More...
 
CallbackId addDragLeaveCallback (Unigine::CallbackBase1< QDragLeaveEvent * > *drag_leave_func)
 Adds a callback to be fired when something is dragged out of the Render Window. The callback function receives a QDragLeaveEvent instance. For more details please refer to Qt documentation. As an alternative you can inherit your class from the RenderWindow and override the dragLeaveEvent() method. More...
 
CallbackId addDropCallback (Unigine::CallbackBase1< QDropEvent * > *drop_func)
 Adds a callback to be fired when the user drops something within the Render Window. The callback function receives a QDropEvent instance, that contains a proposed action, available from proposedAction(), for the widget to either accept or ignore. If the action can be handled by the widget, you should call the acceptProposedAction() function. Since the proposed action can be a combination of Qt::DropAction values, it may be useful to either select one of these values as a default action or ask the user to select their preferred action. If the proposed drop action is not suitable, perhaps because your custom widget does not support that action, you can replace it with any of the possible drop actions by calling setDropAction() with your preferred action. If you set a value that is not present in the bitwise OR combination of values returned by possibleActions(), the default copy action will be used. Once a replacement drop action has been set, call accept() instead of acceptProposedAction() to complete the drop operation. For more details please refer to Qt documentation. As an alternative you can inherit your class from the RenderWindow and override the dropEvent() method. More...
 
bool removeCallback (CallbackId callback_id)
 Removes a callback with the specified ID. More...
 
void clearCallbacks ()
 Removes all callbacks. More...
 
void setRenderingPolicy (RENDERING_POLICY rendering_policy)
 Sets rendering policy for the Render Window. This policy defines when the window should be rendered depending on its visibility and focus status. More...
 
RENDERING_POLICY getRenderingPolicy () const
 Returns the current rendering policy for the Render Window. This policy defines when the window should be rendered depending on its visibility and focus status (See RENDERING_POLICY). More...
 
QPaintEngine * paintEngine () const final override
 

Protected Member Functions

virtual void onUpdate ()
 You can inherit your class from RenderWindow and override this method to define your custom actions to be performed on Engine::update(). As an alternative to overriding this method you can use the Update callback (addUpdateCallback). More...
 
virtual void onRender ()
 You can inherit your class from RenderWindow and override this method to define your custom actions to be performed on Engine::render(). As an alternative to overriding this method you can use the Render callback (addRenderCallback). More...
 
virtual void onSwap ()
 You can inherit your class from RenderWindow and override this method to define your custom actions to be performed on Engine::swap(). As an alternative to overriding this method you can use the Swap callback (addSwapCallback). More...
 
bool event (QEvent *event) override
 You can inherit your class from RenderWindow and override this method to define your custom actions to be performed on receiving various events (QEvent). As an alternative to overriding this method you can use the Update callback (addUpdateCallback). More...
 
void paintEvent (QPaintEvent *) final override
 
void resizeEvent (QResizeEvent *event) override
 You can inherit your class from RenderWindow and override this method to define actions to be performed on receiving a resize event (QResizeEvent). Resize events are sent to widgets that have been resized. For more details please refer to Qt documentation. As an alternative to overriding this method you can use the Update callback (addUpdateCallback). More...
 
void focusInEvent (QFocusEvent *event) override
 You can inherit your class from RenderWindow and override this method to define actions to be performed on getting focus, i.e., receiving the corresponding focus event (QFocusEvent). Focus events are sent to widgets when the keyboard input focus changes. Focus events occur due to mouse actions, key presses (such as Tab or Backtab), the window system, popup menus, keyboard shortcuts, or other application-specific reasons. The reason for a particular focus event is returned by reason() in the appropriate event handler. For more details please refer to Qt documentation. As an alternative to overriding this method you can use the FocusIn callback (addFocusInChangedCallback). More...
 
void focusOutEvent (QFocusEvent *event) override
 You can inherit your class from RenderWindow and override this method to define actions to be performed on losing focus, i.e., receiving the corresponding focus event (QFocusEvent). Focus events are sent to widgets when the keyboard input focus changes. Focus events occur due to mouse actions, key presses (such as Tab or Backtab), the window system, popup menus, keyboard shortcuts, or other application-specific reasons. The reason for a particular focus event is returned by reason() in the appropriate event handler. For more details please refer to Qt documentation. As an alternative to overriding this method you can use the FocusOut callback (addFocusOutChangedCallback). More...
 
void dragEnterEvent (QDragEnterEvent *event) override
 You can inherit your class from RenderWindow and override this method to define actions to be performed when a drag-and-drop action enters the Render Window (QDragEnterEvent). The drag enter event is always immediately followed by a drag move event. For more details please refer to Qt documentation. As an alternative to overriding this method you can use the addDragEnterCallback callback. More...
 
void dragMoveEvent (QDragMoveEvent *event) override
 You can inherit your class from RenderWindow and override this method to define actions to be performed when a drag-and-drop action is in progress (QDragMoveEvent). The drag move event always immediately follows a drag enter event. For more details please refer to Qt documentation. As an alternative to overriding this method you can use the addDragMoveCallback callback. More...
 
void dragLeaveEvent (QDragLeaveEvent *event) override
 You can inherit your class from RenderWindow and override this method to define actions to be performed when a drag-and-drop action leaves the Render Window (QDragLeaveEvent). For more details please refer to Qt documentation. As an alternative to overriding this method you can use the addDragLeaveCallback callback. More...
 
void dropEvent (QDropEvent *event) override
 You can inherit your class from RenderWindow and override this method to define actions to be performed when a drag-and-drop action is completed (QDropEvent). For more details please refer to Qt documentation. As an alternative to overriding this method you can use the addDropCallback callback. More...
 

Friends

class RenderWindowPrivate
 

Detailed Description

This class is used to represent a window widget to which an image can be rendered by the Engine. For example, to render node or texture previews, frame sequences, etc.

Member Typedef Documentation

◆ CallbackId

Member Enumeration Documentation

◆ RENDERING_POLICY

Rendering policy for the window that defines when it should be rendered depending on its visibility and focus status.

Enumerator
RENDERING_POLICY_WINDOW_VISIBLE 

The window is rendered only when visible.

RENDERING_POLICY_WINDOW_VISIBLE_AND_FOCUSED 

The window is rendered only when it is visible and focused.

RENDERING_POLICY_ALWAYS 

The window is always rendered regardless of its visibility and focus status.

Constructor & Destructor Documentation

◆ RenderWindow()

Editor::RenderWindow::RenderWindow ( QWidget *  parent = nullptr)
explicit

◆ ~RenderWindow()

Editor::RenderWindow::~RenderWindow ( )
override

Member Function Documentation

◆ addDragEnterCallback()

CallbackId Editor::RenderWindow::addDragEnterCallback ( Unigine::CallbackBase1< QDragEnterEvent * > *  drag_enter_func)

Adds a callback to be fired when something is dragged into the Render Window. The callback function receives a QDragEnterEvent instance. For more details please refer to Qt documentation. As an alternative you can inherit your class from the RenderWindow and override the dragEnterEvent() method.

Parameters
drag_enter_funcCallback function.

◆ addDragLeaveCallback()

CallbackId Editor::RenderWindow::addDragLeaveCallback ( Unigine::CallbackBase1< QDragLeaveEvent * > *  drag_leave_func)

Adds a callback to be fired when something is dragged out of the Render Window. The callback function receives a QDragLeaveEvent instance. For more details please refer to Qt documentation. As an alternative you can inherit your class from the RenderWindow and override the dragLeaveEvent() method.

Parameters
drag_leave_funcCallback function.

◆ addDragMoveCallback()

CallbackId Editor::RenderWindow::addDragMoveCallback ( Unigine::CallbackBase1< QDragMoveEvent * > *  drag_move_func)

Adds a callback to be fired when something is dragged within the Render Window. The callback function receives a QDragMoveEvent instance. For more details please refer to Qt documentation. As an alternative you can inherit your class from the RenderWindow and override the dragMoveEvent() method.

Parameters
drag_move_funcCallback function.

◆ addDropCallback()

CallbackId Editor::RenderWindow::addDropCallback ( Unigine::CallbackBase1< QDropEvent * > *  drop_func)

Adds a callback to be fired when the user drops something within the Render Window. The callback function receives a QDropEvent instance, that contains a proposed action, available from proposedAction(), for the widget to either accept or ignore. If the action can be handled by the widget, you should call the acceptProposedAction() function. Since the proposed action can be a combination of Qt::DropAction values, it may be useful to either select one of these values as a default action or ask the user to select their preferred action. If the proposed drop action is not suitable, perhaps because your custom widget does not support that action, you can replace it with any of the possible drop actions by calling setDropAction() with your preferred action. If you set a value that is not present in the bitwise OR combination of values returned by possibleActions(), the default copy action will be used. Once a replacement drop action has been set, call accept() instead of acceptProposedAction() to complete the drop operation. For more details please refer to Qt documentation. As an alternative you can inherit your class from the RenderWindow and override the dropEvent() method.

Parameters
drop_funcCallback function.

◆ addFocusChangedCallback()

CallbackId Editor::RenderWindow::addFocusChangedCallback ( Unigine::CallbackBase *  focus_changed_func)

Adds a callback to be fired when the focus of the Render Window changes.

Parameters
focus_changed_funcCallback function.

◆ addFocusInChangedCallback()

CallbackId Editor::RenderWindow::addFocusInChangedCallback ( Unigine::CallbackBase *  focus_in_func)

Adds a callback to be fired when the focus of the Render Window becomes focused. As an alternative you can inherit your class from the RenderWindow and override the focusInEvent() method.

Parameters
focus_in_funcCallback function.

◆ addFocusOutChangedCallback()

CallbackId Editor::RenderWindow::addFocusOutChangedCallback ( Unigine::CallbackBase *  focus_out_func)

Adds a callback to be fired when the Render Window loses focus. As an alternative you can inherit your class from the RenderWindow and override the focusOutEvent() method.

Parameters
focus_out_funcCallback function.

◆ addRenderCallback()

CallbackId Editor::RenderWindow::addRenderCallback ( Unigine::CallbackBase *  render_func)

Adds a callback to be fired for the Render Window on Engine::render(). As an alternative you can inherit your class from the RenderWindow and override the onRender() method.

Parameters
render_funcCallback function.

◆ addSwapCallback()

CallbackId Editor::RenderWindow::addSwapCallback ( Unigine::CallbackBase *  swap_func)

Adds a callback to be fired for the Render Window on Engine::swap(). As an alternative you can inherit your class from the RenderWindow and override the onSwap() method.

Parameters
swap_funcCallback function.

◆ addUpdateCallback()

CallbackId Editor::RenderWindow::addUpdateCallback ( Unigine::CallbackBase *  update_func)

Adds a callback to be fired for the Render Window on Engine::update(). As an alternative you can inherit your class from the RenderWindow and override the onUpdate() method.

Parameters
update_funcCallback function.

◆ clearCallbacks()

void Editor::RenderWindow::clearCallbacks ( )

Removes all callbacks.

◆ dragEnterEvent()

void Editor::RenderWindow::dragEnterEvent ( QDragEnterEvent *  event)
overrideprotected

You can inherit your class from RenderWindow and override this method to define actions to be performed when a drag-and-drop action enters the Render Window (QDragEnterEvent). The drag enter event is always immediately followed by a drag move event. For more details please refer to Qt documentation. As an alternative to overriding this method you can use the addDragEnterCallback callback.

◆ dragLeaveEvent()

void Editor::RenderWindow::dragLeaveEvent ( QDragLeaveEvent *  event)
overrideprotected

You can inherit your class from RenderWindow and override this method to define actions to be performed when a drag-and-drop action leaves the Render Window (QDragLeaveEvent). For more details please refer to Qt documentation. As an alternative to overriding this method you can use the addDragLeaveCallback callback.

◆ dragMoveEvent()

void Editor::RenderWindow::dragMoveEvent ( QDragMoveEvent *  event)
overrideprotected

You can inherit your class from RenderWindow and override this method to define actions to be performed when a drag-and-drop action is in progress (QDragMoveEvent). The drag move event always immediately follows a drag enter event. For more details please refer to Qt documentation. As an alternative to overriding this method you can use the addDragMoveCallback callback.

◆ dropEvent()

void Editor::RenderWindow::dropEvent ( QDropEvent *  event)
overrideprotected

You can inherit your class from RenderWindow and override this method to define actions to be performed when a drag-and-drop action is completed (QDropEvent). For more details please refer to Qt documentation. As an alternative to overriding this method you can use the addDropCallback callback.

◆ event()

bool Editor::RenderWindow::event ( QEvent *  event)
overrideprotected

You can inherit your class from RenderWindow and override this method to define your custom actions to be performed on receiving various events (QEvent). As an alternative to overriding this method you can use the Update callback (addUpdateCallback).

◆ focusChanged

void Editor::RenderWindow::focusChanged ( )
signal

This signal is emitted when the focus has changed because the user pressed the tab-key, clicked into a widget or changed the active window.

◆ focusInEvent()

void Editor::RenderWindow::focusInEvent ( QFocusEvent *  event)
overrideprotected

You can inherit your class from RenderWindow and override this method to define actions to be performed on getting focus, i.e., receiving the corresponding focus event (QFocusEvent). Focus events are sent to widgets when the keyboard input focus changes. Focus events occur due to mouse actions, key presses (such as Tab or Backtab), the window system, popup menus, keyboard shortcuts, or other application-specific reasons. The reason for a particular focus event is returned by reason() in the appropriate event handler. For more details please refer to Qt documentation. As an alternative to overriding this method you can use the FocusIn callback (addFocusInChangedCallback).

◆ focusOutEvent()

void Editor::RenderWindow::focusOutEvent ( QFocusEvent *  event)
overrideprotected

You can inherit your class from RenderWindow and override this method to define actions to be performed on losing focus, i.e., receiving the corresponding focus event (QFocusEvent). Focus events are sent to widgets when the keyboard input focus changes. Focus events occur due to mouse actions, key presses (such as Tab or Backtab), the window system, popup menus, keyboard shortcuts, or other application-specific reasons. The reason for a particular focus event is returned by reason() in the appropriate event handler. For more details please refer to Qt documentation. As an alternative to overriding this method you can use the FocusOut callback (addFocusOutChangedCallback).

◆ getRenderingPolicy()

RENDERING_POLICY Editor::RenderWindow::getRenderingPolicy ( ) const

Returns the current rendering policy for the Render Window. This policy defines when the window should be rendered depending on its visibility and focus status (See RENDERING_POLICY).

◆ onRender()

virtual void Editor::RenderWindow::onRender ( )
inlineprotectedvirtual

You can inherit your class from RenderWindow and override this method to define your custom actions to be performed on Engine::render(). As an alternative to overriding this method you can use the Render callback (addRenderCallback).

Reimplemented in Editor::EngineGuiWindow.

◆ onSwap()

virtual void Editor::RenderWindow::onSwap ( )
inlineprotectedvirtual

You can inherit your class from RenderWindow and override this method to define your custom actions to be performed on Engine::swap(). As an alternative to overriding this method you can use the Swap callback (addSwapCallback).

◆ onUpdate()

virtual void Editor::RenderWindow::onUpdate ( )
inlineprotectedvirtual

You can inherit your class from RenderWindow and override this method to define your custom actions to be performed on Engine::update(). As an alternative to overriding this method you can use the Update callback (addUpdateCallback).

Reimplemented in Editor::EngineGuiWindow.

◆ paintEngine()

QPaintEngine* Editor::RenderWindow::paintEngine ( ) const
inlinefinaloverride

◆ paintEvent()

void Editor::RenderWindow::paintEvent ( QPaintEvent *  )
inlinefinaloverrideprotected

◆ removeCallback()

bool Editor::RenderWindow::removeCallback ( CallbackId  callback_id)

Removes a callback with the specified ID.

Parameters
callback_idCallback function ID.
Returns
true if the callback with the specified ID is removed successfully; otherwise, false.

◆ resizeEvent()

void Editor::RenderWindow::resizeEvent ( QResizeEvent *  event)
overrideprotected

You can inherit your class from RenderWindow and override this method to define actions to be performed on receiving a resize event (QResizeEvent). Resize events are sent to widgets that have been resized. For more details please refer to Qt documentation. As an alternative to overriding this method you can use the Update callback (addUpdateCallback).

◆ setRenderingPolicy()

void Editor::RenderWindow::setRenderingPolicy ( RENDERING_POLICY  rendering_policy)

Sets rendering policy for the Render Window. This policy defines when the window should be rendered depending on its visibility and focus status.

Parameters
rendering_policyNew rendering policy to be set.

Friends And Related Function Documentation

◆ RenderWindowPrivate

friend class RenderWindowPrivate
friend