问题描述
如何清除python中的掩码?我正在使用 setInputMask
在 qLineEdit
中插入掩码,但一段时间后我想清除 lineEdit
(移除掩码)。我尝试使用 clearMask
、clear
和 setText("")
,但没有成功。
MVCE:
from PyQt5.QtWidgets import QApplication,QLineEdit,QWidget,qformlayout
from PyQt5.QtGui import QIntValidator,QDoubleValidator,QFont
from PyQt5.QtCore import Qt
import sys
class lineEditDemo(QWidget):
def __init__(self,parent=None):
super().__init__(parent)
e3 = QLineEdit()
e3.setInputMask("+99_9999_999999")
e3.clearMask()
e3.clear()
e3.setText("")
flo = qformlayout()
flo.addRow("Input Mask",e3)
self.setLayout(flo)
self.setwindowTitle("QLineEdit Example")
if __name__ == "__main__":
app = QApplication(sys.argv)
win = lineEditDemo()
win.show()
sys.exit(app.exec_())
我应该使用什么方法清除 lineEdit
掩码,因为 clearMask
和其他方法不起作用。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)