PDA

View Full Version : How to draw a text with drop shadow in the image using QPainter ?



RaSMS
25th October 2014, 07:09
Hello everyone.,

In my program i have open the image and draw the image in the pixmap and I also want to draw the text with drop shadow effect in the image can somebody please help me to draw the text with drop shadow effect using the drawText method or other options in the QPainter class.


Thanks in advance.

ChrisW67
25th October 2014, 10:45
Some ideas here
http://stackoverflow.com/questions/5393462/qt-text-with-shadow

RaSMS
25th October 2014, 12:12
Thanks for your reply.,

I did not add the text to any widgets.,

I want to add the text bottom right corner of the image ( like add copyright information to the image ) with drop shadow effect.

I have add the text like this


aPainter.drawText( aRect, Qt::AlignRight , inString );

aPainter draw the text in the given aRect location without any issues. But i want to add the dropShadow effect to the inString.

Anybody help me.

Thanks in advance.

ChrisW67
25th October 2014, 20:59
The second answer at the link tells you that you achieve the 'drop shadow' effect by drawing the text twice with slight offset using a QPainter. The third answer shows the steps to draw text twice, (albeit embedded in the proxy style) showing how you might achieve the offset and hinting that you may wish to change the pen colour of the 'lower' layer.

wysota
26th October 2014, 10:08
It seems some confuse the words "idea" and "solution". In a similar fashion some confuse the words "implement" and "copy".