OpenWalnut
1.5.0dev
|
A widget containing an open gl display area. More...
#include <WQtGLWidget.h>
Public Types | |
enum | CameraManipulators { TRACKBALL , TWO_D , NO_OP , ADVANCED } |
List of currently possible camera manipulators. More... | |
Public Slots | |
void | reset () |
Resets the contained view using the installed manipulator. More... | |
void | setPresetViewLeft () |
Sets the left preset view of the main viewer. More... | |
void | setPresetViewRight () |
Sets the right preset view of the main viewer. More... | |
void | setPresetViewSuperior () |
Sets the superior preset view of the main viewer. More... | |
void | setPresetViewInferior () |
Sets the inferior preset view of the main viewer. More... | |
void | setPresetViewAnterior () |
Sets the anterior preset view of the main viewer. More... | |
void | setPresetViewPosterior () |
Sets the posterior preset view of the main viewer. More... | |
void | setFitScreenPosition () |
Zooms and centers the view to fit the viewer. More... | |
Signals | |
void | renderedFirstFrame () |
Signals that the first frame was rendered. More... | |
Public Member Functions | |
WQtGLWidget (std::string nameOfViewer, QWidget *parent=0, WGECamera::ProjectionMode projectionMode=WGECamera::ORTHOGRAPHIC, const QWidget *shareWidget=0) | |
Default constructor. More... | |
virtual | ~WQtGLWidget () |
Destructor. More... | |
void | setCameraManipulator (CameraManipulators manipulator) |
Sets the camera manipulator to use. More... | |
CameraManipulators | getCameraManipulators () |
Returns the actually set camera manipulator. More... | |
std::shared_ptr< WGEViewer > | getViewer () const |
Get the included viewer. More... | |
QMenu * | getCameraPresetsMenu () |
The presets menu. More... | |
QMenu * | getCameraPresetsAndResetMenu () |
The presets menu including the reset action. More... | |
QAction * | getCameraResetAction () |
The action to trigger a camera reset. More... | |
virtual void | cleanUp () |
Called on close. More... | |
void | setPaused (bool pause=true) |
Pause rendering. More... | |
bool | getPaused () const |
Query whether the view is paused or not. More... | |
Static Public Member Functions | |
static const QGLFormat | getDefaultFormat () |
Creates and returns a default OpenGL format description with vertical sync enabled. More... | |
Protected Member Functions | |
virtual void | mouseDoubleClickEvent (QMouseEvent *event) |
Event handler for double clicks. More... | |
virtual void | resizeGL (int width, int height) |
Event handler for resize events. More... | |
virtual void | keyPressEvent (QKeyEvent *event) |
Event handler for key press. More... | |
virtual void | keyReleaseEvent (QKeyEvent *event) |
Event handler for key release. More... | |
virtual void | mousePressEvent (QMouseEvent *event) |
Event handler for mouse button press. More... | |
virtual void | mouseReleaseEvent (QMouseEvent *event) |
Event handler for mouse button release. More... | |
virtual void | mouseMoveEvent (QMouseEvent *event) |
Event handler for mouse moves. More... | |
virtual void | wheelEvent (QWheelEvent *event) |
Event handler for the mouse wheel. More... | |
virtual void | paintEvent (QPaintEvent *event) |
QT Callback for handling repaints. More... | |
virtual void | paintGL () |
QT Callback for handling repaints. More... | |
int | translateButton (QMouseEvent *event) |
Simply translate the mouse button from an event to an int. More... | |
virtual bool | event (QEvent *event) |
Custom event dispatcher. More... | |
virtual void | closeEvent (QCloseEvent *event) |
Called on close. More... | |
Protected Attributes | |
std::shared_ptr< WGEViewer > | m_Viewer |
The viewer to the scene. More... | |
std::string | m_nameOfViewer |
The name of the viewer. More... | |
CameraManipulators | m_CurrentManipulator |
Stores the current manipulator. More... | |
WGECamera::ProjectionMode | m_initialProjectionMode |
Camera projection mode used to initialize widget. More... | |
Private Member Functions | |
void | notifyFirstRenderedFrame () |
Called by the WGEViewer to notify about the first frame rendered. More... | |
Private Attributes | |
QTimer | m_Timer |
Timer for periodic repaints. More... | |
bool | m_firstPaint |
This flag is set to true if the first paint call occured. More... | |
QMenu * | m_cameraPresetMenu |
Camera menu. More... | |
QMenu * | m_cameraPresetResetMenu |
Camera menu with reset action. More... | |
QAction * | m_cameraResetAction |
Camera reset. More... | |
A widget containing an open gl display area.
This initializes OpenGL context and adds a view to the engine.
Definition at line 53 of file WQtGLWidget.h.
List of currently possible camera manipulators.
Definition at line 77 of file WQtGLWidget.h.
|
explicit |
Default constructor.
nameOfViewer | Name of the Viewer |
parent | Parent widget. |
projectionMode | decides whether the widget uses perspective or othographic projection |
shareWidget | this widget will share OpenGL display lists and texture objects with shareWidget |
Definition at line 54 of file WQtGLWidget.cpp.
References WKernel::getGraphicsEngine(), WQtGui::getIconManager(), WKernel::getRunningKernel(), m_cameraPresetMenu, m_cameraPresetResetMenu, m_cameraResetAction, m_initialProjectionMode, m_nameOfViewer, m_Timer, m_Viewer, notifyFirstRenderedFrame(), reset(), setFitScreenPosition(), setPresetViewAnterior(), setPresetViewInferior(), setPresetViewLeft(), setPresetViewPosterior(), setPresetViewRight(), and setPresetViewSuperior().
|
virtual |
Destructor.
Definition at line 132 of file WQtGLWidget.cpp.
References cleanUp(), wlog::debug(), and m_nameOfViewer.
|
virtual |
Called on close.
Clean up all OpenGL stuff.
Definition at line 139 of file WQtGLWidget.cpp.
References WKernel::getGraphicsEngine(), WKernel::getRunningKernel(), and m_Viewer.
Referenced by ~WQtGLWidget().
|
protectedvirtual |
Called on close.
Accept the event to accept the close call.
event | the event. |
Definition at line 149 of file WQtGLWidget.cpp.
References event().
|
protectedvirtual |
Custom event dispatcher.
Gets called by QT's Event system every time an event got sent to this widget. This event handler processes the notifyrender events. Others get forwarded.
event | the event that got transmitted. |
Definition at line 372 of file WQtGLWidget.cpp.
References renderedFirstFrame().
Referenced by closeEvent(), keyPressEvent(), keyReleaseEvent(), mouseDoubleClickEvent(), mouseMoveEvent(), mousePressEvent(), mouseReleaseEvent(), paintEvent(), and translateButton().
WQtGLWidget::CameraManipulators WQtGLWidget::getCameraManipulators | ( | ) |
Returns the actually set camera manipulator.
Definition at line 197 of file WQtGLWidget.cpp.
References m_CurrentManipulator.
QMenu * WQtGLWidget::getCameraPresetsAndResetMenu | ( | ) |
The presets menu including the reset action.
Definition at line 536 of file WQtGLWidget.cpp.
References m_cameraPresetResetMenu.
QMenu * WQtGLWidget::getCameraPresetsMenu | ( | ) |
The presets menu.
Definition at line 531 of file WQtGLWidget.cpp.
References m_cameraPresetMenu.
Referenced by WQtGLDockWidget::getCameraPresetMenu(), and WQtGLDockWidget::WQtGLDockWidget().
QAction * WQtGLWidget::getCameraResetAction | ( | ) |
The action to trigger a camera reset.
Definition at line 541 of file WQtGLWidget.cpp.
References m_cameraResetAction.
Referenced by WQtGLDockWidget::WQtGLDockWidget().
|
static |
Creates and returns a default OpenGL format description with vertical sync enabled.
Definition at line 391 of file WQtGLWidget.cpp.
bool WQtGLWidget::getPaused | ( | ) | const |
Query whether the view is paused or not.
Definition at line 551 of file WQtGLWidget.cpp.
References getViewer().
std::shared_ptr< WGEViewer > WQtGLWidget::getViewer | ( | ) | const |
Get the included viewer.
Definition at line 202 of file WQtGLWidget.cpp.
References m_Viewer.
Referenced by WUIQtViewWidget::addEventHandler(), getPaused(), WUIQtViewWidget::getViewer(), WMainWindow::handleGLVendor(), WQtGLDockWidget::handleVisibilityChange(), WUIQtViewWidget::height(), WUIQtViewWidget::realizeImpl(), WQtGLDockWidget::restoreSettings(), WQtGLDockWidget::saveSettings(), setFitScreenPosition(), setPaused(), WMainWindow::setupGUI(), WUIQtViewWidget::width(), WQtGLDockWidget::WQtGLDockWidget(), and WQtNavGLWidget::WQtNavGLWidget().
|
protectedvirtual |
Event handler for key press.
event | the event description. |
Definition at line 254 of file WQtGLWidget.cpp.
References event(), and m_Viewer.
|
protectedvirtual |
Event handler for key release.
event | the event description. |
Definition at line 286 of file WQtGLWidget.cpp.
References event(), WGraphicsEngine::getGraphicsEngine(), m_Viewer, and setCameraManipulator().
|
protectedvirtual |
Event handler for double clicks.
event | the event description. |
Definition at line 336 of file WQtGLWidget.cpp.
References event(), m_Viewer, and translateButton().
|
protectedvirtual |
Event handler for mouse moves.
event | the event description. |
Definition at line 352 of file WQtGLWidget.cpp.
References event(), and m_Viewer.
|
protectedvirtual |
Event handler for mouse button press.
event | the event description. |
Definition at line 328 of file WQtGLWidget.cpp.
References event(), m_Viewer, and translateButton().
|
protectedvirtual |
Event handler for mouse button release.
event | the event description. |
Definition at line 344 of file WQtGLWidget.cpp.
References event(), m_Viewer, and translateButton().
|
private |
Called by the WGEViewer to notify about the first frame rendered.
Definition at line 398 of file WQtGLWidget.cpp.
Referenced by WQtGLWidget().
|
protectedvirtual |
QT Callback for handling repaints.
event | event descriptor. |
Definition at line 207 of file WQtGLWidget.cpp.
References event(), WKernel::getGraphicsEngine(), WKernel::getRunningKernel(), and m_firstPaint.
|
protectedvirtual |
QT Callback for handling repaints.
Definition at line 219 of file WQtGLWidget.cpp.
References m_Viewer.
|
signal |
Signals that the first frame was rendered.
Referenced by event().
|
slot |
Resets the contained view using the installed manipulator.
Definition at line 383 of file WQtGLWidget.cpp.
References m_Viewer.
Referenced by WQtGLWidget().
|
protectedvirtual |
Event handler for resize events.
width | the new width. |
height | the new height. |
Definition at line 230 of file WQtGLWidget.cpp.
References m_Viewer.
void WQtGLWidget::setCameraManipulator | ( | WQtGLWidget::CameraManipulators | manipulator | ) |
Sets the camera manipulator to use.
manipulator | the manipulator. |
Definition at line 155 of file WQtGLWidget.cpp.
References WLogger::addLogMessage(), WLogger::getLogger(), m_CurrentManipulator, and m_Viewer.
Referenced by keyReleaseEvent().
|
slot |
Zooms and centers the view to fit the viewer.
Definition at line 511 of file WQtGLWidget.cpp.
References WKernel::getRunningKernel(), getViewer(), m_Viewer, and wlog::warn().
Referenced by WQtGLWidget().
void WQtGLWidget::setPaused | ( | bool | pause = true | ) |
Pause rendering.
This does not free the viewer. It simply pauses rendering.
pause | true to pause. |
Definition at line 546 of file WQtGLWidget.cpp.
References getViewer().
Referenced by WQtGLDockWidget::closeEvent(), and WQtGLDockWidget::showEvent().
|
slot |
Sets the anterior preset view of the main viewer.
Definition at line 475 of file WQtGLWidget.cpp.
References m_Viewer, and wlog::warn().
Referenced by WQtGLWidget().
|
slot |
Sets the inferior preset view of the main viewer.
Definition at line 457 of file WQtGLWidget.cpp.
References m_Viewer, and wlog::warn().
Referenced by WQtGLWidget().
|
slot |
Sets the left preset view of the main viewer.
Definition at line 403 of file WQtGLWidget.cpp.
References m_Viewer, and wlog::warn().
Referenced by WQtGLWidget().
|
slot |
Sets the posterior preset view of the main viewer.
Definition at line 493 of file WQtGLWidget.cpp.
References m_Viewer, and wlog::warn().
Referenced by WQtGLWidget().
|
slot |
Sets the right preset view of the main viewer.
Definition at line 421 of file WQtGLWidget.cpp.
References m_Viewer, and wlog::warn().
Referenced by WQtGLWidget().
|
slot |
Sets the superior preset view of the main viewer.
Definition at line 439 of file WQtGLWidget.cpp.
References m_Viewer, and wlog::warn().
Referenced by WQtGLWidget().
|
protected |
Simply translate the mouse button from an event to an int.
event | the QT Event. |
Definition at line 239 of file WQtGLWidget.cpp.
References event().
Referenced by mouseDoubleClickEvent(), mousePressEvent(), and mouseReleaseEvent().
|
protectedvirtual |
Event handler for the mouse wheel.
event | the event description. |
Definition at line 360 of file WQtGLWidget.cpp.
References m_Viewer.
|
private |
Camera menu.
Definition at line 335 of file WQtGLWidget.h.
Referenced by getCameraPresetsMenu(), and WQtGLWidget().
|
private |
Camera menu with reset action.
Definition at line 340 of file WQtGLWidget.h.
Referenced by getCameraPresetsAndResetMenu(), and WQtGLWidget().
|
private |
Camera reset.
Definition at line 345 of file WQtGLWidget.h.
Referenced by getCameraResetAction(), and WQtGLWidget().
|
protected |
Stores the current manipulator.
Definition at line 290 of file WQtGLWidget.h.
Referenced by getCameraManipulators(), and setCameraManipulator().
|
private |
This flag is set to true if the first paint call occured.
See the paint method for details.
Definition at line 325 of file WQtGLWidget.h.
Referenced by paintEvent().
|
protected |
Camera projection mode used to initialize widget.
May not be the actual one!
Definition at line 295 of file WQtGLWidget.h.
Referenced by WQtGLWidget().
|
protected |
The name of the viewer.
Definition at line 207 of file WQtGLWidget.h.
Referenced by WQtGLWidget(), and ~WQtGLWidget().
|
private |
Timer for periodic repaints.
Definition at line 320 of file WQtGLWidget.h.
Referenced by WQtGLWidget().
|
protected |
The viewer to the scene.
Definition at line 202 of file WQtGLWidget.h.
Referenced by cleanUp(), getViewer(), keyPressEvent(), keyReleaseEvent(), mouseDoubleClickEvent(), mouseMoveEvent(), mousePressEvent(), mouseReleaseEvent(), paintGL(), reset(), resizeGL(), setCameraManipulator(), setFitScreenPosition(), setPresetViewAnterior(), setPresetViewInferior(), setPresetViewLeft(), setPresetViewPosterior(), setPresetViewRight(), setPresetViewSuperior(), wheelEvent(), and WQtGLWidget().