当前位置:网站首页>Qlineedit of QT notes (74) specifies the input type
Qlineedit of QT notes (74) specifies the input type
2022-06-30 22:55:00 【I'm classmate Huang】
One . Preface
The landlord is actually developing , The text box can only enter numbers or letters , I thought I needed to do event filtering by myself , little does one think Qt Relevant interfaces have been provided , The landlord then sorted out the records and shared them
Two . Example of setting limit input type
1. Only numbers are allowed
ui->lineEdit->setValidator(new QIntValidator(ui->lineEdit_pid));
ui->lineEdit->setValidator(new QRegExpValidator(QRegExp("[0-9]+$")));
2. Only letters are allowed
ui->lineEdit->setValidator(new QRegExpValidator(QRegExp("^[A-Za-z]+$")));
3. Only letters and numbers are allowed Case insensitive
ui->lineEdit->setValidator(new QRegExpValidator(QRegExp("[a-zA-Z0-9]+$")));
4. Only uppercase letters are allowed
ui->lineEdit->setValidator(new QRegExpValidator(QRegExp("^[A-Z]+$")));
5. Only lowercase letters are allowed
ui->lineEdit->setValidator(new QRegExpValidator(QRegExp("^[a-z]+$")));
6. Only Chinese is allowed
ui->lineEdit->setValidator(new QRegExpValidator(QRegExp("[\u4e00-\u9fa5]+$")));
边栏推荐
- How to use filters in jfinal to monitor Druid for SQL execution?
- 多線程經典案例
- 2022-06-30: what does the following golang code output? A:0; B:2; C: Running error. package main import “fmt“ func main() { ints := make
- Nansen复盘加密巨头自救:如何阻止百亿多米诺倾塌
- Swift5.0 ----Swift FrameWork的创建及使用
- Redis' transaction and locking mechanism
- 如何使用 DataAnt 监控 Apache APISIX
- 微信小程序通过点击事件传参(data-)
- [golang] golang implements the string interception function substr
- [fundamentals of wireless communication-13]: illustrated mobile communication technology and application development-1-overview
猜你喜欢

latex中 & 号什么含义?

Cas classique multithreadé

机器学习编译入门课程学习笔记第二讲 张量程序抽象

Using Obsidian with Hugo, markdown's local editing software is seamlessly connected with online

Tencent has been conducting advanced automated functional testing for 3 years. It is a gift to you who are confused in manual testing

QQmlApplicationEngine failed to load component qrc:/main. qml:-1 No such file or directory

与AI结对编程式是什么体验 Copilot vs AlphaCode, Codex, GPT-3

深入解析 Apache BookKeeper 系列:第四篇—背压

电脑设备管理器在哪里可以找到

Web APIs comprehensive case -tab column switching - dark horse programmer
随机推荐
Win11如何优化服务?Win11优化服务的方法
「团队训练赛」ShanDong Multi-University Training #3
Introduction to machine learning compilation course learning notes lesson 2 tensor program abstraction
B_ QuRT_ User_ Guide(35)
Femas:云原生多运行时微服务框架
[450. delete nodes in binary search tree]
What does the software test report contain? How to obtain high quality software test reports?
Smart streetlights | cloud computing lights up the "spark" of smart cities
leetcode:104. Maximum depth of binary tree
电脑设备管理器在哪里可以找到
公有云市场迈入深水区,冷静的亚马逊云还坐得住吗?
Fastjson V2 simple user manual
The Sandbox 正在 Polygon 网络上进行部署
[golang] golang实现截取字符串函数SubStr
How does win11 optimize services? Win11 method of optimizing service
[Android, kotlin, tflite] mobile device integration depth learning light model tflite (image classification)
Wechat applet transmits parameters (data-) by clicking events
Strictly minor spanning tree
Introduction to digital transformation solutions for enterprises going to sea
HP 惠普笔记本电脑 禁用触摸板 在插入鼠标后