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

Port the TestQtSwapWindows test to use modern QVTKOpenGLWidget

parent 03168839
...@@ -17,6 +17,7 @@ if(VTK_QT_VERSION VERSION_GREATER "4" AND ...@@ -17,6 +17,7 @@ if(VTK_QT_VERSION VERSION_GREATER "4" AND
vtk_add_test_cxx(${vtk-module}CxxTests tests vtk_add_test_cxx(${vtk-module}CxxTests tests
NO_VALID NO_VALID
TestQVTKOpenGLWidgetPicking.cxx TestQVTKOpenGLWidgetPicking.cxx
TestQtSwapWindows.cxx
) )
endif() endif()
...@@ -27,9 +28,6 @@ if(NOT VTK_LEGACY_REMOVE) ...@@ -27,9 +28,6 @@ if(NOT VTK_LEGACY_REMOVE)
NO_VALID NO_VALID
TestWin32QVTKWidget.cxx) TestWin32QVTKWidget.cxx)
endif() endif()
vtk_add_test_cxx(${vtk-module}CxxTests tests
NO_VALID
TestQtSwapWindows.cxx)
endif() endif()
if(VTK_QT_VERSION VERSION_GREATER "4") if(VTK_QT_VERSION VERSION_GREATER "4")
......
#include <QVTKWidget.h>
#include <QApplication> #include <QApplication>
#include <QWidget>
#include <QBoxLayout> #include <QBoxLayout>
#include <QVTKOpenGLWidget.h>
#include <QWidget>
#include <vtkNew.h>
#include <vtkRenderWindow.h> #include <vtkRenderWindow.h>
#include <vtkRenderer.h> #include <vtkRenderer.h>
#include <vtkSmartPointer.h> #include <vtkSmartPointer.h>
#include <vtkNew.h>
int TestQtSwapWindows(int argc, char* argv[]) int TestQtSwapWindows(int argc, char* argv[])
{ {
QSurfaceFormat::setDefaultFormat(QVTKOpenGLWidget::defaultFormat());
QApplication app(argc, argv); QApplication app(argc, argv);
// Set up frame with two horizontally stacked panels, // Set up frame with two horizontally stacked panels,
// Each containg a QVTKWidget // Each containg a QVTKOpenGLWidget
QWidget frame; QWidget frame;
QHBoxLayout *layout = new QHBoxLayout(&frame); QHBoxLayout *layout = new QHBoxLayout(&frame);
QWidget *leftPanel = new QWidget(&frame); QWidget *leftPanel = new QWidget(&frame);
QVBoxLayout *leftLayout = new QVBoxLayout(leftPanel); QVBoxLayout *leftLayout = new QVBoxLayout(leftPanel);
QVTKWidget *leftVTKWidget = new QVTKWidget(leftPanel); QVTKOpenGLWidget *leftVTKWidget = new QVTKOpenGLWidget(leftPanel);
vtkSmartPointer<vtkRenderer> leftRenderer = vtkSmartPointer<vtkRenderer>::New(); vtkSmartPointer<vtkRenderer> leftRenderer = vtkSmartPointer<vtkRenderer>::New();
leftRenderer->SetBackground(1, 0, 0); leftRenderer->SetBackground(1, 0, 0);
leftVTKWidget->GetRenderWindow()->AddRenderer(leftRenderer); leftVTKWidget->GetRenderWindow()->AddRenderer(leftRenderer);
...@@ -26,7 +27,7 @@ int TestQtSwapWindows(int argc, char* argv[]) ...@@ -26,7 +27,7 @@ int TestQtSwapWindows(int argc, char* argv[])
QWidget *rightPanel = new QWidget(&frame); QWidget *rightPanel = new QWidget(&frame);
QVBoxLayout *rightLayout = new QVBoxLayout(rightPanel); QVBoxLayout *rightLayout = new QVBoxLayout(rightPanel);
QVTKWidget *rightVTKWidget = new QVTKWidget(rightPanel); QVTKOpenGLWidget *rightVTKWidget = new QVTKOpenGLWidget(rightPanel);
vtkSmartPointer<vtkRenderer> rightRenderer = vtkSmartPointer<vtkRenderer>::New(); vtkSmartPointer<vtkRenderer> rightRenderer = vtkSmartPointer<vtkRenderer>::New();
rightRenderer->SetBackground(0, 1, 0); rightRenderer->SetBackground(0, 1, 0);
rightVTKWidget->GetRenderWindow()->AddRenderer(rightRenderer); rightVTKWidget->GetRenderWindow()->AddRenderer(rightRenderer);
......
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