Results 1 to 4 of 4

Thread: Transparent dialog widget

  1. #1
    Join Date
    Mar 2010
    Location
    Kawasaki, Japan
    Posts
    13
    Qt products
    Qt/Embedded Qt Jambi
    Platforms
    Symbian S60

    Default Transparent dialog widget

    Hi all,

    I am working on Qt 4.6.2 for Symbian.
    I am trying to make a dialog transparent.
    I have tried the following:
    1. example at http://wiki.forum.nokia.com/index.ph...stWidget_in_Qt - setting attribute Qt::WA_NoSystemBackground
    2. Drawing a bitmap and its mask to the dialog
    3. setAttribute(Qt::WA_TranslucentBackground, true)

    But none of these options seems to make the dialog transparent.

    My understanding is that the dialog is a window owning control and this window is not able to be transparent.

    If anybody has tried such a thing and has a different understanding or has achieved this please let me know.

    Regards
    Girish

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Transparent dialog widget

    Try this: (some text otherwise the message it too short to post)
    Creating Translucent Windows

    Since Qt 4.5, it has been possible to create windows with translucent regions on window systems that support compositing.

    To enable this feature in a top-level widget, set its Qt::WA_TranslucentBackground attribute with setAttribute() and ensure that its background is painted with non-opaque colors in the regions you want to be partially transparent.

    Platform notes:

    * X11: This feature relies on the use of an X server that supports ARGB visuals and a compositing window manager.
    * Windows: The widget needs to have the Qt::FramelessWindowHint window flag set for the translucency to work.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. #3
    Join Date
    Mar 2010
    Location
    Kawasaki, Japan
    Posts
    13
    Qt products
    Qt/Embedded Qt Jambi
    Platforms
    Symbian S60

    Default Re: Transparent dialog widget

    Thank you for the reply.
    I have tried this as follows:
    Qt Code:
    1. setAttribute(Qt::WA_TranslucentBackground, true);
    2. setStyleSheet(KDialogStyle);//where KDialogStyle = "QDialog {color: rgb(32, 37, 240); border: 1px solid #FFFFFF;border-radius: 6px; background-color: rgba(220, 150, 220, 155); }"
    To copy to clipboard, switch view to plain text mode 

    But this does not work - the window gets a new color but it is no where near to the color I have set, nor the default color.
    Also the default background is seen on the borders of the dialog.
    Either I am missing something, or this feature is not yet supported in Qt for Symbian.

    My understanding:
    To make a window transparent/translucent in Symbian, the window will have to do something like this

    Qt Code:
    1. Window().SetRequiredDisplayMode(EColor16MA);
    2. Window().SetTransparencyFactor(0);
    3. TRgb backgroundColour = KRgbWhite;
    4. if(KErrNone == Window().SetTransparencyAlphaChannel())
    5. {
    6. backgroundColour.SetAlpha(155);//set a value from 0 to 255
    7. }
    8. Window().SetBackgroundColor(backgroundColour);
    To copy to clipboard, switch view to plain text mode 

    I checked the Qt code to find such a thing. But it is not present anywhere.
    I am trying to modify the Qt code....

    If there are any Qt developers on the forum - who has developed Qt for Symbian, please confirm if this feature is supported.

  4. #4
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Transparent dialog widget

    But this does not work - the window gets a new color but it is no where near to the color I have set, nor the default color.
    I would not say it doesn't work - doesn't work is when nothing happens.
    But your code does change things, and even changes colors, just not the ones you thought will come out.
    This can have various reasons, from an error on your part, to a visual effect created through translucency, where colors mix because they are translucent.

    Hard to say.
    Probably the key is in:
    Since Qt 4.5, it has been possible to create windows with translucent regions on window systems that support compositing.
    The question is if and how this feature is implemented in Symbian.

    I have no experience on Symbian, maybe other forum members can help you more with Symbian specifics.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

Similar Threads

  1. Transparent Dialog
    By wirasto in forum Qt Programming
    Replies: 4
    Last Post: 12th November 2009, 11:21
  2. Qt transparent Widget
    By Vipin Vijayan in forum Qt Programming
    Replies: 2
    Last Post: 27th January 2009, 13:33
  3. Update to 4.4.2 - Now I Have A Transparent Dialog
    By mclark in forum Qt Programming
    Replies: 10
    Last Post: 6th October 2008, 21:11
  4. Qt4.1 Transparent Widget
    By djoul in forum Qt Programming
    Replies: 14
    Last Post: 26th September 2006, 17:06
  5. transparent widget
    By hijinks in forum Qt Programming
    Replies: 2
    Last Post: 20th February 2006, 10:43

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.