# HG changeset patch # User Jordi GutiƩrrez Hermoso # Date 1568289908 14400 # Node ID a7e744200920172ef52a0bf2f2639928bde4ec85 # Parent 98d2871df3bfd76b0da8cddde320aad99144c7f4 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 diff --git a/tilerswift b/tilerswift --- 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()