forked from Wobbl/Wobuzz
Made the Track Progress Slider clickable.
This commit is contained in:
parent
7844e15aa2
commit
19b6f4dcaa
4 changed files with 22 additions and 2 deletions
19
wobuzz/ui/track_progress_slider.py
Normal file
19
wobuzz/ui/track_progress_slider.py
Normal file
|
@ -0,0 +1,19 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
from PyQt6.QtCore import Qt
|
||||
from PyQt6.QtGui import QMouseEvent
|
||||
from PyQt6.QtWidgets import QSlider
|
||||
|
||||
|
||||
class TrackProgressSlider(QSlider):
|
||||
def mousePressEvent(self, event: QMouseEvent):
|
||||
if event.button() == Qt.MouseButton.LeftButton:
|
||||
event.accept()
|
||||
|
||||
x = event.pos().x()
|
||||
|
||||
value = self.maximum() * x // self.width()
|
||||
self.setValue(value)
|
||||
|
||||
return super().mousePressEvent(event)
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue