Results 1 to 5 of 5

Thread: How to draw a text with drop shadow in the image using QPainter ?

  1. #1
    Join Date
    Oct 2014
    Posts
    4
    Qt products
    Qt4 Qt5 Qt/Embedded PyQt3 PyQt4
    Platforms
    MacOS X Unix/X11 Windows Android

    Question How to draw a text with drop shadow in the image using QPainter ?

    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.

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: How to draw a text with drop shadow in the image using QPainter ?


  3. #3
    Join Date
    Oct 2014
    Posts
    4
    Qt products
    Qt4 Qt5 Qt/Embedded PyQt3 PyQt4
    Platforms
    MacOS X Unix/X11 Windows Android

    Exclamation Re: How to draw a text with drop shadow in the image using QPainter ?

    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.

  4. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: How to draw a text with drop shadow in the image using QPainter ?

    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.

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to draw a text with drop shadow in the image using QPainter ?

    It seems some confuse the words "idea" and "solution". In a similar fashion some confuse the words "implement" and "copy".
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Text drop-shadow using CSS (text-shadow)
    By xtal256 in forum Qt Programming
    Replies: 2
    Last Post: 13th July 2018, 10:08
  2. Draw line on image using QPainter
    By Qt Coder in forum Qt Programming
    Replies: 29
    Last Post: 11th August 2015, 12:09
  3. Replies: 10
    Last Post: 14th September 2011, 10:08
  4. QPainter::drawText, draw big text
    By franco.amato in forum Newbie
    Replies: 3
    Last Post: 18th March 2010, 08:32
  5. How to draw soft shadow with QPainter?
    By troorl_ua in forum Qt Programming
    Replies: 9
    Last Post: 13th October 2008, 13:01

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.