Skip to content

vtkActor添加鼠标悬浮显示提示_tip功能


开发环境:


demo解决问题: 给vtkActor对象设置一个文本,在鼠标悬浮时进行显示

  • tip控件关键代码
cpp
  // Create the widget.
  vtkNew<vtkBalloonRepresentation> balloonRep;
  balloonRep->SetBalloonLayoutToImageRight();

  vtkNew<vtkBalloonWidget> balloonWidget;
  balloonWidget->SetInteractor(iRen);
  balloonWidget->SetRepresentation(balloonRep);
  balloonWidget->AddBalloon(sphereActor, "This is a sphere", nullptr);
  balloonWidget->AddBalloon(regularPolygonActor, "This is a regular polygon",
                            nullptr);
  • 五边形创建对象vtkRegularPolygonSource

prj name: BalloonWidget

cpp
# include <vtkActor.h>
# include <vtkBalloonRepresentation.h>
# include <vtkBalloonWidget.h>
#

基于 VitePress 强力驱动 | 记录技术与生活