Last active
July 2, 2020 18:26
-
-
Save terenty-rezman/cff8f34db9060033398a82e36c3cba10 to your computer and use it in GitHub Desktop.
QScrollBar over content
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# to have fancy transparent scrollbars over your content | |
# all you need is to adjust viewport margins with negative values like this: | |
# scroll_area = QScrollArea() | |
scroll_area.setViewportMargins(0, 0, -8, -8) | |
# also here are some styles to make your scrolbars even fancier: | |
QScrollBar:vertical { | |
border: none; | |
background-color: transparent; | |
width: 8px; | |
margin: 0px; | |
padding: 0px; | |
} | |
QScrollBar::add-page:vertical { | |
background: none; | |
} | |
QScrollBar::sub-page:vertical { | |
background: none; | |
} | |
QScrollBar:left-arrow:horizontal, QScrollBar::right-arrow:horizontal { | |
background: #ff0000; | |
} | |
QScrollBar:top-arrow:vertical, QScrollBar::bottom-arrow:vertical { | |
background: #555555; | |
} | |
QScrollBar::handle:vertical { | |
background: #AA666666; | |
min-height: 0px; | |
width: 10px; | |
} | |
QScrollBar::add-line { | |
border: none; | |
background: none; | |
height: 0px; | |
subcontrol-position: bottom; | |
subcontrol-origin: margin; | |
} | |
QScrollBar::sub-line { | |
border: none; | |
background: none; | |
height: 0px; | |
subcontrol-position: top; | |
subcontrol-origin: margin; | |
} | |
QScrollBar:horizontal { | |
border: none; | |
background-color: transparent; | |
height: 8px; | |
margin: 0px; | |
} | |
QScrollBar::handle:horizontal { | |
background: #AA666666; | |
height: 10px; | |
} | |
QScrollBar::add-page:horizontal { | |
background: none; | |
} | |
QScrollBar::sub-page:horizontal { | |
background: none; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment