[Qt-interest] QGraphicsEffect drawing

Anton Chernov mechernov at gmail.com
Fri Jul 15 22:35:23 CEST 2011


Maybe i can set some custom flag in the style options?

2011/7/15 Anton Chernov <mechernov at gmail.com>:
> I want avoid this because i every class i would have to have such a
> flag - that's miserable :) Bad c++ is miserable too, but takes less
> place in code :)
>
> 2011/7/15 Malyushytsky, Alex <alex at wai.com>:
>> QGraphicsEffect is base class for the for graphics effects.
>>
>> This probably means that when you set effect you do not create instance of QGraphicsEffect, but
>> QGraphicsBlurEffect, QGraphicsColorizeEffect, QGraphicsDropShadowEffect, or QGraphicsOpacityEffect.
>>
>> So what you are trying to do below is illegal, cause none of the above classes are derived from
>> BadEffectAccessor.
>>
>> I can't give you direct answer on your question, but I don't think you need id.
>>
>> void QGraphicsScene::render calls
>>   virtual void drawItems(...) to draw items.
>>
>> All you need to make standard render work the way you want is override so it skips items you don't want to draw ( set flag before calling it for example ).
>>
>>
>> Regards,
>>  Alex
>>
>>
>> -----Original Message-----
>> From: qt-interest-bounces+alex=wai.com at qt.nokia.com [mailto:qt-interest-bounces+alex=wai.com at qt.nokia.com] On Behalf Of Anton Chernov
>> Sent: Friday, July 15, 2011 12:47 AM
>> To: qt-interest at trolltech.com
>> Subject: [Qt-interest] QGraphicsEffect drawing
>>
>> 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?
>> _______________________________________________
>> Qt-interest mailing list
>> Qt-interest at qt.nokia.com
>> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
>>
>>
>> ---------------------------------------------------------------------------------------------------
>> Weidlinger Associates, Inc. made the following annotations.
>>
>> “This message and any attachments are solely for the intended recipient and may contain confidential or privileged information. If you are not the intended recipient, any disclosure, copying, use, or distribution of the information included in this message and any attachments is prohibited. If you have received this communication in error, please notify us by reply e-mail and immediately and permanently delete this message and any attachments. Thank you.”
>>
>> “Please consider our environment before printing this email.”
>> _______________________________________________
>> Qt-interest mailing list
>> Qt-interest at qt.nokia.com
>> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
>>
>



More information about the Qt-interest-old mailing list