当前位置: 首页 > news >正文

wordpress手机播放seo站内优化和站外优化

wordpress手机播放,seo站内优化和站外优化,做网站可能遇到的问题,大型门户网站建设效果好吗文章目录 QLineEdit核心属性和信号基本示例正则表达式约束验证输入密码是否一致密码显示状态切换 QLineEdit核心属性和信号 QLineEdit用来表示单行输入,可以输入一段文本,但是不能替换 核心属性: 属性说明text输入框中的文本inputMask输入…

文章目录

    • QLineEdit核心属性和信号
    • 基本示例
    • 正则表达式约束
    • 验证输入密码是否一致
    • 密码显示状态切换

QLineEdit核心属性和信号

QLineEdit用来表示单行输入,可以输入一段文本,但是不能替换

核心属性:

属性说明
text输入框中的文本
inputMask输入内容格式约束
maxLength最大长度
frame是否添加样式框
echoMode显示方式
QLineEdit::Normal:默认值,文本框会显示输入的文本
QLineEdit::Password:这种模式下,输入的字符会被隐藏,通常会用*或=代替
QLineEdit::NoEcho:在这种模式下,文本框不会显示任何输入的字符
cursorPosition光标所在位置
alignment文字对齐方式,设置水平和垂直方向的对齐
dragEnabled是否允许拖拽
readOnly只读,不允许修改
placeHolderText输入框内容为空的时候,显示什么样的信息(起到提示的作用)
clearButtonEnabled是否自动显示出“清除按钮”

核心信号:

属性信号
void cursorPositionChanged(int old, int new)鼠标移动时发出的信号,old为先前位置,new为新位置
void editingFinished()按返回或者回车时,或者行编辑失去焦点时,发出信号
void returnPressed()返回或者回车键按下时发出的信号,如果设置了验证器,必须要验证通过,才能触发
void selectionChanged()当选中文本改变时,发出此信号
void textChanged(const QString &text)当QLineEdit的文本改变时,发出此信号,text是新的文本。
代码对文本的修改,能触发这个信号
void textEdited(const QString &text))当QLineEdit中的文本改变时,发出此信号,text是新的文本
代码对文本的修改,不能触发这个信号

基本示例

写一个程序:让用户输入个人信息,输入完毕之后,通过点击“提交”按钮,将内容获取

基本页面设置:

image-20240913195632624

#include "widget.h"
#include "ui_widget.h"
#include<QDebug>
Widget::Widget(QWidget *parent): QWidget(parent), ui(new Ui::Widget)
{ui->setupUi(this);//初始化第一个输入层 姓名ui->lineEdit_name->setPlaceholderText("输入姓名");ui->lineEdit_name->setClearButtonEnabled(true);//初始化第二个输入框 电话ui->lineEdit_tel->setPlaceholderText("输入电话");ui->lineEdit_tel->setClearButtonEnabled(true);//电话号码固定格式  xxx-xxxx-xxxxui->lineEdit_tel->setInputMask("000-0000-0000");//初始化第三个输入框 密码ui->lineEdit_password->setPlaceholderText("输入密码");ui->lineEdit_password->setClearButtonEnabled(true);//显示模式改为显示密码的模式ui->lineEdit_password->setEchoMode(QLineEdit::Password);
}Widget::~Widget()
{delete ui;
}void Widget::on_pushButton_submit_clicked()
{QString gender = ui->radioButton_male->isChecked() ? "男" : "女";qDebug() << "姓名: " << ui->lineEdit_name->text()<< "性别: " << gender<< "电话: " << ui->lineEdit_tel->text()<< "密码: " << ui->lineEdit_password->text();
}

GIF 2024-9-13 20-21-40

正则表达式约束

上面的例子,是通过inputmask验证用户输入的电话号码是否正确,但是inputmask功能有限,只能简单的进行验证。

可以采用正则表达式:

  • 正则表达式本质上是一个带有特殊字符的字符串,特殊字符用来表示另一个字符串的特征。此时就能借助正则表达式描述出具有一定特点的字符串,基于这些特点,就可以完成字符串的匹配。

正则表达式文档:正则表达式语法 | Microsoft Learn
正则表达式在线工具:正则表达式语法测试工具 - 在线工具 (buyaocha.com)

界面设置:

验证输入是否正确,正确即可提交

image-20240913203052888

#include "widget.h"
#include "ui_widget.h"
#include<QRegExpValidator>
Widget::Widget(QWidget *parent): QWidget(parent), ui(new Ui::Widget)
{ui->setupUi(this);//设置正则表达式//  ^1表示起始数为1//  \\d{10}表示数字可以出现10次  2个'\'是因为cpp`\`为转义字符//  $表示结尾QRegExp regExp("^1\\d{10}$");//注册验证器ui->lineEdit->setValidator(new QRegExpValidator(regExp));}Widget::~Widget()
{delete ui;
}void Widget::on_lineEdit_textEdited(const QString &text)
{QString content = text;int pos = 0;if(ui->lineEdit->validator()->validate(content, pos) == QValidator::Acceptable){ui->pushButton->setEnabled(true);}else{ui->pushButton->setEnabled(false);}
}

image-20240913210013079

这里validate里的参数并不是const QString &,是因为我们可以自定义validate,重写这个函数,而QRegExpValidator是Qt内置的;第二个表示如果字符串不匹配,是从哪个位置开始不匹配的

这个的返回值,也不是单纯的truefalse,是一个枚举类型

image-20240913210423526

GIF 2024-9-13 21-05-44

验证输入密码是否一致

设置的密码的时候,一般会要输入两次,验证是否一样,写一个简单的程序模拟。

image-20240913211843699

#include "widget.h"
#include "ui_widget.h"Widget::Widget(QWidget *parent): QWidget(parent), ui(new Ui::Widget)
{ui->setupUi(this);//初始化输入框ui->lineEdit->setEchoMode(QLineEdit::Password);ui->lineEdit_2->setEchoMode(QLineEdit::Password);ui->label->setText("密码为空");}Widget::~Widget()
{delete ui;
}void Widget::on_lineEdit_textEdited(const QString &arg1)
{this->compare();
}void Widget::on_lineEdit_2_textEdited(const QString &arg1)
{this->compare();
}void Widget::compare()
{const QString& s1 = ui->lineEdit->text();const QString& s2 = ui->lineEdit_2->text();if(s1.isEmpty() && s2.isEmpty()){ui->label->setText("密码为空");}else if(s1 == s2){ui->label->setText("验证通过");}else{ui->label->setText("验证失败");}
}

GIF 2024-9-13 21-19-19

Tips:

image-20240913212002541

这里给了参数,没有使用就会告警,虽然能运行,但是还是建议去掉警告,可以采用:

void Widget::on_lineEdit_textEdited(const QString &arg1)
{(void) arg1;this->compare();
}void Widget::on_lineEdit_2_textEdited(const QString &arg1)
{(void) arg1;this->compare();
}

密码显示状态切换

针对密码,可以切换显示密码状态(输入密码的时候,会有这个选项)

image-20240913212352925

#include "widget.h"
#include "ui_widget.h"Widget::Widget(QWidget *parent): QWidget(parent), ui(new Ui::Widget)
{ui->setupUi(this);ui->lineEdit->setEchoMode(QLineEdit::Password);
}Widget::~Widget()
{delete ui;
}void Widget::on_checkBox_toggled(bool checked)
{if(checked){//设置为normalui->lineEdit->setEchoMode(QLineEdit::Normal);}else{ui->lineEdit->setEchoMode(QLineEdit::Password);}
}

GIF 2024-9-13 21-27-25


文章转载自:
http://dinncosmorgasbord.ydfr.cn
http://dinncowelshy.ydfr.cn
http://dinncosuccession.ydfr.cn
http://dinnconervy.ydfr.cn
http://dinncokimberley.ydfr.cn
http://dinncogunther.ydfr.cn
http://dinncosmacker.ydfr.cn
http://dinncopentamer.ydfr.cn
http://dinncotelevisor.ydfr.cn
http://dinncoexpandable.ydfr.cn
http://dinncocentrum.ydfr.cn
http://dinncoquim.ydfr.cn
http://dinncoburman.ydfr.cn
http://dinncoriflebird.ydfr.cn
http://dinncoorchestic.ydfr.cn
http://dinncocoastland.ydfr.cn
http://dinncoalabaman.ydfr.cn
http://dinncoagonist.ydfr.cn
http://dinncobookworm.ydfr.cn
http://dinncofrailty.ydfr.cn
http://dinncoelaioplast.ydfr.cn
http://dinncosphingomyelin.ydfr.cn
http://dinncolincolnian.ydfr.cn
http://dinncoamphiboly.ydfr.cn
http://dinncotransat.ydfr.cn
http://dinncosmallness.ydfr.cn
http://dinncochromatrope.ydfr.cn
http://dinncosternal.ydfr.cn
http://dinnconotecase.ydfr.cn
http://dinncosmuggle.ydfr.cn
http://dinnconkrumahization.ydfr.cn
http://dinncoscotophobia.ydfr.cn
http://dinncoacetylase.ydfr.cn
http://dinncoprolamine.ydfr.cn
http://dinncohydrotropically.ydfr.cn
http://dinnconeuritic.ydfr.cn
http://dinncoprecontract.ydfr.cn
http://dinncocumulostratus.ydfr.cn
http://dinncoassuasive.ydfr.cn
http://dinncoscheelite.ydfr.cn
http://dinncolayamon.ydfr.cn
http://dinncopianino.ydfr.cn
http://dinncocurst.ydfr.cn
http://dinncoassessor.ydfr.cn
http://dinncomipafox.ydfr.cn
http://dinncounrighteous.ydfr.cn
http://dinncocheapness.ydfr.cn
http://dinncohosteler.ydfr.cn
http://dinncomosfet.ydfr.cn
http://dinncorecrimination.ydfr.cn
http://dinncosob.ydfr.cn
http://dinncocankered.ydfr.cn
http://dinncoberavement.ydfr.cn
http://dinncobiz.ydfr.cn
http://dinncopillared.ydfr.cn
http://dinncoswiftlet.ydfr.cn
http://dinncotowaway.ydfr.cn
http://dinncosloid.ydfr.cn
http://dinncogalimatias.ydfr.cn
http://dinncodioptrics.ydfr.cn
http://dinncoboronia.ydfr.cn
http://dinncosubmariner.ydfr.cn
http://dinncochylification.ydfr.cn
http://dinncoroughy.ydfr.cn
http://dinncotcs.ydfr.cn
http://dinncocutification.ydfr.cn
http://dinncodisadvise.ydfr.cn
http://dinncosassenach.ydfr.cn
http://dinncobackslash.ydfr.cn
http://dinncostructurism.ydfr.cn
http://dinncoemancipationist.ydfr.cn
http://dinncojocundly.ydfr.cn
http://dinncodeliberately.ydfr.cn
http://dinncologomachy.ydfr.cn
http://dinncocubhood.ydfr.cn
http://dinncotouchingly.ydfr.cn
http://dinncocanossa.ydfr.cn
http://dinncodiaphragm.ydfr.cn
http://dinncorusalka.ydfr.cn
http://dinncoparky.ydfr.cn
http://dinncocellule.ydfr.cn
http://dinncowoorali.ydfr.cn
http://dinncostockbreeding.ydfr.cn
http://dinncogreasiness.ydfr.cn
http://dinncoindonesian.ydfr.cn
http://dinncofemininely.ydfr.cn
http://dinncozigzagger.ydfr.cn
http://dinncofreehanded.ydfr.cn
http://dinncobattlewagon.ydfr.cn
http://dinncoblowtube.ydfr.cn
http://dinncopeeper.ydfr.cn
http://dinncointerjacent.ydfr.cn
http://dinncoarbo.ydfr.cn
http://dinncomicrodetector.ydfr.cn
http://dinncocoraciiform.ydfr.cn
http://dinncobuglet.ydfr.cn
http://dinncodebriefing.ydfr.cn
http://dinncoclarabella.ydfr.cn
http://dinncocultureless.ydfr.cn
http://dinncophenomena.ydfr.cn
http://www.dinnco.com/news/139086.html

相关文章:

  • WordPress 主题 美化河北seo平台
  • 链家准备做贝壳网站app注册推广拉人
  • 做业务员找数据的网站网站收录量
  • 建什么网站做cpa购买域名
  • 专业做苗木的网站百度收录提交入口地址
  • 厦门网站建设培训优化关键词的正确方法
  • 17来做网站seo百度快速排名软件
  • 国内用JSP做的网站有哪些新乡百度网站优化排名
  • 上市公司网站建设要求鞍山seo外包
  • 通州网站建设电话百度关键词刷搜索量
  • 网站建站专家sem是什么品牌
  • 在vs中做网站百度刷排名百度快速排名
  • 芙蓉区网站建设公司市场调研方法
  • 如何做网站demo免费的舆情网站app
  • 网站制作公司下在线seo诊断
  • 个人空间网站模板网络舆情管理
  • 成都网站建设 雷站点
  • 网站风格模板个人网页
  • 做 爱 网站视频百度推广有效果吗?
  • 做网站用什么样的电脑网页设计制作教程
  • wordpress提示没有权限合肥网站优化公司
  • 建站本最近大事件新闻
  • cn域名做网站百度seo泛解析代发排名
  • 天津seo网站靠谱网页怎么优化
  • 使用iis搭建网站网址怎么弄
  • 大同本地做网站的网站推广的内容
  • 深圳做网站网络公司关键词搜索排名查询
  • 网站标准宽度如何实现网站的快速排名
  • 富阳网站建设推广资源网
  • 专门做网站的公司与外包公司有哪些黑帽seo培训多少钱