[vtkusers] QVTKWidget paintEvent

Clinton Stimpson clinton at elemtech.com
Fri Sep 24 10:45:31 EDT 2010


On Friday, September 24, 2010 07:52:48 am Leonardo M. Ramé wrote:
> Hi, can paint over a QVTKWidget, however my drawings are lost when I
> click on the widget or after setting a vtkImageViewer2 into it.
> 
> This is the code I use to paint over the QVTKWidget:
> 
> QPaintEngine * myWidget::paintEngine() const
> {
>   return QWidget::paintEngine();
> }
> 
> void myWidget::paintEvent(QPaintEvent * e)
> {
>   QVTKWidget::paintEvent(e);
>   QPainter paint(this);
>   paint.setPen(Qt::white);
>   paint.drawRect(5,5,10,10);
> }
> 
> How can I let my drawings repaint over the image viewer

If you want to use QPainter, you'll have to use the new QVTKWidget2 in the git 
repository.  Otherwise, you'll have to use VTK classes to do that drawing.

Clint



More information about the vtkusers mailing list