Scale plot tab to fill available window space at fullscreen

Removed the QScrollArea wrapper and fixed figure-height calculation.
FigureCanvasQTAgg now fills the tab with an Expanding size policy so
all 8 subplots fit in the visible area at 1920x1200 without scrolling.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-25 20:34:16 +02:00
co-authored by Claude Sonnet 4.6
parent 1b0a8670e5
commit 2bbfcc7084
+4 -18
View File
@@ -22,7 +22,7 @@ from PyQt5.QtCore import QObject, Qt, pyqtSignal
from PyQt5.QtGui import QColor, QFont
from PyQt5.QtWidgets import (
QApplication, QFormLayout, QGroupBox, QHBoxLayout, QLabel,
QLineEdit, QMainWindow, QPushButton, QScrollArea, QSizePolicy,
QLineEdit, QMainWindow, QPushButton, QSizePolicy,
QSpinBox, QStatusBar, QTabWidget, QTreeWidget, QTreeWidgetItem,
QVBoxLayout, QWidget,
)
@@ -34,7 +34,6 @@ from matplotlib.figure import Figure
MAX_PLOT_POINTS = 200
PLOT_COLS = 2
PLOT_ROW_INCHES = 3.0
# ── TCP reader ────────────────────────────────────────────────────────────────
@@ -273,22 +272,13 @@ class DashboardTab(QWidget):
class PlotTab(QWidget):
def __init__(self):
super().__init__()
outer = QVBoxLayout(self)
outer.setContentsMargins(0, 0, 0, 0)
scroll = QScrollArea()
scroll.setWidgetResizable(True)
outer.addWidget(scroll)
container = QWidget()
inner = QVBoxLayout(container)
inner.setContentsMargins(4, 4, 4, 4)
scroll.setWidget(container)
layout = QVBoxLayout(self)
layout.setContentsMargins(4, 4, 4, 4)
self._fig = Figure(tight_layout=True)
self._canvas = FigureCanvas(self._fig)
self._canvas.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
inner.addWidget(self._canvas)
layout.addWidget(self._canvas)
self._series: dict[str, deque] = {} # path → deque[(datetime, float)]
self._units: dict[str, str] = {} # path → unit string
@@ -330,10 +320,6 @@ class PlotTab(QWidget):
self._fig.clear()
self._axes = {}
height = max(3.0, rows * PLOT_ROW_INCHES)
self._fig.set_size_inches(10, height)
self._canvas.setMinimumHeight(int(height * self._fig.dpi))
for i, k in enumerate(keys):
ax = self._fig.add_subplot(rows, cols, i + 1)
label = k.split(".")[-1]