Results 1 to 2 of 2

Thread: How to transparent QIconView

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2008
    Posts
    49
    Thanks
    2
    Thanked 4 Times in 1 Post

    Default How to transparent QIconView

    Hello, everybody here..

    I have a critical problem.
    I want to make the background of QIconView transparent.
    I had tried some things below, but all of them doesn't work!!!
    1. set background origin, this works for QLabel , etc, but not for QIconView
    Qt Code:
    1. setBackgroundOrigin(QWidget::ParentOrigin);
    2. viewport()->setBackgroundOrigin(QWidget::ParentOrigin);
    To copy to clipboard, switch view to plain text mode 
    2. set backgroundMode, but get i background fill with black, not i want
    Qt Code:
    1. viewport()->setBackgroundMode(Qt::NoBackground)
    2. setBackgroundMode(Qt::NoBackground);
    To copy to clipboard, switch view to plain text mode 
    3. use setMask, causes some X errors ? I don't know what it is. it seems critical.
    Qt Code:
    1. void MyIconView::updateMask()
    2. {
    3. QBitmap bm( size() );
    4. bm.fill( color0 );
    5.  
    6. QRect cr = contentsRect();
    7. QPainter paint;
    8. paint.begin( &bm, this );
    9. paint.setBrush( color1 );
    10. paint.setPen( color1 );
    11.  
    12. drawContents(&paint, cr.x(), cr.y(), cr.width(), cr.heigth()); // this cause some X error (invalid match.....some thing like this ... QT debug many things )
    13.  
    14. paint.end();
    15. setMask( bm );
    16. }
    To copy to clipboard, switch view to plain text mode 

    I can not find out a way to go through this function.
    Any idea?

    Thanks ...

    /WX
    Last edited by wesley; 8th April 2009 at 04:28.

Similar Threads

  1. How to set Qt window transparent?
    By montylee in forum Qt Programming
    Replies: 17
    Last Post: 24th December 2013, 20:11
  2. leaveEvent on transparent area issue
    By nooky59 in forum Qt Programming
    Replies: 10
    Last Post: 8th January 2008, 13:22
  3. Regarding drawing on Transparent Window
    By Shalabh in forum Qt Programming
    Replies: 3
    Last Post: 31st May 2007, 10:32
  4. Replies: 3
    Last Post: 8th December 2006, 18:51
  5. Replies: 3
    Last Post: 27th July 2006, 12:48

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.