当前位置:网站首页>QLineEdit 设置输入掩码
QLineEdit 设置输入掩码
2022-06-11 17:09:00 【litanyuan】
背景
QLineEdit 是单行文本编辑器,常用于界面中的文本输入。QLineEdit 提供了 inputMask 使用一些特定到字符来设置输入的格式和内容。
inputMask
①.概述
输入掩码包括两部分组成:; 之前是输入格式及占位符设置,;之后是空白占位符设置。
②.格式设置
A:只能输入字母,且不可省略
a:只能输入字母,可以省略
N:只能输入 字母和数字,且不可省略
n:只能输入 字母和数字,可以省略
X:可以输入任意字符,且不可省略
x:可以输入任意字符,可以省略
9:可以输入数字,且不可省略
0:可以输入数字,可以省略
D:可以输入数字 1 ~ 9,且不可省略
d:可以输入数字 1 ~ 9,可以省略
#:可以输入数字和 加减号:+ ,-,可以省略
H:可以输入 16 进制字符,且不可省略
h:可以输入 16 进制字符,可以省略
B:可以输入 2 进制字符,且不可省略
b:可以输入 2 进制字符,可以省略
>:所有字母转大写
<:所有字母转小写
!:停止大小写转换
\:以上到特殊字符作为正常字符显示
在没有输入完必须要输入到字符时,回车按下信号 returnPressed 没有响应。
③.空白占位设置
空白占位符是指在还没有输入内容时占位符显示的内容,默认是空白,在用户输入后自动删除。
应用举例
ui.lineEdit->setInputMask("查找目标99;_");//格式化文本
ui.lineEdit_2->setInputMask("000.000.000.000;_");//IP地址输入
ui.lineEdit_3->setInputMask("0000-00-00;_");//日期输入


边栏推荐
- 《DAMA数据管理知识体系指南》:章节分值占比
- What subclasses inherit, polymorphism, and upward transformation
- Message queue push / pull mode Learning & ActiveMQ and JMS learning
- Katalon Studio Enterprise
- Environment configuration and pymysql installation
- Song of the sea in 5g Era
- Connection and difference of network streaming media protocol (RTP RTCP RTMP HLS)
- 字符串转数值
- String to numeric value
- Leetcode 450. Deleting a node in a binary search tree
猜你喜欢

Intranet penetration based on UDP port guessing

RecyclerView缓存复用解析,源码解读
![[Clickhouse column] create a new library, user and role](/img/e5/d11493a37e25b7dde6cc43b3828749.png)
[Clickhouse column] create a new library, user and role

通过Xshell连接有跳板机/堡垒机的服务器

Song of the sea in 5g Era

Science popularization genius on the left, madman on the right

Pycharm使用小技巧 - 如何设置背景图片

The use of histogram function in MATLAB

vscode配置eslint自动格式化报错“The setting is deprecated. Use editor.codeActionsOnSave instead with a source“

A journey of database full SQL analysis and audit system performance optimization
随机推荐
JINTE NET基金会将通过线上直播参与维度链全球战略发布会
Connection and difference of network streaming media protocol (RTP RTCP RTMP HLS)
[Clickhouse column] create a new library, user and role
Leetcode-- array
接口的特点&&接口与抽象类的对比
golang中的异常处理和异常使用
[pytest learning] after the pytest case fails to execute, the others will not be executed
^31原型面试题
MATLAB中histogram函数的使用
vscode保存代码时自动eslint格式化
LeetCode-1005. K 次取反后最大化的数组和
Report on the operation situation and future prospects of China's gear oil industry (2022-2028)
Web security - shooting range notes
每周推荐短视频:菜鸟CEO谈未来物流新赛道
二级造价工程师值得考吗?发展前景如何?
Exception handling and exception usage in golang
How to disable the notebook's own keyboard after the notebook is connected to an external keyboard
Leetcode 450. 删除二叉搜索树中的节点
Recyclerview cache reuse analysis, source code interpretation
如何成为一个乐观派组织?