Results 1 to 2 of 2

Thread: Alpha background color though stylesheets on standalone dialogs / widgets

  1. #1
    Join Date
    Sep 2009
    Posts
    3
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Alpha background color though stylesheets on standalone dialogs / widgets

    Hi,

    I seem to have a weird problem. I am hoping for some pointers.

    Goal
    -----

    1. A Tray Icon
    2. No Main Window
    3. Launch standalone widgets / dialogs based on action chosen from the tray icon menu.

    Issue that I am facing
    --------------------------

    I would like to have a background with an alpha component. For my widgets / dialogs.
    If I set my style-sheet to "background-color:rgb(0,0,0)", things are fine. However, If I try "background-color:rgba(0,0,0,200)" or something like that, I just get a completely transparent widget / dialog.

    This style-sheet (along with alpha) works on QMainWindow which comes with a default UI application in the QtCreator.

    I tried the style-sheet both from the Form Designer and by setting the style-sheet in code. It doesn't seem to make any difference.

    Any pointers on what I might be doing wrong ? I know I can override the paintEvent method and get whatever I want, but it would be far more complicated and time consuming.

    Thank you.

    Note: I am using Qt 4.5.2 on Snow Leopard (I tried some of these experiments on Windows and it didn't help)

    Bharat Varma

  2. #2
    Join Date
    Dec 2007
    Posts
    628
    Thanks
    3
    Thanked 89 Times in 87 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Alpha background color though stylesheets on standalone dialogs / widgets

    I suggest you to go through shaped clock example. This is quite similar with your goals. And you can use QWidget::setWindowOpacity() too.

  3. The following user says thank you to yogeshgokul for this useful post:

    bharat (18th September 2009)

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.