qt的三种验证类:

1。输入int类型

QValidator *validator=new QIntValidator(100,999,this);

QLineEdit *edit=new QLineEdit(this);

edit->setValidator(validator);

也可以表示成

QLineEdit *edit=new QLineEdit(this);

edit->setValidator(new QIntValidator(100,999,this));

2.输入double类型

QLineEdit *edit=new QLineEdit(this);

edit->setValidator(new QDoubleValidator(double bottom,double top,,int decimal,this));

bottom为最小范围,top为最大范围,decimal为精确度,精确到第几位小数。

3。输入任意匹配类型

QRegExp regExp(“[A-Za-z][1-9][0-9]{0,2}”);//正则表达式,第一位数字为a-z的数字,第二位为1-9的数字,后边是0-2位0-9的数字

lineEdit->setValidator(new QRegExpValidator(regxp,this));

最新文章

  1. Java IO流学习总结
  2. /usr/bin/cd 是什么鬼
  3. 剑指Offer 矩形覆盖
  4. javascript generate a guid
  5. bzoj-3288 3288: Mato矩阵(数论)
  6. thinkphp验证码使用
  7. ionic 写一个五星评价(非指令)
  8. css制作三角形
  9. PL/SQL客户端安装配置说明
  10. RapidCRC : Home
  11. 11gR2更换OCR和VOTE
  12. Visual Studio 20周年软件趋势随想
  13. qmake 提示 Failure to open file:****
  14. TensorFlow问题:The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
  15. Windows Server 2016-Powershell迁移FSMO角色
  16. 想知道谁是你的最佳用户?基于Redis实现排行榜周期榜与最近N期榜
  17. SAP CRM 集类型(Set Type)与产品层次(Product Hierarchy)
  18. Beta 冲刺 (2/7)
  19. “一切都是消息”--iMSF(即时消息服务框架)之【请求-响应】模式(点对点)
  20. vc写的dll被mingw的g++编译引用

热门文章

  1. 关于zabbix _get返回Could not attach to pid的问题
  2. php opcache 详解
  3. POJ_2478 Farey Sequence 【欧拉函数+简单递推】
  4. [转] Spring Boot特性
  5. CAPL编程实现诊断刷写,车联网FOTA流程自动化测试(代码篇)
  6. MYSQL分区表详解
  7. jsonProperty
  8. request-statistics.lua
  9. c语言实现栈的增删查减
  10. phantomJs原理