Results 1 to 5 of 5

Thread: Transparent widget and their children widgets

  1. #1
    Join Date
    Jan 2011
    Location
    Australia
    Posts
    44
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Symbian S60

    Default Transparent widget and their children widgets

    Hi I have a transparent dialog box (windowOpacity = 0.5) and I have another dialog box who is (and has to be) child of this dialog.

    Is this possible to have full opacity just for that control? I know if I don't make it as child of the previous dialog, it does have full opacity but the reason why i want that to be child is because the parent is in full screen mode and I don't want any bars (for example unity bar in ubuntu) to display when modal dialog is shown as "orphan". I have tried following:
    Qt Code:
    1. //CODE IN PARENT CONSTRUCTOR
    2. dlgChild = new Dialog(this);
    3. dlgChild->setModal(true);
    4. dlgChild->setWindowFlags(Qt::WindowStaysOnTopHint);
    5. dlgChild->setWindowFlags(Qt::FramelessWindowHint);
    6. for (int i = 0; i < dlgChild->children().size(); i++) {
    7. QObject* child = dlgChild->children().at(i);
    8. static_cast<QWidget*>(child)->setWindowOpacity(1);
    9. }
    10. dlgChild->setWindowOpacity(1);
    11. dlgChild->show();
    To copy to clipboard, switch view to plain text mode 
    Life is like a dream, sometimes it is good and somtimes it is bad, but in the end it is over

  2. #2
    Join Date
    Jan 2011
    Location
    Australia
    Posts
    44
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Symbian S60

    Default Re: Transparent widget and their children widgets

    Anyone on this please?
    Life is like a dream, sometimes it is good and somtimes it is bad, but in the end it is over

  3. #3
    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: Transparent widget and their children widgets

    Opacity is inherited. If you make a widget semi-transparent, its children will be semi-transparent too. I suggest you look for an alternative approach to your problem.
    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.


  4. #4
    Join Date
    Jan 2011
    Location
    Australia
    Posts
    44
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Symbian S60

    Default Re: Transparent widget and their children widgets

    Can you suggest any? What would you do if you were me?
    Life is like a dream, sometimes it is good and somtimes it is bad, but in the end it is over

  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: Transparent widget and their children widgets

    Quote Originally Posted by naturalpsychic View Post
    Can you suggest any? What would you do if you were me?
    I don't know what your intention is so it is hard to suggest anything.
    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. Replies: 5
    Last Post: 18th March 2012, 22:18
  2. Replies: 3
    Last Post: 17th November 2010, 12:50
  3. Paintevent and transparent children
    By wishper in forum Newbie
    Replies: 2
    Last Post: 18th August 2010, 14:17
  4. Replies: 2
    Last Post: 31st May 2010, 11:57
  5. Replies: 2
    Last Post: 19th August 2008, 09:46

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.