[vtkusers] Trouble using VTK Widget with QVTK

kenichiro yoshimi rccm.kyoshimi at gmail.com
Sun Jul 8 21:10:38 EDT 2018


Hi,

How about you replace the macros in the following way in CMakeLists.txt?
 QT4_WRAP_CPP -> QT5_WRAP_CPP
 QT4_WRAP_UI -> QT5_WRAP_UI

Best
2018年7月8日(日) 19:35 andyjk <andrewkeeling at hotmail.com>:
>
> Thanks again for the advice, Todd.
>
> Yes - I do need to delve a bit deeper re debugging.
>
> I thought vtkNew<...>, and vtksmartPointer<...>::New() both create instances
> (the former being the preferred method now?)
>
> To check, I tried both:
> vtkNew<vtkGenericOpenGLRenderWindow> renderWindow;
>
>
> and
>
> vtkSmartPointer<vtkGenericOpenGLRenderWindow> renderWindow =
> vtkSmartPointer<vtkGenericOpenGLRenderWindow>::New();
>
> (then ui->widget->SetRenderWindow(renderWindow); in both instances)
>
> Both work and produce the rendered sphere, but no contour widget. So I think
> the assignment is happening identically with either method.
>
> I also did the following, with two breakpoints (before and after the safe
> down cast):
>
> vtkSmartPointer<vtkRenderWindow> vtkrenderWindow =
>                 vtkSmartPointer<vtkRenderWindow>::New();
>         vtkSmartPointer<vtkGenericOpenGLRenderWindow> renderWindow =
> vtkGenericOpenGLRenderWindow::SafeDownCast(vtkrenderWindow);
>
>         ui->widget->SetRenderWindow(renderWindow);
>
> I notice that the vtkrenderwindow gets a valid pointer, and seems to be
> reading from vtkRenderingOpenGL2-8.1.dll  - so is presumably already
> something opengl based ?
>
> At the subsequent break point (so after the line
> vtkSmartPointer<vtkGenericOpenGLRenderWindow> renderWindow =
> vtkGenericOpenGLRenderWindow::SafeDownCast(vtkrenderWindow); ) I notice that
> the renderWindow pointer is still NULL.
>
> So the SafeDownCast seems to fail -but of course I can bypass this line by
> just doing
> vtkSmartPointer<vtkGenericOpenGLRenderWindow> renderWindow =
> vtkSmartPointer<vtkGenericOpenGLRenderWindow>::New();
> ui->widget->SetRenderWindow(renderWindow);
>
> which seems to render fine but ignores the contour widget.
>
> Frustrating! But thanks for your help anyway.
>
> Andy
>
>
>
>
>
>
>
>
> --
> Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> https://public.kitware.com/mailman/listinfo/vtkusers


More information about the vtkusers mailing list