[vtkusers] QVTKWidget paintEvent

Leonardo M. Ramé l.rame at griensu.com
Mon Sep 27 14:53:03 EDT 2010


Thanks for answering Sam, indeed, all the drawing is in my paintEvent:

void DCMWidget::paintEvent(QPaintEvent * e)
{
  if(m_selected)
  {
    QPainter paint(this);
    paint.setPen(Qt::white);
    paint.drawRect(5,5, this->width()-10, this->height()-10);
  }
}

Could you show me an example of what you suggest?.

-- 
Leonardo M. Ramé
http://leonardorame.blogspot.com

On 2010-09-27 14:17:59 -0400, (Samuel) Byeongjun Park wrote:
> > 2) My drawing is flicking over the background image viewer, is there a
> > way to avoid flickering?.
> 
> That problem caused by either of several problems.
> I suspect you put every drawing code in paintEvent().
> You would better not to do that. Please consider to draw on some other
> canvas widget (i.e. QPixmap)
> Only when you need to change the drawing. And in paintEvent(), just copy
> them to the visible window. 
> It reduces flickering.
> 
> Sam.



More information about the vtkusers mailing list