Skip to content

Commit

Permalink
SideTabContainer: Set size policy for the container scrollarea contai…
Browse files Browse the repository at this point in the history
…ner widget
  • Loading branch information
loathingKernel committed Apr 16, 2023
1 parent 54915c5 commit 6b5a87c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions rare/components/tabs/games/game_info/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ def keyPressEvent(self, e: QKeyEvent):
class GameMetadataView(QTreeView, SideTabContents):
def __init__(self, parent=None):
super(GameMetadataView, self).__init__(parent=parent)
self.implements_scrollarea = True
self.setColumnWidth(0, 300)
self.setWordWrap(True)
self.model = QJsonModel()
Expand Down
5 changes: 3 additions & 2 deletions rare/widgets/side_tab.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
QTabBar,
QTabWidget,
QVBoxLayout,
QScrollArea, QLayout,
QScrollArea, QLayout, QSizePolicy,
)

from rare.utils.misc import icon as qta_icon
Expand Down Expand Up @@ -100,13 +100,14 @@ def __init__(self, widget: Union[QWidget, SideTabContentsProtocol], title: str =

if not hasattr(widget, "implements_scrollarea") or not widget.implements_scrollarea:
self.scrollarea = QScrollArea(self)
self.scrollarea.setWidgetResizable(True)
self.scrollarea.setSizeAdjustPolicy(QScrollArea.AdjustToContents)
self.scrollarea.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
self.scrollarea.setFrameStyle(QScrollArea.NoFrame)
self.scrollarea.setMinimumWidth(
widget.sizeHint().width() + self.scrollarea.verticalScrollBar().sizeHint().width()
)
self.scrollarea.setWidgetResizable(True)
widget.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
self.scrollarea.setWidget(widget)
layout.addWidget(self.scrollarea)
else:
Expand Down

0 comments on commit 6b5a87c

Please sign in to comment.