Results 1 to 3 of 3

Thread: setMask and setBrush problem using png with shadow

  1. #1
    Join Date
    Jun 2007
    Location
    italy
    Posts
    126
    Thanks
    15
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default setMask and setBrush problem using png with shadow

    Hi all,
    I need your help to understand why may code is not able to load correctly a png image with shadow (that you can see attached) whan I try to set it in a QMainWindows with custom shape..

    Code follows:

    Qt Code:
    1. setMask((new QPixmap(":/dike5prova/logoic_big.png"))->mask());
    2. QPalette* palette = new QPalette();
    3. palette->setBrush(QPalette::Window,*(new QBrush(*(new QPixmap(":/dike5prova/logoic_big.png")))));
    4. setPalette(*palette);
    5. setWindowFlags(Qt::FramelessWindowHint);
    6. QWidget *centralWidget = new QWidget(this);
    To copy to clipboard, switch view to plain text mode 

    it works well with normal png..
    but using that one I'm not able to see the shadow correctly, only a black stripe..

    How Can I correct my code ?

    Many thanks in advance,
    Roberto
    logoic_big_shadow.jpg

  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: setMask and setBrush problem using png with shadow

    Where is the code you posted located in - in which class? is it in a QMainWindow subclass?
    ==========================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
    Jun 2007
    Location
    italy
    Posts
    126
    Thanks
    15
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Post Re: setMask and setBrush problem using png with shadow

    it is in the MainWindows..

    myExample::myExample()
    {

    here..

    }


    class myExample: public QMainWindow
    {
    Q_OBJECT

    public:
    myExample();

    ...

    }

Similar Threads

  1. Text drop-shadow using CSS (text-shadow)
    By xtal256 in forum Qt Programming
    Replies: 2
    Last Post: 13th July 2018, 10:08
  2. QMake problem when using INSTALL and a shadow build directory
    By superpacko in forum Qt Tools
    Replies: 0
    Last Post: 6th September 2011, 15:43
  3. setMask (smooth)
    By pakulo in forum Qt Programming
    Replies: 2
    Last Post: 15th May 2007, 08:51
  4. QT 4.2 widget setmask problem
    By PiXeL16 in forum Qt Programming
    Replies: 16
    Last Post: 2nd March 2007, 07:09
  5. QPixmap::setMask() / QWidget::setMask()
    By yogeshm02 in forum Qt Programming
    Replies: 1
    Last Post: 25th February 2006, 11:34

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.