Skip to content
  • Lucas Gandel's avatar
    Improve QVTKOpenGLWidget and add QVTKOpenGLWindow class based on QOpenGLWindow · 45704131
    Lucas Gandel authored and Mathieu Westphal (Kitware)'s avatar Mathieu Westphal (Kitware) committed
    Fixing stereo support with Qt5.
    Commit 139f787a was introducing QVTKOpenGLWidget to couple a vtkRenderWindow with a QOpenGLWidget.
    However, both QVTKOpenGLWidget and its superclass QOpenGLWidget manage a single frame buffer.
    
    QVTKOpenGLWindow derives the QOpenGLWindow class to benefit from an OpenGL context managing multiple frame buffers.
    It can be used as a QWidget by calling QWidget::createWindowContainer() on your QVTKOpenGLWindow instance.
    QVTKOpenGLWidget has been reimplemented to use thes QVTKOpenGLWindow directly has a widget.
    It is recommended to do so.
    
    The old QVTKOpenGLWidget is been moved into QVTKOpenGLSimpleWidget and should not be removed as it support being a native widget,
    wich the new implementation does not.
    
    There is a new QVTKOpenGLWidget::isValid() method to check that the widget is ready to render.
    
    It is to be noted that there is a specific implementation of
    event handling in order to work around QTBUG-61836.
    The Qt::WindowTransparentForInputFlag has no effect on Mac. Thus events
    are not being passed to the widget. We let the window grabbing all events
    and then forward them to the widget.
    We also take care for providing a method to forward back events to the
    window if events were explicitely triggered on the widget instance. This
    is the case for some paraview testing logic that should now use the provided
    testingEvent() method instead of notifying the widget with events.
    
    It is to be noted that, on OSX, the widget is always resized to its internal vtkRenderWindow
    size to ensure that the viewport is correct.
    This is necessary only on MacOS when HiDPI is supported. Enabling HiDPI
    has the side effect that Cocoa will start overriding any glViewport calls
    in application code. For reference, see QCocoaWindow::initialize().
    
    This also improve tests and examples using the QVTKOpenGLWidget
    45704131