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()