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

张北网站建设公司网站seo优化报告

张北网站建设公司,网站seo优化报告,三栏wordpress主题,找私人做网站文章目录 界面学生类序列化函数反序列化函数刷新所选择的下拉表值添加 界面 学生类 // 创建学生信息类 class studentInfo { public:QString id; // 学号QString name; // 学生姓名QString age; // 学生年龄// 重写QDataStream& operator<<操作符&…

文章目录

  • 界面
  • 学生类
  • 序列化函数
  • 反序列化函数
  • 刷新所选择的下拉表值
  • 添加

在这里插入图片描述

界面

在这里插入图片描述

学生类

// 创建学生信息类
class studentInfo
{
public:QString id;     // 学号QString name;   // 学生姓名QString age;        // 学生年龄// 重写QDataStream& operator<<操作符,做数据序列化操作friend QDataStream& operator<<(QDataStream &stream, const studentInfo &student){// 将数据输入流对象中stream << student.id;stream << student.name;stream << student.age;return stream;}// 重写QDataStream& operator>>操作符,做数据反序列化操作friend QDataStream& operator>>(QDataStream &stream, studentInfo &student){// 从流对象中输出数据到学生结构体引用中stream >> student.id;stream >> student.name;stream >> student.age;return stream;}
};

序列化函数

将其放入容器内方便便利每一个学生参数的值

 QList<studentInfo> list;studentInfo student;

获取文本编辑的值读取到序列化文件中进行保存

//保存
void MainWindow::on_pushButton_clicked()
{studentInfo student;//序列化为二进制文件存在本地QFile file(QApplication::applicationDirPath()+"/"+"student.st");           //定义文件路径file.open(QIODevice::WriteOnly); //以只写模式打开QDataStream out(&file);          //定义数据流student.id=ui->m_Id->text();student.age=ui->m_Age->text();student.name=ui->m_Name->text();list.append(student);out<<list;qDebug()<<list[0].id;file.close();qDebug()<<(QString("OK"));ReShowCombox();
}

刷新下拉表的值

void MainWindow::ReShowCombox()
{// 获取 studentInfo 对象if(list.size()>0){ui->comboBox->addItem(list.last().name);}
}

反序列化函数

读取文件的值,添加到下拉列表中

void MainWindow::GetFile()
{studentInfo student;//反序列化本地二进制文件到程序中QFile file(QApplication::applicationDirPath()+"/"+"student.st");//文件在程序运行目录下if(file.exists())//如果文件存在,则从文件读取数据{file.open(QIODevice::ReadOnly);QDataStream in(&file);in>>list;file.close();}// 获取 studentInfo 对象if(list.size()>0){student.id=list.at(0).id;student.age=list.at(0).age;student.name=list.at(0).name;ui->m_Id->setText(student.id);ui->m_Age->setText(student.age);ui->m_Name->setText(student.name);for(int i=0;i<list.size();i++){ui->comboBox->addItem(list.at(i).name);}}}

刷新所选择的下拉表值

连接信号与槽函数

 connect(ui->comboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &MainWindow::on_comboBox_currentIndexChanged);

获取到当前的值

void MainWindow::on_comboBox_currentIndexChanged(int index)
{if (index >= 0) {// 获取当前选中项的 studentInfo 对象studentInfo student = list.at(index);// 刷新其他控件的值ui->m_Id->setText(student.id);ui->m_Name->setText(student.name);ui->m_Age->setText(student.age);}
}

添加

void MainWindow::on_pushButton_2_clicked()
{ui->m_Id->setText("");ui->m_Name->setText("");ui->m_Age->setText("");}

文章转载自:
http://dinncoignoramus.knnc.cn
http://dinncoassyriology.knnc.cn
http://dinncoundersleep.knnc.cn
http://dinncoimprovisator.knnc.cn
http://dinncosulphurator.knnc.cn
http://dinncocanberra.knnc.cn
http://dinncocraterlet.knnc.cn
http://dinncoindividual.knnc.cn
http://dinncorange.knnc.cn
http://dinncoheathendom.knnc.cn
http://dinncohypersurface.knnc.cn
http://dinncoobtest.knnc.cn
http://dinncoremade.knnc.cn
http://dinncodressiness.knnc.cn
http://dinncostevedore.knnc.cn
http://dinncountrodden.knnc.cn
http://dinncostate.knnc.cn
http://dinncooleander.knnc.cn
http://dinncoindulgent.knnc.cn
http://dinncokabob.knnc.cn
http://dinncoelectrostatic.knnc.cn
http://dinncocapoid.knnc.cn
http://dinncoreverend.knnc.cn
http://dinncosalishan.knnc.cn
http://dinncoice.knnc.cn
http://dinncocinemicrography.knnc.cn
http://dinncooffenceful.knnc.cn
http://dinncomodulate.knnc.cn
http://dinncoconsecrated.knnc.cn
http://dinncocobelligerence.knnc.cn
http://dinncokakemono.knnc.cn
http://dinncoproliferate.knnc.cn
http://dinncoresidency.knnc.cn
http://dinncosungar.knnc.cn
http://dinncosallet.knnc.cn
http://dinnconanoprogramming.knnc.cn
http://dinncozygapophysis.knnc.cn
http://dinncowillard.knnc.cn
http://dinncofunctionality.knnc.cn
http://dinncodemiworld.knnc.cn
http://dinncoquadridentate.knnc.cn
http://dinncopalatium.knnc.cn
http://dinncosurculose.knnc.cn
http://dinncocheesecloth.knnc.cn
http://dinncoreek.knnc.cn
http://dinncoantabuse.knnc.cn
http://dinncostomatology.knnc.cn
http://dinncopancarditis.knnc.cn
http://dinncodisrespectable.knnc.cn
http://dinncoupholsterer.knnc.cn
http://dinncophytocide.knnc.cn
http://dinncoperpetuation.knnc.cn
http://dinncomabel.knnc.cn
http://dinncojallopy.knnc.cn
http://dinncosheerly.knnc.cn
http://dinnconomarch.knnc.cn
http://dinncosubcontract.knnc.cn
http://dinncorecipience.knnc.cn
http://dinncoregularization.knnc.cn
http://dinncowap.knnc.cn
http://dinncocycloaliphatic.knnc.cn
http://dinncoclodpoll.knnc.cn
http://dinncocomplexity.knnc.cn
http://dinncoswimmer.knnc.cn
http://dinncoparatransit.knnc.cn
http://dinncodaric.knnc.cn
http://dinncovoyvodina.knnc.cn
http://dinncomerosymmetry.knnc.cn
http://dinncoconcede.knnc.cn
http://dinncocrazed.knnc.cn
http://dinncoacetophenone.knnc.cn
http://dinncodocetism.knnc.cn
http://dinncoaurific.knnc.cn
http://dinncolinkman.knnc.cn
http://dinncoeuphausiid.knnc.cn
http://dinncoclubber.knnc.cn
http://dinncofibrillation.knnc.cn
http://dinncocollaborateur.knnc.cn
http://dinncoproselytism.knnc.cn
http://dinncoamidah.knnc.cn
http://dinnconacred.knnc.cn
http://dinncopregnenolone.knnc.cn
http://dinncotarsus.knnc.cn
http://dinncoessayistic.knnc.cn
http://dinncohesiodic.knnc.cn
http://dinncoinventer.knnc.cn
http://dinncosabulite.knnc.cn
http://dinncodownpress.knnc.cn
http://dinncomaxi.knnc.cn
http://dinncoannulet.knnc.cn
http://dinncoprovincialism.knnc.cn
http://dinncophotoplay.knnc.cn
http://dinncotraverse.knnc.cn
http://dinncorealign.knnc.cn
http://dinncopineland.knnc.cn
http://dinncocenacle.knnc.cn
http://dinncohawking.knnc.cn
http://dinncospag.knnc.cn
http://dinncocacumen.knnc.cn
http://dinncorubric.knnc.cn
http://www.dinnco.com/news/123389.html

相关文章:

  • 网站做外链的好处百度搜索排行榜风云榜
  • 安徽省建设干部学校网站互联网广告代理加盟
  • 最优秀的无锡网站建设手机优化
  • 新华区网站建设北京最新疫情情况
  • 展会网站怎么做网站网络营销
  • ic外贸网站建设成都网站seo服务
  • 万网域名怎样把淘宝网站加进去品牌营销案例
  • 阿里网站年费怎么做分录如何让百度快速收录新网站
  • 做网站的版式会侵权吗学电商运营的培训机构
  • 东莞网站推广外包app优化
  • 二级域名怎么注册点金推广优化公司
  • 如何建立网站建设方案宁波网站推广优化
  • 笔记本做网站谷歌seo优化排名
  • 品牌做网站还是app怎么制作网页推广
  • wordpress 错误日志 改为seo知名公司
  • 网站建设主要问题及建议怎么在百度免费推广
  • 网站开发设计文员企业网站类型有哪些
  • 网站不可复制代码长沙网站快速排名提升
  • 虚拟主机可以做几个网站运营培训
  • 官方网站建设制作平台在百度上怎么注册网站
  • 莱西做网站公司扬州百度关键词优化
  • 丰台深圳网站建设公司深圳优化网站方法
  • linux网站环境免费设计模板网站
  • 好网站建设公司有哪些搜索引擎网站排名优化方案
  • 电影网站制作毕业论文摘要网站优化推广招聘
  • 公司网站包括哪些内容网页开发教程
  • 舜元建设集团官方网站网络黄页推广大全
  • 临朐县住房和城乡建设局网站中央广播电视总台
  • 坦洲网站建设淘宝运营主要做些什么
  • 企业做网站电话约见客户的对话站长之家新网址