[vtkusers] QVTKWidget paintEvent

Clinton Stimpson clinton at elemtech.com
Fri Sep 24 11:28:24 EDT 2010


On Friday, September 24, 2010 09:10:30 am Leonardo M. Ramé wrote:
> On 2010-09-24 08:45:31 -0600, Clinton Stimpson wrote:
> > 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
> 
> Thanks Clint. Do you know if the QVTKWidget2 support rendering
> vtkImageViewer2?.

It should work.

Clint



More information about the vtkusers mailing list