Results 1 to 3 of 3

Thread: Transparent Widgets and alpha blending

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    Join Date
    Aug 2008
    Location
    Algarve, Portugal
    Posts
    288
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60
    Thanks
    23
    Thanked 32 Times in 28 Posts

    Default Re: Transparent Widgets and alpha blending

    You have to set attributes in the constructor of your widget

    Qt Code:
    1. setAttribute(Qt::WA_TranslucentBackground,true);
    2. setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint );
    3. setWindowOpacity(0.5);
    4.  
    5. bool t=testAttribute ( Qt::WA_TranslucentBackground);
    6. qDebug()<<t;
    To copy to clipboard, switch view to plain text mode 

    The Qt::WA_TranslucentBackground is mandatory, the other flags I dont remember if they are, check the Qt documentation. Also, in linux, you have to enable transparency in your X-window system. In my machine, without compiz enabled, it doenst work, but with compiz works fine.
    __________________________________________________
    My projects: calculator MathGraphica ; SuperEpicMegaHero game ; GooglePlay ; bitbucket ; github
    Like my projects ? Buy me a kofi

  2. The following user says thank you to john_god for this useful post:

    idoroth (16th October 2011)

Similar Threads

  1. Replies: 0
    Last Post: 8th November 2010, 22:17
  2. Replies: 2
    Last Post: 31st May 2010, 12:57
  3. Replies: 1
    Last Post: 18th September 2009, 11:32
  4. Alpha blending..
    By chethana in forum Qt Programming
    Replies: 1
    Last Post: 9th October 2007, 11:15
  5. Transparent widgets
    By incapacitant in forum Newbie
    Replies: 10
    Last Post: 21st March 2006, 19:01

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
  •  
Qt is a trademark of The Qt Company.