本文介绍了Vtk 图表在 QT 中中断,“未找到‘vtkContextDevice2D’的覆盖";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法在 QT 中使用任何类型的 vtk 2D 图表而不会出现错误:
通用警告:在 vtkContextDevice2D.cxx 中,第 31 行错误:未找到vtkContextDevice2D"的覆盖.

I can't use any type of vtk 2D chart in QT without getting the error:
"Generic Warning: In vtkContextDevice2D.cxx, line 31 Error: no override found for 'vtkContextDevice2D".

关于这个问题的讨论有限,几乎所有的建议都是升级 qt/vtk,但这些都是一年前的,我使用的是最新版本.

There is limited discussion on this with almost all suggestions being to upgrade qt/vtk, but theses are year old and I am on the newest versions.

这也无济于事:

include "vtkAutoInit.h"
VTK_MODULE_INIT(vtkRenderingOpenGL2); // VTK was built with vtkRenderingOpenGL2
VTK_MODULE_INIT(vtkInteractionStyle);

Info: Win64 on 64bit machine, vtk8.2.0, Qt5.13.0, 在 MCVS2017(Release x64) 编译/内置 cmake3.15.0
(其他一切都正常,甚至使用 vtk 进行 3D 渲染)

Info: Win64 on 64bit machine, vtk8.2.0, Qt5.13.0, compiled/built in MCVS2017(Release x64) with cmake3.15.0
(Everything else works fine, even 3D renderings with vtk)

代码:

view->SetInteractor(this->qvtkWidgetRight->GetInteractor());
this->qvtkWidgetRight->SetRenderWindow(view->GetRenderWindow());

错误产生的原因

推荐答案

我在运行这个例子时遇到了类似的问题:QtBarChart,我通过链接这些vtk 库:

I had a similar problem when I run this example:QtBarChart, and I fixed this issue with linking with these vtk libraries:

find_package(VTK COMPONENTS
  vtkChartsCore
  vtkCommonCore
  vtkCommonDataModel
  vtkInteractionStyle
  vtkRenderingContext2D
  vtkRenderingContextOpenGL2
  vtkRenderingCore
  vtkRenderingFreeType
  vtkRenderingGL2PSOpenGL2
  vtkRenderingOpenGL2
  vtkViewsContext2D
  QUIET

似乎我错过了一些图书馆.

It seems I missed some libraries.

这篇关于Vtk 图表在 QT 中中断,“未找到‘vtkContextDevice2D’的覆盖";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-02 05:40