1.setValidator 方式,有缺點只能限制最小的數,不能限制最大數輸入。靠譜的做法還是利用正則表達式
leStationMin_->setValidator(new QIntValidator(1,100,this));
2.正則表達式
QRegExp regx("[0-9]+$"); leStationMin_->setValidator(new QRegExpValidator(regx,this));
1.setValidator 方式,有缺點只能限制最小的數,不能限制最大數輸入。靠譜的做法還是利用正則表達式
leStationMin_->setValidator(new QIntValidator(1,100,this));
2.正則表達式
QRegExp regx("[0-9]+$"); leStationMin_->setValidator(new QRegExpValidator(regx,this));
def ADD(a): print(3,a,hex(id(a))) a.remove(2) print(3,a,hex(id(a))) a=a.append(10)