I looked for solutions, but I did not find them. I wanted to make it into a QTimeEdit by pressing the up or down arrow on the minutes, and only those, step 10. I wanted to write in the stylesheet. I've tried these solutions, but they do not work.
QTimeEdit::MinuteSection{
stepBy:10;
}
QTimeEdit QAbstractSpinBox{
stepEnabled: True;
}
QTimeEdit QAbstractSpinBox::MinuteSection {
stepEnabled: True;
stepBy:10;
}
In all cases above the minutes always advance one and not 10. However, the code does not give me any errors. from PyQt5 import QtCore, QtGui, QtWidgets
class timeEdit(QtWidgets.QTimeEdit):
def stepBy(self, steps):
if self.currentSection() == self.MinuteSection:
steps=10
class MainWindow(QtWidgets.QWidget):
def __init__(self):#FFFFFF
super(MainWindow, self).__init__()
self.resize(800, 480)
self.setWindowTitle("MainWindow")
self.setObjectName("MainWindow")
self.timeEdit = QtWidgets.QTimeEdit(self)
self.timeEdit.setGeometry(QtCore.QRect(330, 30, 200, 100))
self.timeEdit.stepBy(1)
self.timeEdit2 = QtWidgets.QTimeEdit(self)
self.timeEdit2.setGeometry(QtCore.QRect(330, 230, 200, 100))
if __name__ == "__main__":
import sys
app =QtWidgets.QApplication(sys.argv)
Window= MainWindow()
Window.show()
sys.exit(app.exec_())
if __name__ == "__main__":
main()