如何在QLineEdit的开头设置修复字符串?

问题描述

是否可以在QLineEdit的开头设置修复字符串?像这样的东西:

enter image description here

此处$中的常量是常量,用户无法删除或编辑它。

解决方法

在对象中使用输入掩码:例如

ui->lineEdit->setInputMask("$ 000.000.000.000 ");

看起来像

enter image description here