Results 1 to 5 of 5

Thread: QScrollArea with transparent background

  1. #1
    Join Date
    Jul 2013
    Posts
    22
    Thanks
    10
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default QScrollArea with transparent background

    I would like to check if I'm doing it correctly. Advises are welcome.

    I have a set o widgets which I want to layout horizontally, as they are many and occupies lot of space I use a QScrollArea to accommodate them.

    Then I put the QWidget which has the QScrollArea in another QWidget.

    And finally, that last QWidget is inserted in a QTabWidget.

    The problem I see is:

    The tabWidget has a white background and the scrollAreaWidgetContents has a gray background. With the intention of solve this I tried ui->scrollAreaWidgetContents->setAttribute(Qt::WA_TranslucentBackground), but all the scrollArea contents get trashed when moving the scroll.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QScrollArea with transparent background

    What exactly is the effect you want to obtain? Do you wish to get rid of the gray background?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Jul 2013
    Posts
    22
    Thanks
    10
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QScrollArea with transparent background

    Yes, exactly.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QScrollArea with transparent background

    Did you try setting the background color to Qt::Transparent or making sure autofillBackground is set to false? In general I tried to repeat the problem you are having using Qt Designed but everything works for me as expected. Can you provide a minimal compilable example reproducing the problem?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Jul 2013
    Posts
    22
    Thanks
    10
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QScrollArea with transparent background

    Please find a compilable example attached.

    I tried both. Setting the background color to Qt::Transparent makes even the buttons and scrollbar transparent, which I didn't want.
    Attached Files Attached Files

Similar Threads

  1. QScrollArea misbehaving background style
    By Cruz in forum Qt Programming
    Replies: 6
    Last Post: 7th March 2021, 21:46
  2. Replies: 4
    Last Post: 27th November 2013, 15:15
  3. transparent QScrollArea and blurry scrolling
    By titanandrews in forum Qt Programming
    Replies: 2
    Last Post: 17th January 2010, 00:35
  4. QScrollArea transparent
    By bunjee in forum Qt Programming
    Replies: 3
    Last Post: 23rd June 2008, 13:55
  5. Transparent background on QLabel on transparent QWidget
    By codeslicer in forum Qt Programming
    Replies: 1
    Last Post: 13th February 2008, 02:10

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.