[vtkusers] QVTKWidget paintEvent

Clinton Stimpson clinton at elemtech.com
Fri Sep 24 14:21:17 EDT 2010


On Friday, September 24, 2010 12:03:21 pm Leonardo M. Ramé wrote:
> On 2010-09-24 09:28:24 -0600, Clinton Stimpson wrote:
> > 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
> 
> Sorry, but it doesn't.
> 
> I replaced the directory GUISupport/Qt from 5.6.0 with the one from git,
> and I got many errors like this:
> 
> VTK/GUISupport/Qt/QVTKGraphicsItem.h:36: error: forward declaration of
> ‘struct vtkGenericOpenGLRenderWindow’

Well, that's not going to work.  ;)

> 
> Do I have to download all vtk files from git repository to compile the
> new QVTKWidget2 ?

You'll have to figure out what you need if you want to backport or copy the 
code, and it does depend on other source files in VTK that are new.

Clint



More information about the vtkusers mailing list