My QTimeEdit displays HH:mm. The MiniuteSection has 15 as the step. My QTimeEdit increments well. But when I want to decrement the minute, I can only change the time from xx:45 to xx:30 to xx:15 and xx-1:45. As you can see, the time xx:00 is just skiped. There is no way to make it decrement from xx:15 to xx:00 to xx-1:45. Does anyone have idea how to solve the problem?
class FiveteenMinuteTimeEdit(QtWidgets.QTimeEdit):
def stepBy(self, steps):
if self.currentSection() == self.MinuteSection:
QtWidgets.QTimeEdit.stepBy(self, steps*15)
t = self.time()
if t.minute() == 59 and steps >0:
time = QtCore.QTime()
time.setHMS(t.hour()+1,0,0)
self.setTime(time)
if t.minute() == 0 and steps <0:
time = QtCore.QTime()
time.setHMS(t.hour()-1,45,0)
self.setTime(time)
else:
QtWidgets.QTimeEdit.stepBy(self, steps)