how to make a particular column in QTreeWidget integer/Float, such that the user can't enter any alphabets or symbols instead of integers/Floats?
问题 I am making a GUI in PyQt5 which uses QTreeWidget. I want a particular column to be integer only column. The user shouldn't be able to enter any non integer item in it. I saw some methods using QVariant but it doesn't seem to fullfill my requirement. Here is what I found! .But this seems to me like setting the data from the back-end not from the user side. from PyQt5 import QtCore, QtGui, QtWidgets class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName(