[Qt-interest] QGraphicsEffect drawing

Anton Chernov mechernov at gmail.com
Fri Jul 15 09:46:34 CEST 2011


Hi,

I have a problem drawing QGraphicsEffects - a have a scene with lots
of items, but when rendering for print only particular items should be
drawn.
If i would call

QGraphicsScene::render( ... )

all will be drawn, so I use a custom renderer. Everything draws good
except the graphics effects - their

draw( QPainter* painter )

is protected.

class BadEffectAccessor : public QGraphicsEffect
{
   public:
      void publicDraw( QPainter* painter ) { draw( painter ); }
};

[...]
if( text->graphicsEffect() ) {
   BadEffectAccessor* accessor = static_cast< BadEffectAccessor* >(
text->graphicsEffect() );
   accessor->publicDraw( painter );
}
[...]

Does not help, nothing is drawn! How do I draw the effects?



More information about the Qt-interest-old mailing list