From ccf4ace393d92894f2fe89109edd9bb4924672bb Mon Sep 17 00:00:00 2001 From: Charles PIGNEROL <> Date: Tue, 28 Oct 2025 14:28:19 +0100 Subject: [PATCH] Version 8.8.3. Qt 6.10.0 / VTK 9.2.5 port. The port appears to be working fine in 9.5.2 but is not validated with Qt 6.10.0 because the graphical window is often black. Works well in Qt 6.6.1/VTK 9.2.5. --- cmake/version.cmake | 2 +- src/QtVtk/QtVTKPrintHelper.cpp | 39 ------------------- src/QtVtk/QtVtkViewDefinitionDialog.cpp | 4 ++ src/QtVtk/QtVtkViewDefinitionPanel.cpp | 4 ++ .../QtVtk/vtkECMIntersectionPolyDataFilter.h | 7 +--- src/QtVtk/public/QtVtk/vtkPatchedDelaunay2D.h | 4 -- .../vtkECMIntersectionPolyDataFilter.cpp | 29 ++++++-------- src/QtVtk/vtkPatchedDelaunay2D.cpp | 4 -- src/viewpoint/QtViewPointWindow.cpp | 11 +++++- src/viewpoint/viewpoint.cpp | 17 ++++++++ versions.txt | 18 +++++++++ 11 files changed, 66 insertions(+), 73 deletions(-) diff --git a/cmake/version.cmake b/cmake/version.cmake index 0ab897f..403a23a 100644 --- a/cmake/version.cmake +++ b/cmake/version.cmake @@ -4,7 +4,7 @@ set (QT_VTK_MAJOR_VERSION "8") set (QT_VTK_MINOR_VERSION "8") -set (QT_VTK_RELEASE_VERSION "2") +set (QT_VTK_RELEASE_VERSION "3") set (QT_VTK_VERSION ${QT_VTK_MAJOR_VERSION}.${QT_VTK_MINOR_VERSION}.${QT_VTK_RELEASE_VERSION}) diff --git a/src/QtVtk/QtVTKPrintHelper.cpp b/src/QtVtk/QtVTKPrintHelper.cpp index 7248cec..9c32b3e 100644 --- a/src/QtVtk/QtVTKPrintHelper.cpp +++ b/src/QtVtk/QtVTKPrintHelper.cpp @@ -364,34 +364,10 @@ void QtVTKPrintHelper::printToFile (vtkRenderWindow& window, const string& fileN } // if (1 < magnification) } // if (0 != dpi) windowToImageFilter->Update ( ); -#ifndef VTK_5 writer->SetInputConnection (windowToImageFilter->GetOutputPort ( )); -#else // VTK_5 - writer->SetInput (windowToImageFilter->GetOutput ( )); -#endif // VTK_5 - writer->SetFileName (fileName.c_str ( )); -#ifdef VTK_5 -// On force le raffraichissement total de la fenetre. En effet, si la fenetre -// VTK est masquee par une autre fenetre X11 la zone masquee n'est pas -// forcement raffraichie, et la zone correspondante de l'image est alors noire. -window.MappedOff ( ); -window.MappedOn ( ); -#endif // VTK_5 - window.Render ( ); -#ifdef VTK_5 - windowToImageFilter->Modified ( ); - windowToImageFilter->Update ( ); -#endif // VTK_5 - writer->Write ( ); -/* - windowToImageFilter->SetInput (&window); - windowToImageFilter->Update ( ); - writer->SetInput (windowToImageFilter->GetOutput ( )); writer->SetFileName (fileName.c_str ( )); window.Render ( ); writer->Write ( ); -*/ - writer->Delete ( ); windowToImageFilter->Delete ( ); @@ -440,24 +416,9 @@ void QtVTKPrintHelper::printToFile (vtkRenderWindow& window, const string& fileN windowToImageFilter->SetInput (rw); windowToImageFilter->Update ( ); -#ifndef VTK_5 writer->SetInputConnection (windowToImageFilter->GetOutputPort ( )); -#else // VTK_5 - writer->SetInput (windowToImageFilter->GetOutput ( )); -#endif // VTK_5 writer->SetFileName (fileName.c_str ( )); -#ifdef VTK_5 -// On force le raffraichissement total de la fenetre. En effet, si la fenetre -// VTK est masquee par une autre fenetre X11 la zone masquee n'est pas -// forcement raffraichie, et la zone correspondante de l'image est alors noire. -rw->MappedOff ( ); -rw->MappedOn ( ); -#endif // VTK_5 rw->Render ( ); -#ifdef VTK_5 - windowToImageFilter->Modified ( ); - windowToImageFilter->Update ( ); -#endif // VTK_5 writer->Write ( ); writer->Delete ( ); windowToImageFilter->Delete ( ); diff --git a/src/QtVtk/QtVtkViewDefinitionDialog.cpp b/src/QtVtk/QtVtkViewDefinitionDialog.cpp index 2b5d980..f83b4bb 100644 --- a/src/QtVtk/QtVtkViewDefinitionDialog.cpp +++ b/src/QtVtk/QtVtkViewDefinitionDialog.cpp @@ -46,7 +46,11 @@ QtVtkViewDefinitionDialog::QtVtkViewDefinitionDialog ( // Creation de l'ihm : QVBoxLayout* layout = new QVBoxLayout (this); +#ifdef QT_5 layout->setMargin (QtConfiguration::margin); +#else // QT_5 + layout->setContentsMargins (QtConfiguration::margin, QtConfiguration::margin, QtConfiguration::margin, QtConfiguration::margin); +#endif // QT_5 layout->setSizeConstraint (QLayout::SetMinimumSize); QtGroupBox* frame = new QtGroupBox (QSTR ("Paramètres de la vue"), this, "frame"); QVBoxLayout* frameLayout = new QVBoxLayout (frame); diff --git a/src/QtVtk/QtVtkViewDefinitionPanel.cpp b/src/QtVtk/QtVtkViewDefinitionPanel.cpp index bec84f1..0576990 100644 --- a/src/QtVtk/QtVtkViewDefinitionPanel.cpp +++ b/src/QtVtk/QtVtkViewDefinitionPanel.cpp @@ -48,7 +48,11 @@ QtVtkViewDefinitionPanel::QtVtkViewDefinitionPanel (QWidget* parent, const strin // Creation de l'ihm : QVBoxLayout* layout = new QVBoxLayout (this); layout->setSpacing (QtConfiguration::spacing); +#ifdef QT_5 layout->setMargin (QtConfiguration::margin); +#else // QT_5 + layout->setContentsMargins (QtConfiguration::margin, QtConfiguration::margin, QtConfiguration::margin, QtConfiguration::margin); +#endif // QT_5 layout->setSizeConstraint (QLayout::SetMinimumSize); // Nom / Commentaire : diff --git a/src/QtVtk/public/QtVtk/vtkECMIntersectionPolyDataFilter.h b/src/QtVtk/public/QtVtk/vtkECMIntersectionPolyDataFilter.h index 824fe5a..24ba4e1 100644 --- a/src/QtVtk/public/QtVtk/vtkECMIntersectionPolyDataFilter.h +++ b/src/QtVtk/public/QtVtk/vtkECMIntersectionPolyDataFilter.h @@ -66,12 +66,7 @@ * La simple réduction par homothétie du maillage suffit à rendre ce filtre * opérant ... */ -#ifndef VTK_5 -class vtkECMIntersectionPolyDataFilter : -#else // VTK_5 -class VTK_GRAPHICS_EXPORT vtkECMIntersectionPolyDataFilter : -#endif // VTK_5 - public vtkPolyDataAlgorithm +class vtkECMIntersectionPolyDataFilter : public vtkPolyDataAlgorithm { public: diff --git a/src/QtVtk/public/QtVtk/vtkPatchedDelaunay2D.h b/src/QtVtk/public/QtVtk/vtkPatchedDelaunay2D.h index f80b950..6d8cae7 100644 --- a/src/QtVtk/public/QtVtk/vtkPatchedDelaunay2D.h +++ b/src/QtVtk/public/QtVtk/vtkPatchedDelaunay2D.h @@ -148,11 +148,7 @@ class vtkPointSet; #define VTK_SET_TRANSFORM_PLANE 1 #define VTK_BEST_FITTING_PLANE 2 -#ifndef VTK_5 class vtkPatchedDelaunay2D : public vtkPolyDataAlgorithm // CP -#else // VTK_5 -class VTK_GRAPHICS_EXPORT vtkPatchedDelaunay2D : public vtkPolyDataAlgorithm // CP -#endif // VTK_5 { public: vtkTypeMacro(vtkPatchedDelaunay2D,vtkPolyDataAlgorithm); diff --git a/src/QtVtk/vtkECMIntersectionPolyDataFilter.cpp b/src/QtVtk/vtkECMIntersectionPolyDataFilter.cpp index da7b23f..ced6bd7 100644 --- a/src/QtVtk/vtkECMIntersectionPolyDataFilter.cpp +++ b/src/QtVtk/vtkECMIntersectionPolyDataFilter.cpp @@ -16,7 +16,9 @@ #include "vtkCellArray.h" #include "vtkCellData.h" +#if VTK_MAJOR_VERSION >= 9 #include "vtkDelaunay2D.h" +#endif // VTK_MAJOR_VERSION >= 9 #include "vtkDoubleArray.h" #include "vtkInformation.h" #include "vtkInformationVector.h" @@ -43,7 +45,9 @@ // CP : new code #include #include +#if VTK_MAJOR_VERSION < 9 #include +#endif // VTK_MAJOR_VERSION < 9 // !CP new code @@ -859,17 +863,14 @@ ::SplitCell(vtkPolyData *input, vtkIdType cellId, vtkIdType *cellPts, transform->Translate(-center[0], -center[1], -center[2]); // CP : new code -// vtkSmartPointer< vtkDelaunay2D > del2D = -// vtkSmartPointer< vtkDelaunay2D >::New(); - vtkSmartPointer< vtkPatchedDelaunay2D > del2D = - vtkSmartPointer< vtkPatchedDelaunay2D >::New(); +#if VTK_MAJOR_VERSION < 9 +vtkSmartPointer< vtkPatchedDelaunay2D > del2D = vtkSmartPointer< vtkPatchedDelaunay2D >::New(); +#else +vtkSmartPointer< vtkDelaunay2D > del2D = vtkSmartPointer< vtkDelaunay2D >::New(); +#endif // VTK_MAJOR_VERSION < 9 // !CP : new code -#ifndef VTK_5 del2D->SetInputData (pd); -#else // VTK_5 - del2D->SetInput(pd); -#endif // VTK_5 - del2D->SetSource(pd); +// del2D->SetSource(pd); // CP v 8.8.3 del2D->SetTolerance(0.0); del2D->SetAlpha(0.0); del2D->SetOffset(10); @@ -1395,17 +1396,11 @@ int vtkECMIntersectionPolyDataFilter::RequestData(vtkInformation* vtkNotU // Set up new poly data for the inputs to build cells and links. vtkSmartPointer< vtkPolyData > mesh0 = vtkSmartPointer< vtkPolyData >::New(); mesh0->DeepCopy(input0); -#ifndef VTK_5 -#else // VTK_5 - mesh0->SetSource(NULL); -#endif // VTK_5 +// mesh0->SetSource(NULL); // CP v 8.8.3 vtkSmartPointer< vtkPolyData > mesh1 = vtkSmartPointer< vtkPolyData >::New(); mesh1->DeepCopy(input1); -#ifndef VTK_5 -#else // VTK_5 - mesh1->SetSource(NULL); -#endif // VTK_5 +// mesh1->SetSource(NULL); // CP v 8.8.3 // Find the triangle-triangle intersections between mesh0 and mesh1 vtkSmartPointer< vtkOBBTree > obbTree0 = vtkSmartPointer< vtkOBBTree >::New(); diff --git a/src/QtVtk/vtkPatchedDelaunay2D.cpp b/src/QtVtk/vtkPatchedDelaunay2D.cpp index f048576..1b1785c 100644 --- a/src/QtVtk/vtkPatchedDelaunay2D.cpp +++ b/src/QtVtk/vtkPatchedDelaunay2D.cpp @@ -66,11 +66,7 @@ vtkPatchedDelaunay2D::~vtkPatchedDelaunay2D() void vtkPatchedDelaunay2D::SetSource(vtkPolyData *input) // CP { // this->Superclass::SetInputData(1, input); // CP -#ifndef VTK_5 this->Superclass::SetInputData(1, input); // CP -#else // VTK_5 - this->Superclass::SetInput(1, input); // CP -#endif // VTK_5 } //---------------------------------------------------------------------------- diff --git a/src/viewpoint/QtViewPointWindow.cpp b/src/viewpoint/QtViewPointWindow.cpp index 28dbb85..c364fcd 100644 --- a/src/viewpoint/QtViewPointWindow.cpp +++ b/src/viewpoint/QtViewPointWindow.cpp @@ -10,6 +10,9 @@ #include #include #include +#ifndef VTK_WIDGET +#include +#endif // VTK_WIDGET #include #include @@ -48,8 +51,12 @@ void QtViewPointWindow::createGui ( ) _graphicWindow->setAttribute (Qt::WA_TranslucentBackground, true); // Bonne gestion transparence setCentralWidget (_graphicWindow); _renderer = vtkRenderer::New ( ); +#ifndef VTK_WIDGET + _renderWindow = vtkGenericOpenGLRenderWindow::New ( ); +#else // VTK_WIDGET _renderWindow = vtkRenderWindow::New ( ); _renderWindow->Render ( ); // Pour bonne gestion transparence +#endif // VTK_WIDGET _renderWindow->SetAlphaBitPlanes (1); // Bonne gestion transparence _renderWindow->SetMultiSamples (0); // Bonne gestion transparence _renderer->SetUseDepthPeeling (true); // Bonne gestion transparence @@ -70,8 +77,8 @@ void QtViewPointWindow::createGui ( ) _renderWindow->AddRenderer (trihedronRenderer); _graphicWindow->SetRenderWindow (_renderWindow); vtkInteractorStyleSwitch* interactorStyle = vtkInteractorStyleSwitch::New ( ); - _graphicWindow->GetInteractor ( )->SetInteractorStyle (interactorStyle); - _graphicWindow->GetInteractor ( )->SetRenderWindow (_renderWindow); + _graphicWindow->getInteractor ( )->SetInteractorStyle (interactorStyle); + _graphicWindow->getInteractor ( )->SetRenderWindow (_renderWindow); _graphicWindow->setMinimumSize (800, 600); _graphicWindow->resize (800, 600); } // QtViewPointWindow::createGui diff --git a/src/viewpoint/viewpoint.cpp b/src/viewpoint/viewpoint.cpp index 2237bdd..85a2bb4 100644 --- a/src/viewpoint/viewpoint.cpp +++ b/src/viewpoint/viewpoint.cpp @@ -9,6 +9,7 @@ #include #include +#include #include @@ -22,6 +23,22 @@ int main (int argc, char* argv[]) try { QApplication* application = new QApplication (argc, argv); +#if (VTK_MAJOR_VERSION >= 9) + QSurfaceFormat fmt; + fmt.setRenderableType(QSurfaceFormat::OpenGL); + fmt.setVersion(3, 2); + fmt.setProfile(QSurfaceFormat::CoreProfile); + fmt.setSwapBehavior(QSurfaceFormat::DoubleBuffer); + fmt.setRedBufferSize(8); + fmt.setGreenBufferSize(8); + fmt.setBlueBufferSize(8); + fmt.setDepthBufferSize(24); + fmt.setStencilBufferSize(8); + fmt.setAlphaBufferSize(0); + fmt.setStereo(false); + fmt.setSamples(0);//vtkOpenGLRenderWindow::GetGlobalMaximumNumberOfMultiSamples()); + QSurfaceFormat::setDefaultFormat (fmt); +#endif // #if (VTK_MAJOR_VERSION >= 9) QtVtk::initialize ( ); QtViewPointWindow* mainWindow = new QtViewPointWindow ( ); mainWindow->show ( ); diff --git a/versions.txt b/versions.txt index af58d1f..e47ba99 100644 --- a/versions.txt +++ b/versions.txt @@ -1,5 +1,23 @@ A FAIRE : tester le vtkIntersectionPolyDataFilter de VTK 7, voir si de base il propose les services attendus (Inner, ...). +Version 8.8.3 : 24/10/25 +=============== + +Portage Qt 6.10.0 / VTK 9.2.5. + +Le portage semble OK en 9.5.2 mais n'est pas validé avec Qt 6.10.0 car la fenête graphique est très souvent noire. Elle semble +bien fonctionner quand elle marche => probable problème de paramétrage. +Bon fonctionnement avec Qt v 6.6.1. + +Suppression du code VTK 5. + + +Version 8.8.3 : 24/10/25 +=============== + +Portage Qt 6.10.0 / VTK 9.5.2. + + Version 8.8.2 : 26/06/25 ===============