Results 1 to 4 of 4

Thread: How to set QBrush half transparent ?

  1. #1
    Join Date
    Jul 2013
    Posts
    72
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default How to set QBrush half transparent ?

    When QBrush uses setTexture(QPixmap &), how to set it transparent ?
    I have tried this :
    QPixmap pix("D:/1.png");
    QBitmap mask= pix.createMaskFromColor(QColor(255,0,255),Qt::Mask InColor);
    pix.setMask(mask);

    it doesn't work.

  2. #2
    Join Date
    Mar 2014
    Posts
    3
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Re: How to set QBrush half transparent ?

    Try setting QColor's alpha-channel: http://qt-project.org/doc/qt-4.8/qcolor.html#QColor-2

  3. #3
    Join Date
    Jul 2013
    Posts
    72
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: How to set QBrush half transparent ?

    o , how ,exactly ?

  4. #4
    Join Date
    Mar 2014
    Posts
    3
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Re: How to set QBrush half transparent ?

    QColor(255,0,255,128)

Similar Threads

  1. Half-resizable window
    By evergreen in forum Qt Programming
    Replies: 7
    Last Post: 15th September 2011, 13:06
  2. QGraphicsDropShadowEffect is half baked?
    By liversedge in forum Qt Programming
    Replies: 1
    Last Post: 4th June 2011, 20:59
  3. Qt Widgets seen half transparent when using stylesheets
    By codeslicer in forum Qt Programming
    Replies: 5
    Last Post: 14th December 2010, 09:52
  4. Why QGraphicsItem moveing is valid in half?
    By litterflybug in forum Qt Programming
    Replies: 2
    Last Post: 13th December 2009, 13:14
  5. color one half of the button?
    By tommy in forum Qt Programming
    Replies: 4
    Last Post: 26th December 2007, 19:42

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
  •  
Qt is a trademark of The Qt Company.