Results 1 to 3 of 3

Thread: Transparency problems with system tray in Windows

  1. #1
    Join Date
    Dec 2007
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Transparency problems with system tray in Windows

    I use a class named SvgIconEngine that is subclassed from QIconEngineV2 to paint the system tray's (QSystemTrayIcon) icon.

    Qt Code:
    1. SvgIconEngine *engine = new SvgIconEngine;
    2. engine->loadSvgFromFile(":/icon.svg");
    3. mSysTray->setIcon(QIcon(engine) ); // mSysTray = QSystemTrayIcon
    To copy to clipboard, switch view to plain text mode 

    The paint code is the following:

    Qt Code:
    1. void SvgIconEngine::paint(QPainter *painter, const QRect& rect,
    2. QIcon::Mode mode, QIcon::State state)
    3. {
    4. mRenderer.render(painter, rect); // mRenderer = QSvgRenderer object
    5. }
    To copy to clipboard, switch view to plain text mode 

    In Windows XP I have this problem:


    Where there should be the transparency there are some weird colorful pixels which undoubtedly are not part of system tray's background.

    I have this problem only in Windows. In Linux/KDE everything works perfectly.

    Anyone has an idea?
    Last edited by lliehu; 8th December 2007 at 15:34. Reason: made it clear I'm using QSystemTrayIcon

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Transparency problems with system tray in Windows

    Does it have any effect if you insert the following line:
    Qt Code:
    1. void SvgIconEngine::paint(QPainter *painter, const QRect& rect,
    2. QIcon::Mode mode, QIcon::State state)
    3. {
    4. painter->fillRect(rect, Qt::transparent); // <---
    5. mRenderer.render(painter, rect); // mRenderer = QSvgRenderer object
    6. }
    To copy to clipboard, switch view to plain text mode 
    ?

    PS. Attach images instead of using links to external sites, please.
    J-P Nurmi

  3. #3
    Join Date
    Dec 2007
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Transparency problems with system tray in Windows

    Quote Originally Posted by jpn View Post
    Does it have any effect if you insert the following line:
    Qt Code:
    1. painter->fillRect(rect, Qt::transparent); // <---
    To copy to clipboard, switch view to plain text mode 
    ?

    PS. Attach images instead of using links to external sites, please.
    No it doesn't. But thanks. And I didn't know you can attach an image. I'll do that next time.

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.