fix: use QWidget video container and disable linked plot auto-range

This commit is contained in:
Honney OC committed 2026-09-13 22:59:50 +00:00
1 parent 10f03ec6d3
commit bbcdc2227b
1 file changed
+16 -10
+16 -10
View File
@@ -219,11 +219,11 @@ class VerifyWindow(QtWidgets.QMainWindow):
lay = QtWidgets.QVBoxLayout(central) lay = QtWidgets.QVBoxLayout(central)
lay.setSpacing(2) lay.setSpacing(2)
# ── Video display (QVideoWidget) ── # ── Video display (QWidget container) ──
self.video_widget = QtMultimediaWidgets.QVideoWidget() self.video_container = QtWidgets.QWidget()
self.video_widget.setMinimumHeight(300) self.video_container.setMinimumHeight(300)
self.video_widget.setStyleSheet("background: #000;") self.video_container.setStyleSheet("background: #000;")
lay.addWidget(self.video_widget, stretch=4) lay.addWidget(self.video_container, stretch=4)
# ── Timeline seek bar ── # ── Timeline seek bar ──
time_row = QtWidgets.QHBoxLayout() time_row = QtWidgets.QHBoxLayout()
@@ -284,6 +284,13 @@ class VerifyWindow(QtWidgets.QMainWindow):
self.p_a.setXLink(self.p_comb) self.p_a.setXLink(self.p_comb)
self.p_b.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) lay.addWidget(self.gw_dual, stretch=2)
@@ -343,11 +350,9 @@ class VerifyWindow(QtWidgets.QMainWindow):
"""Set up QMediaPlayer with QVideoWidget for smooth video playback.""" """Set up QMediaPlayer with QVideoWidget for smooth video playback."""
self.media_player = QtMultimedia.QMediaPlayer() self.media_player = QtMultimedia.QMediaPlayer()
self.video_output = QtMultimediaWidgets.QVideoWidget() self.video_output = QtMultimediaWidgets.QVideoWidget()
# Reparent video_output into our video_widget container # Place QVideoWidget inside our container
layout = self.video_widget.layout() layout = QtWidgets.QVBoxLayout(self.video_container)
if layout is None: layout.setContentsMargins(0, 0, 0, 0)
layout = QtWidgets.QVBoxLayout(self.video_widget)
layout.setContentsMargins(0, 0, 0, 0)
layout.addWidget(self.video_output) layout.addWidget(self.video_output)
self.media_player.setVideoOutput(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()) self.curve_b_sep.setVisible(self.chk_b.isChecked())
def _reset_zoom(self): def _reset_zoom(self):
self.p_comb.enableAutoRange(axis='x', enable=False)
self.p_comb.setXRange(0, self.duration, padding=0) self.p_comb.setXRange(0, self.duration, padding=0)
def closeEvent(self, event): def closeEvent(self, event):