Answer the question
In order to leave comments, you need to log in
How to make a signal for QSlider'a?
How to make the slider move to the clicked position on the QSlider. That is, we have a straight line and a slider that is located on it. When I click in a straight line, the slider moves, but by a certain distance. I think that I need to increase the PageStep to the value that I choose on the line, and then it should move to the desired distance
Answer the question
In order to leave comments, you need to log in
def mousePressEvent(self, event):
print(Qt.Vertical)
if event.button() == Qt.LeftButton:
if self.orientation() == Qt.Vertical:
self.setValue(self.minimum() + ((self.maximum() - self.minimum()) * (self.height() - event.y())) / self.height() )
else:
self.setValue(self.minimum() + ((self.maximum() - self.minimum()) * event.x()) / self.width())
event.accept()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question