Results 1 to 2 of 2

Thread: How to draw semi-transparent text.

  1. #1
    Join Date
    Mar 2010
    Posts
    7
    Qt products
    Qt4
    Platforms
    Windows

    Question How to draw semi-transparent text.

    Hey guys:
    I have a widget inherited from the QWidget class, and in it's paintEvent method I try to draw some text with the function of drawText, but I want to make the text fade in and out. I've got how to use QTimeLine, so the problem left is how to set the opacity of the text.
    Any advice is highly appreciated. Thanks in advance.

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: How to draw semi-transparent text.

    For drawing text the QPen is important you set to the painter. And for that pen you can define a color with an alpha channel. (Or modify the whole opacity of the widget.)

    See QPen::setColor() with QColor::QColor ( int r, int g, int b, int a = 255 )

Similar Threads

  1. Semi-transparent QDrag pixmap
    By Jugdish in forum Qt Programming
    Replies: 0
    Last Post: 1st October 2009, 11:10
  2. Can QDockWidget be semi-transparent?
    By PolyVox in forum Qt Programming
    Replies: 3
    Last Post: 17th March 2009, 20:09
  3. Non-transparent QWidget on semi-transparent parent
    By EuroElessar in forum Qt Programming
    Replies: 0
    Last Post: 29th August 2008, 16:20
  4. qt4.3 semi-transparent widgets winxp
    By kernel_panic in forum Qt Programming
    Replies: 2
    Last Post: 19th July 2007, 06:25
  5. Semi transparent QDialog
    By cs_raja in forum Qt Programming
    Replies: 3
    Last Post: 23rd May 2007, 10:14

Tags for this Thread

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.