From 58d4b24bd1089d6d4b9fbe3d33252485f0a1155d Mon Sep 17 00:00:00 2001 From: Honney OC Date: Sun, 13 Sep 2026 22:59:50 +0000 Subject: [PATCH] fix: use QWidget video container and disable linked plot auto-range --- verify_sync.py | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/verify_sync.py b/verify_sync.py index 2e0199f..d0758e6 100644 --- a/verify_sync.py +++ b/verify_sync.py @@ -219,11 +219,11 @@ class VerifyWindow(QtWidgets.QMainWindow): lay = QtWidgets.QVBoxLayout(central) lay.setSpacing(2) - # ── Video display (QVideoWidget) ── - self.video_widget = QtMultimediaWidgets.QVideoWidget() - self.video_widget.setMinimumHeight(300) - self.video_widget.setStyleSheet("background: #000;") - lay.addWidget(self.video_widget, stretch=4) + # ── Video display (QWidget container) ── + self.video_container = QtWidgets.QWidget() + self.video_container.setMinimumHeight(300) + self.video_container.setStyleSheet("background: #000;") + lay.addWidget(self.video_container, stretch=4) # ── Timeline seek bar ── time_row = QtWidgets.QHBoxLayout() @@ -284,6 +284,13 @@ class VerifyWindow(QtWidgets.QMainWindow): self.p_a.setXLink(self.p_comb) self.p_b.setXLink(self.p_comb) + # Disable auto-range on all plots to prevent overflow on linked axes + self.p_comb.getViewBox().setAutoVisible(y=False) + self.p_a.getViewBox().setAutoVisible(y=False) + self.p_b.getViewBox().setAutoVisible(y=False) + for p in [self.p_comb, self.p_a, self.p_b]: + p.enableAutoRange(axis='x', enable=False) + p.enableAutoRange(axis='y', enable=False) lay.addWidget(self.gw_dual, stretch=2) @@ -343,11 +350,9 @@ class VerifyWindow(QtWidgets.QMainWindow): """Set up QMediaPlayer with QVideoWidget for smooth video playback.""" self.media_player = QtMultimedia.QMediaPlayer() self.video_output = QtMultimediaWidgets.QVideoWidget() - # Reparent video_output into our video_widget container - layout = self.video_widget.layout() - if layout is None: - layout = QtWidgets.QVBoxLayout(self.video_widget) - layout.setContentsMargins(0, 0, 0, 0) + # Place QVideoWidget inside our container + layout = QtWidgets.QVBoxLayout(self.video_container) + layout.setContentsMargins(0, 0, 0, 0) layout.addWidget(self.video_output) self.media_player.setVideoOutput(self.video_output) @@ -517,6 +522,7 @@ class VerifyWindow(QtWidgets.QMainWindow): self.curve_b_sep.setVisible(self.chk_b.isChecked()) def _reset_zoom(self): + self.p_comb.enableAutoRange(axis='x', enable=False) self.p_comb.setXRange(0, self.duration, padding=0) def closeEvent(self, event):