Commit 03168839 authored by Sankhesh Jhaveri's avatar Sankhesh Jhaveri 💬
Browse files

Create a default render window for the QVTKOpenGLWidget

This change brings back QVTKWidget behavior of instantiating a default
render window to QVTKOpenGLWidget. This avoids applications having to
explicitly instantiate a vtkGenericOpenGLRenderWindow for the widget.

Update header documentation to denote creation in Get method
parent 8f4ec2da
......@@ -226,6 +226,13 @@ void QVTKOpenGLWidget::startEventCallback()
//-----------------------------------------------------------------------------
vtkRenderWindow* QVTKOpenGLWidget::GetRenderWindow()
{
if (!this->RenderWindow)
{
// create a default
vtkGenericOpenGLRenderWindow* win = vtkGenericOpenGLRenderWindow::New();
this->SetRenderWindow(win);
win->Delete();
}
return this->RenderWindow;
}
......
......@@ -131,6 +131,8 @@ public:
//@{
/**
* Get/Set the currently used vtkGenericOpenGLRenderWindow.
* GetRenderWindow() creates and returns a new vtkGenericOpenGLRenderWindow
* if it is not already provided.
*/
void SetRenderWindow(vtkGenericOpenGLRenderWindow* win);
void SetRenderWindow(vtkRenderWindow* win);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment