Results 1 to 8 of 8

Thread: QWidget inside QGroupbox semi transparent [Qt 4.3.1]

  1. #1
    Join Date
    Jul 2006
    Posts
    37
    Thanks
    6
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default QWidget inside QGroupbox semi transparent [Qt 4.3.1]

    Hi everybody,

    I know opacity and semi transparency was a subject mainly discussed, but I haven't found what I'm looking for

    I try to set transparency to 0.5 with Qpainter::setOpacity(0.5) to widgets inside a QGroupbox; list of widgets could be any kind of Qt classical Widgets(QSlider, QComboBox, QPushButton, ...)

    I didn't succeed to set QGroupbox transparency to all child widgets.

    I'm afraid, I have to customize all PainEvent of All widgets inserted in QGroupBox, isn't it?

    Tell me if I should give up since I have no idea about the widget type inserted through QGroupbox (for the moment).

    Thanks for your help,

    David

  2. #2
    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: QWidget inside QGroupbox semi transparent [Qt 4.3.1]

    Can we see a screenshot?

  3. #3
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QWidget inside QGroupbox semi transparent [Qt 4.3.1]

    Will QWidget::setWindowOpacity() work in ur case ??
    you can try it on group box...

  4. #4
    Join Date
    Jul 2006
    Posts
    37
    Thanks
    6
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: QWidget inside QGroupbox semi transparent [Qt 4.3.1]

    the setWindowOpacity is used for top-level Widget; the aim is to get a standalone widget able to take an opacity different at 0.5 and able to transmit this transparency to all any child widget inside....I attached the picture

    this was obtained with this code to the subclass of QGroupBox
    Qt Code:
    1. void CMyGroupBox::paintEvent(QPaintEvent *)
    2. {
    3. QStylePainter paint(this);
    4. initStyleOption(&option);
    5. paint.setOpacity(0.25);
    6. paint.drawComplexControl(QStyle::CC_GroupBox, option);
    7. }
    To copy to clipboard, switch view to plain text mode 
    Attached Images Attached Images

  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: QWidget inside QGroupbox semi transparent [Qt 4.3.1]

    And you want everything to be semi-transparent? Or just the children of the window? Or a specific child?

  6. #6
    Join Date
    Jul 2006
    Posts
    37
    Thanks
    6
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: QWidget inside QGroupbox semi transparent [Qt 4.3.1]

    the best is to set all children of Qgroupbox Semi transparent;

    but more I search , more I understand I have to subclass all children I would like to insert into the QGroupbox

  7. #7
    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: QWidget inside QGroupbox semi transparent [Qt 4.3.1]

    It might be easier to use QWidget::render() to get a pixmap of the item and its children and then render the result with opacity of your choice on the destination window.

  8. #8
    Join Date
    Feb 2009
    Posts
    1
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QWidget inside QGroupbox semi transparent [Qt 4.3.1]

    Quote Originally Posted by wysota View Post
    It might be easier to use QWidget::render() to get a pixmap of the item and its children and then render the result with opacity of your choice on the destination window.
    do you have any ideas how to do this?
    the rendering is not a problem,
    but how to render results??

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.