def __init__(self, parent = None, orientation=Qt.Horizontal): QSlider.__init__(self, orientation, parent) self.setPageStep(1) self.paused = False self.setEnabled(False) self.max = 0 self.value_when_pressed = 0 self.progress_max = 0 self.progress = 0 self.setValue(0) self.last_value = 0 self.lastSeeked = 0 self.time_when_paused = 0 self.is_sliderMoving = False self.MediaPlayer = None self.last_valid_value = 0 self.progressBarHeight = 0 self.ignoreHandle = False self.timer_update_slider = QTimer() self.timer_update_slider.timeout.connect(self.update_slider) self.sliderPressed.connect(self.on_slider_press) self.sliderReleased.connect(self.on_slider_release) self.sliderMoved.connect(self.on_slider_move) self.setSetStyleSheet()
def mousePressEvent(self, event): if event.button() == Qt.LeftButton: newEvent = QMouseEvent( event.type(), event.pos(), event.globalPos(), Qt.MouseButton( event.button() ^ Qt.LeftButton ^ Qt.MidButton ), Qt.MouseButtons( event.buttons() ^ Qt.LeftButton ^ Qt.MidButton ), event.modifiers() ) QSlider.mousePressEvent(self, newEvent ) else: QSlider.mousePressEvent(self, event )