[vtkusers] QVTKWidget paintEvent

(Samuel) Byeongjun Park byeongjun.park at case.edu
Fri Sep 24 10:32:15 EDT 2010


You have to override the mouse events in your myWidget class,
such as mousePressEvent(), mouseMoveEvent(), mouseReleaseEvent(),
wheelEvent() and etc.
and call update() there.
If the painting job is heavy stuff, you would better to make conditional
painting routine or merge them into VTK's rendering process using
vtkPolyData (maybe with vtkCutter).

Sam.

-----Original Message-----
From: vtkusers-bounces at vtk.org [mailto:vtkusers-bounces at vtk.org] On Behalf
Of Leonardo M. Rame
Sent: Friday, September 24, 2010 9:53 AM
To: VTK Users
Subject: [vtkusers] QVTKWidget paintEvent

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

-- 
Leonardo M. Ramé
http://leonardorame.blogspot.com
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at:
http://www.vtk.org/Wiki/VTK_FAQ

Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers




More information about the vtkusers mailing list