Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Set style for QScrollArea's viewport

Set style for QScrollArea's viewport

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 2.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    goocreations
    wrote on last edited by
    #1

    I'm trying to style the viewport of a custom QScrollArea as follows:

    @setStyleSheet("QScrollArea > QWidget > QWidget{background:transparent;}");@

    Which successfully styles the vieport, but also the scroll bar (which I don't want to do). So I tried the following to only style the viewport and not the bar:

    @setStyleSheet("QScrollArea > QWidget > .QWidget{background:transparent;}");@

    But that didn't do anything at all. So I tried to style the viewport directly:

    @viewport()->setStyleSheet("QWidget{background:transparent;}");@

    Which works, but it also styles all the child widgets in the viewport, so I tried:

    @viewport()->setStyleSheet(".QWidget{background:transparent;}");@

    Which again didn't style it at all. So my question: is the viewport actually a QWidget or is it one of QWidget's subclasses, since I'm unable to style it by using .QWidget. If it is a QWidget, what am I doing wrong, why doesn't the viewport style (without affecting the child widgets and the scroll bar).

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved