Results 1 to 4 of 4

Thread: QScrollArea transparent

  1. #1
    Join Date
    Jan 2007
    Location
    Paris
    Posts
    459
    Thanks
    98
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4 Qt5

    Default QScrollArea transparent

    I want my QScrollArea background to be transparent.

    Any ideas?

  2. #2
    Join Date
    Jan 2007
    Location
    Paris
    Posts
    459
    Thanks
    98
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4 Qt5

    Default Re: QScrollArea transparent

    I've subclassed QScrollArea adding the following statement.

    Qt Code:
    1. QPalette p(viewport()->palette());
    2. p.setBrush(QPalette::Window, Qt::NoBrush);
    3. viewport()->setPalette(p);
    To copy to clipboard, switch view to plain text mode 

    Unfortunately it kills the performances.
    Is there a Faster way ?

    Mr Arnaud.

  3. #3
    Join Date
    Jan 2007
    Location
    Paris
    Posts
    459
    Thanks
    98
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4 Qt5

    Default Re: QScrollArea transparent

    I guess I'm going to code my own optimized QScrollArea....

  4. #4
    Join Date
    Jan 2006
    Location
    Boston, MA
    Posts
    40
    Thanks
    1
    Thanked 6 Times in 6 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QScrollArea transparent

    Didn't notice any performance problem:
    Qt Code:
    1. ...
    2. QPalette palette = this->palette();
    3. palette.setColor(QPalette::Window, QColor::fromRgb(255,255,255,0));
    4.  
    5. QScrollArea *negativeArea = new QScrollArea(dockNegativePanel);
    6. componentNegative = new ComponentPanel("Negative", negativeArea);
    7. negativeArea->setWidget(componentNegative);
    8. negativeArea->setPalette(palette);
    9. negativeArea->setBackgroundRole(QPalette::Window);
    10. ...
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. leaveEvent on transparent area issue
    By nooky59 in forum Qt Programming
    Replies: 10
    Last Post: 8th January 2008, 13:22
  2. QScrollArea and resizing
    By rarefluid in forum Qt Programming
    Replies: 8
    Last Post: 22nd July 2007, 14:18
  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: 2
    Last Post: 8th October 2006, 20:14

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.