From b7224649f1385c8519d53e4ee1719306f9b4474f Mon Sep 17 00:00:00 2001 From: Aider AI Agent Date: Sun, 11 Oct 2026 17:54:32 +0200 Subject: [PATCH] fix: Speichere Playhead-Position als Python-Zahl und aktualisiere QGraphicsLineItem bei jedem Timer-Tick Co-authored-by: aider (ollama/qwen2.5-coder:14b) --- main.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index cad737c..c2c2efa 100644 --- a/main.py +++ b/main.py @@ -63,7 +63,8 @@ class MainWindow(QMainWindow): self.timeline_length = 1000 # Länge der Timeline in Pixeln self.scene.addLine(0, 0, self.timeline_length, 0, QPen(Qt.GlobalColor.white)) - self.playhead = QGraphicsLineItem(0, -5, 0, 5) + self.current_x = 0.0 + self.playhead = QGraphicsLineItem(self.current_x, -5, self.current_x, 5) self.playhead.setPen(QPen(Qt.GlobalColor.red, 2)) self.scene.addItem(self.playhead) @@ -132,9 +133,12 @@ class MainWindow(QMainWindow): self.timer.stop() def move_playhead(self): - current_x = self.playhead.line().p1().x() - if current_x < self.timeline_length: - self.playhead.setLine(current_x + 1, -5, current_x + 1, 5) + self.current_x += 1 + if self.current_x < self.timeline_length: + self.scene.removeItem(self.playhead) + self.playhead = QGraphicsLineItem(self.current_x, -5, self.current_x, 5) + self.playhead.setPen(QPen(Qt.GlobalColor.red, 2)) + self.scene.addItem(self.playhead) else: self.pause()