fix: Speichere Playhead-Position als Python-Zahl und aktualisiere QGraphicsLineItem bei jedem Timer-Tick
Co-authored-by: aider (ollama/qwen2.5-coder:14b) <aider@aider.chat>
This commit is contained in:
1 parent
ea09c0a885
commit
b7224649f1
1 file changed
+8
-4
@@ -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()
|
||||
|
||||
|
||||
Reference in new issue
Block a user