Skip to content

Commit 03c9dfe

Browse files
committed
Make Remote Desktop tabs responsive at any window size
Wrap each Remote Desktop sub-tab in a ``QScrollArea`` with ``setWidgetResizable(True)`` (gui/remote_desktop/tab.py). This is the responsive-sizing piece the panels were missing: - On a small / shrunk window, dense tabs (especially the WebRTC pair, which still has 6+ groupboxes even after the AnyDesk popout removed the inline frame display) now scroll instead of clipping or crushing widgets together. - On an enlarged / 4K window, the panel widget grows horizontally with the viewport so the connection card and session table stretch to fill the available width instead of staying hard-clustered at the top-left. - The viewport's ``addStretch(1)`` at the bottom of each panel still pushes content up when there's leftover height, so the layout doesn't sag on huge displays. Also relax the WebRTC host's session-table cap: ``setMaximumHeight (140)`` was forcing the table to stay tiny even when the operator had plenty of room. Replace it with ``setMinimumHeight(140)`` so that's a starting hint, not a ceiling. Verified with ruff (clean) and the 589-test headless suite.
1 parent f444507 commit 03c9dfe

2 files changed

Lines changed: 36 additions & 3 deletions

File tree

je_auto_control/gui/remote_desktop/tab.py

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
"""``RemoteDesktopTab``: outer container holding host + viewer sub-tabs."""
22
from typing import Optional
33

4-
from PySide6.QtWidgets import QTabWidget, QVBoxLayout, QWidget
4+
from PySide6.QtCore import Qt
5+
from PySide6.QtWidgets import (
6+
QFrame, QScrollArea, QTabWidget, QVBoxLayout, QWidget,
7+
)
58

69
from je_auto_control.gui._i18n_helpers import TranslatableMixin
710
from je_auto_control.gui.remote_desktop._helpers import _t
@@ -12,13 +15,37 @@
1215
)
1316

1417

18+
def _wrap_in_scroll_area(panel: QWidget) -> QScrollArea:
19+
"""Drop ``panel`` into a resizable scroll area so it adapts.
20+
21+
``setWidgetResizable(True)`` lets the inner panel grow horizontally
22+
with the tab and only scroll vertically when its natural height
23+
exceeds the viewport. This is the responsive-sizing piece the
24+
panels were missing — a 4K user gets the panel filling the width,
25+
a laptop user gets a scrollbar instead of crushed widgets, and the
26+
middle ground "just works" without manual layout tweaks.
27+
"""
28+
scroll = QScrollArea()
29+
scroll.setWidget(panel)
30+
scroll.setWidgetResizable(True)
31+
scroll.setFrameShape(QFrame.Shape.NoFrame)
32+
scroll.setHorizontalScrollBarPolicy(
33+
Qt.ScrollBarPolicy.ScrollBarAsNeeded,
34+
)
35+
scroll.setVerticalScrollBarPolicy(
36+
Qt.ScrollBarPolicy.ScrollBarAsNeeded,
37+
)
38+
return scroll
39+
40+
1541
class RemoteDesktopTab(TranslatableMixin, QWidget):
1642
"""Outer container holding the host and viewer sub-tabs."""
1743

1844
def __init__(self, parent: Optional[QWidget] = None) -> None:
1945
super().__init__(parent)
2046
self._tr_init()
2147
layout = QVBoxLayout(self)
48+
layout.setContentsMargins(0, 0, 0, 0)
2249
self._tabs = QTabWidget()
2350
self._host_panel = _HostPanel()
2451
self._viewer_panel = _ViewerPanel()
@@ -31,7 +58,10 @@ def __init__(self, parent: Optional[QWidget] = None) -> None:
3158
(self._webrtc_viewer_panel, "rd_webrtc_viewer_tab"),
3259
]
3360
for panel, key in sub_panels:
34-
index = self._tabs.addTab(panel, _t(key))
61+
# Wrap each panel in a scroll area so the dense WebRTC tabs
62+
# remain usable on small screens and don't squash widgets
63+
# together on big monitors when the window is enlarged.
64+
index = self._tabs.addTab(_wrap_in_scroll_area(panel), _t(key))
3565
self._tr_tab(self._tabs, index, key)
3666
layout.addWidget(self._tabs)
3767
self._sub_panels = [panel for panel, _key in sub_panels]

je_auto_control/gui/remote_desktop/webrtc_panel.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,10 @@ def _build_ui(self) -> None:
283283
self._sessions_table.setEditTriggers(
284284
QAbstractItemView.EditTrigger.NoEditTriggers,
285285
)
286-
self._sessions_table.setMaximumHeight(140)
286+
# Hint at a comfortable starting height, but let the table
287+
# grow with the window instead of pinning it at 140 px even
288+
# when the operator has a 4K monitor's worth of space.
289+
self._sessions_table.setMinimumHeight(140)
287290
self._sessions_table.setSelectionBehavior(
288291
QAbstractItemView.SelectionBehavior.SelectRows,
289292
)

0 commit comments

Comments
 (0)