当前位置:网站首页>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;_");//日期输入


边栏推荐
猜你喜欢

GUI guess number game, directly open play

Haas, which integrates relevant technologies of Alibaba cloud, Dharma Institute and pingtouge, has officially announced the book

消息队列-推/拉模式学习 & ActiveMQ及JMS学习

Axi protocol Basics

vscode保存代码时自动eslint格式化
![[opencvsharp] spot detection barcode decoding image operation image rotation / flip / Zoom perspective transformation image display control demo notes](/img/a7/5b66ef0360ed41441653a413cd9e53.png)
[opencvsharp] spot detection barcode decoding image operation image rotation / flip / Zoom perspective transformation image display control demo notes

C language: use H and C. summary of problems encountered in documents

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

Switching power supply circuit diagram and principle 12V analysis - detailed version

Global and Chinese molten carbonate fuel cell industry outlook and market panoramic Research Report 2022-2028
随机推荐
LeetCode-384. 打乱数组
How to store tree structure in database
Project failed to load the configuration file of Nacos configuration center
Elasitcsearch basic learning notes (1)
消息队列-推/拉模式学习 & ActiveMQ及JMS学习
Redis - learn five types of NoSQL
Axi protocol Basics
GemBox.Bundle 43.0 Crack
My C の errors
关联关系
啟牛商學院給的證券賬戶是安全的嗎?開戶收費嗎
10 times faster than 5g. Are you ready for 10 Gigabit communication?
我的CのERROR们
如何成为一个乐观派组织?
Docker installs mysql5.7 (enable binlog function and modify characters)
Typescript learning notes (II)
论文阅读 dyngraph2vec: Capturing Network Dynamics using Dynamic Graph Representation Learning
Analysis report on the "fourteenth five year plan" proposal and innovation environment of global and Chinese sodium pyrophosphate industry (2022-2028)
如何把树结构存储到数据库
Katalon Studio Enterprise