×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Regular Contributor
    Join Date
    Aug 2010
    Posts
    50

    Question how to set transparent background for QStyleOptionButton ?

    I want to set the button with transparent background while I paint the button by
    Code:
    QApplication::style()->drawControl(QStyle::CE_PushButton,&buttonOption, painter);
    I know use the style sheet
    Code:
    setStyleSheet("QPushButton{background: transparent;}");
    can make the background transparent. But how to set stylesheet for the QStyleOptionButton? Or other ways for set transparent background for QStyleOptionButton ?

  2. #2
    Super Contributor
    Join Date
    Jan 2008
    Location
    Bangalore, India
    Posts
    777

    Re: how to set transparent background for QStyleOptionButton ?

    have a look on that, it might be helpful,
    http://doc.qt.nokia.com/latest/widgets-styles.html
    Regards
    $-Nitesh-$

  3. #3
    Nokia Developer Expert
    Join Date
    Feb 2008
    Posts
    183

    Re: how to set transparent background for QStyleOptionButton ?

    You don't set stylesheets for QStyleOptions, you set stylesheets from QWidgets. StyleOptions are "utility" class for the styles to draw the widget.
    In case you already have instance of (or can access) QStyleOption, then you can simply modify the palette variable, In this specific case, just set the QPalette::Background and set it to Qt::transparent.
    Be prepared for strange looking button.
    In case, you want to control the opacity of the widget, just modify you QPainter instance.

  4. #4
    Regular Contributor
    Join Date
    Aug 2010
    Posts
    50

    Re: how to set transparent background for QStyleOptionButton ?

    Thanks for quick reply . I will try to use the Palette to set the background.

Similar Threads

  1. Replies: 1
    Last Post: 2010-03-22, 07:54
  2. Transparent background
    By santinomazza in forum Symbian
    Replies: 3
    Last Post: 2009-03-01, 18:45
  3. Replies: 2
    Last Post: 2009-01-22, 06:03
  4. Transparent background, how?
    By doesitmatter in forum Symbian
    Replies: 1
    Last Post: 2008-01-11, 21:50
  5. Transparent background
    By nadav70 in forum Symbian User Interface
    Replies: 4
    Last Post: 2007-12-08, 23:42

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×