Skip to content

Commit

Permalink
Remove leftover QVTKWidget include, fix for VTK 9
Browse files Browse the repository at this point in the history
QVTKWidget has been removed finally in VTK 9, but as it is not used
directly in QCSXAPP it can be removed there.

Everywhere else, use QVTKOpenGLWidget/QVTKOpenGLStereoWidget.
  • Loading branch information
StefanBruens committed Oct 15, 2020
1 parent 0dabbaf commit 6c8d2fa
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 9 deletions.
1 change: 0 additions & 1 deletion QCSXCAD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
#include "CSPrimWire.h"
#include "CSPrimUserDefined.h"

#include <QVTKWidget.h>
#include <vtkRendererCollection.h>
#include <vtkRenderWindow.h>
#include <vtkRenderer.h>
Expand Down
10 changes: 8 additions & 2 deletions QVTKStructure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@
#include "QVTKStructure.h"

#include "vtkCommand.h"
#if VTK_MAJOR_VERSION>=8
#if VTK_MAJOR_VERSION>=9
#include "QVTKOpenGLStereoWidget.h"
#include "vtkGenericOpenGLRenderWindow.h"
#elif VTK_MAJOR_VERSION==8
#include "QVTKOpenGLWidget.h"
#include "vtkGenericOpenGLRenderWindow.h"
#else
Expand Down Expand Up @@ -99,7 +102,10 @@ QVTKStructure::QVTKStructure()
iResolution=32;
AllowUpdate=true;

#if VTK_MAJOR_VERSION>=8
#if VTK_MAJOR_VERSION>=9
VTKWidget = new QVTKOpenGLStereoWidget();
VTKWidget->setRenderWindow(vtkGenericOpenGLRenderWindow::New());
#elif VTK_MAJOR_VERSION==8
VTKWidget = new QVTKOpenGLWidget();
VTKWidget->SetRenderWindow(vtkGenericOpenGLRenderWindow::New());
#else
Expand Down
8 changes: 6 additions & 2 deletions QVTKStructure.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
#include <QtGui>

#include "vtkCommand.h"
#if VTK_MAJOR_VERSION>=8
#if VTK_MAJOR_VERSION>=9
class QVTKOpenGLStereoWidget;
#elif VTK_MAJOR_VERSION==8
class QVTKOpenGLWidget;
#else
class QVTKWidget;
Expand Down Expand Up @@ -100,7 +102,9 @@ protected slots:
unsigned int uID;
} VTKLayerStruct;

#if VTK_MAJOR_VERSION>=8
#if VTK_MAJOR_VERSION>=9
QVTKOpenGLStereoWidget *VTKWidget;
#elif VTK_MAJOR_VERSION==8
QVTKOpenGLWidget *VTKWidget;
#else
QVTKWidget *VTKWidget;
Expand Down
22 changes: 20 additions & 2 deletions export_pov.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,14 @@
#include <QMessageBox>
#include <QtXml>

#include <QVTKWidget.h>
#include "QVTKStructure.h"
#if VTK_MAJOR_VERSION>=9
#include "QVTKOpenGLStereoWidget.h"
#elif VTK_MAJOR_VERSION==8
#include "QVTKOpenGLWidget.h"
#else
#include "QVTKWidget.h"
#endif
#include <vtkRendererCollection.h>
#include <vtkRenderWindow.h>
#include <vtkRenderer.h>
Expand All @@ -33,7 +40,6 @@
#include "CSPrimCurve.h"
#include "CSPrimWire.h"

#include "QVTKStructure.h"
#include "QCSXCAD.h"
#include "export_pov.h"

Expand Down Expand Up @@ -201,7 +207,13 @@ void export_pov::export_wire( QTextStream &stream, size_t count, double *array,

QString export_pov::get_camera()
{
#if VTK_MAJOR_VERSION>=9
vtkRendererCollection* collection = ((QVTKOpenGLStereoWidget*)(m_CSX->StructureVTK->GetVTKWidget()))->renderWindow()->GetRenderers();
#elif VTK_MAJOR_VERSION==8
vtkRendererCollection* collection = ((QVTKOpenGLWidget*)(m_CSX->StructureVTK->GetVTKWidget()))->GetRenderWindow()->GetRenderers();
#else
vtkRendererCollection* collection = ((QVTKWidget*)(m_CSX->StructureVTK->GetVTKWidget()))->GetRenderWindow()->GetRenderers();
#endif
vtkRenderer *r = collection->GetFirstRenderer();
if (!r)
return QString();
Expand Down Expand Up @@ -231,7 +243,13 @@ QString export_pov::get_camera()

QString export_pov::get_light()
{
#if VTK_MAJOR_VERSION>=9
vtkRendererCollection* collection = ((QVTKOpenGLStereoWidget*)(m_CSX->StructureVTK->GetVTKWidget()))->renderWindow()->GetRenderers();
#elif VTK_MAJOR_VERSION==8
vtkRendererCollection* collection = ((QVTKOpenGLWidget*)(m_CSX->StructureVTK->GetVTKWidget()))->GetRenderWindow()->GetRenderers();
#else
vtkRendererCollection* collection = ((QVTKWidget*)(m_CSX->StructureVTK->GetVTKWidget()))->GetRenderWindow()->GetRenderers();
#endif
vtkRenderer *r = collection->GetFirstRenderer();
if (!r)
return QString();
Expand Down
16 changes: 14 additions & 2 deletions export_x3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,14 @@

#include <QMessageBox>

#include <QVTKWidget.h>
#include "QVTKStructure.h"
#if VTK_MAJOR_VERSION>=9
#include "QVTKOpenGLStereoWidget.h"
#elif VTK_MAJOR_VERSION==8
#include "QVTKOpenGLWidget.h"
#else
#include "QVTKWidget.h"
#endif
#include <vtkRendererCollection.h>
#include <vtkRenderWindow.h>
#include <vtkRenderer.h>
Expand All @@ -29,7 +36,6 @@
#include "CSPrimBox.h"
#include "CSPrimPolygon.h"

#include "QVTKStructure.h"
#include "QCSXCAD.h"
#include "export_x3d.h"

Expand Down Expand Up @@ -70,7 +76,13 @@ void export_X3D::save( QString filename )
export_properties( Scene, properties, Material );

// create camera
#if VTK_MAJOR_VERSION>=9
vtkRendererCollection* collection = ((QVTKOpenGLStereoWidget*)(m_CSX->StructureVTK->GetVTKWidget()))->renderWindow()->GetRenderers();
#elif VTK_MAJOR_VERSION==8
vtkRendererCollection* collection = ((QVTKOpenGLWidget*)(m_CSX->StructureVTK->GetVTKWidget()))->GetRenderWindow()->GetRenderers();
#else
vtkRendererCollection* collection = ((QVTKWidget*)(m_CSX->StructureVTK->GetVTKWidget()))->GetRenderWindow()->GetRenderers();
#endif
vtkRenderer *r = collection->GetFirstRenderer();
if (!r)
return;
Expand Down

0 comments on commit 6c8d2fa

Please sign in to comment.