Mercurial > hg > tilerswift
changeset 96:a7e744200920
ScrollAreaWithVerticalBar: new class workaround
I am committing this because I can't figure out a better way.
https://stackoverflow.com/questions/57898865/why-is-qscrollarea-not-taking-vertical-scroll-bar-width-into-account
author | Jordi Gutiérrez Hermoso <jordigh@octave.org> |
---|---|
date | Thu, 12 Sep 2019 08:05:08 -0400 |
parents | 98d2871df3bf |
children | c575bdd3d087 |
files | tilerswift |
diffstat | 1 files changed, 9 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/tilerswift +++ b/tilerswift @@ -392,6 +392,13 @@ ) +class ScrollAreaWithVerticalBar(QW.QScrollArea): + def sizeHint(self): + hint = super().sizeHint() + bar_width = self.verticalScrollBar().sizeHint().width() + return QC.QSize(hint.width() + bar_width, hint.height()) + + class PaletteButton(ColourButton): def __init__(self, button_idx, colour_idx): @@ -413,7 +420,7 @@ self.tile_picker = TilePicker() self.colour_picker = ColourPicker() - scroll = QW.QScrollArea() + scroll = QW.QScrollArea(self) scroll.setWidget(self.tile_picker) self.setCentralWidget(scroll) @@ -427,7 +434,7 @@ self.grid_widget = ROMCanvas(rom) - scroll = QW.QScrollArea() + scroll = ScrollAreaWithVerticalBar(self) scroll.setWidget(self.grid_widget) self.toolbar = QW.QHBoxLayout()