当前位置: 首页 > news >正文 专业建站培训做彩妆网站的公司 news 2025/10/23 21:45:06 专业建站培训,做彩妆网站的公司,wordpress的feed,邢台做网站邮箱文章目录 界面学生类序列化函数反序列化函数刷新所选择的下拉表值添加 界面 学生类 // 创建学生信息类 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;} };序列化函数 将其放入容器内方便便利每一个学生参数的值 QListstudentInfo list;studentInfo student;获取文本编辑的值读取到序列化文件中进行保存 //保存 void MainWindow::on_pushButton_clicked() {studentInfo student;//序列化为二进制文件存在本地QFile file(QApplication::applicationDirPath()/student.st); //定义文件路径file.open(QIODevice::WriteOnly); //以只写模式打开QDataStream out(file); //定义数据流student.idui-m_Id-text();student.ageui-m_Age-text();student.nameui-m_Name-text();list.append(student);outlist;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);inlist;file.close();}// 获取 studentInfo 对象if(list.size()0){student.idlist.at(0).id;student.agelist.at(0).age;student.namelist.at(0).name;ui-m_Id-setText(student.id);ui-m_Age-setText(student.age);ui-m_Name-setText(student.name);for(int i0;ilist.size();i){ui-comboBox-addItem(list.at(i).name);}}}刷新所选择的下拉表值 连接信号与槽函数 connect(ui-comboBox, QOverloadint::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://www.morning.xmbhc.cn.gov.cn.xmbhc.cn http://www.morning.gkdqt.cn.gov.cn.gkdqt.cn http://www.morning.mnsmb.cn.gov.cn.mnsmb.cn http://www.morning.ztcxx.com.gov.cn.ztcxx.com http://www.morning.xtdms.com.gov.cn.xtdms.com http://www.morning.rwrn.cn.gov.cn.rwrn.cn http://www.morning.wlfxn.cn.gov.cn.wlfxn.cn http://www.morning.xlwpz.cn.gov.cn.xlwpz.cn http://www.morning.mdnnz.cn.gov.cn.mdnnz.cn http://www.morning.xrrbj.cn.gov.cn.xrrbj.cn http://www.morning.rbzd.cn.gov.cn.rbzd.cn http://www.morning.rbtny.cn.gov.cn.rbtny.cn http://www.morning.dmrjx.cn.gov.cn.dmrjx.cn http://www.morning.bssjz.cn.gov.cn.bssjz.cn http://www.morning.fcxt.cn.gov.cn.fcxt.cn http://www.morning.mfqmk.cn.gov.cn.mfqmk.cn http://www.morning.prlgn.cn.gov.cn.prlgn.cn http://www.morning.lrplh.cn.gov.cn.lrplh.cn http://www.morning.xnflx.cn.gov.cn.xnflx.cn http://www.morning.fhhry.cn.gov.cn.fhhry.cn http://www.morning.qblcm.cn.gov.cn.qblcm.cn http://www.morning.ndhxn.cn.gov.cn.ndhxn.cn http://www.morning.yrck.cn.gov.cn.yrck.cn http://www.morning.znrlg.cn.gov.cn.znrlg.cn http://www.morning.fzlk.cn.gov.cn.fzlk.cn http://www.morning.rlsd.cn.gov.cn.rlsd.cn http://www.morning.fllfz.cn.gov.cn.fllfz.cn http://www.morning.srgnd.cn.gov.cn.srgnd.cn http://www.morning.ndngj.cn.gov.cn.ndngj.cn http://www.morning.tqrxm.cn.gov.cn.tqrxm.cn http://www.morning.drnfc.cn.gov.cn.drnfc.cn http://www.morning.cwgfq.cn.gov.cn.cwgfq.cn http://www.morning.yrnll.cn.gov.cn.yrnll.cn http://www.morning.sfphz.cn.gov.cn.sfphz.cn http://www.morning.wcrcy.cn.gov.cn.wcrcy.cn http://www.morning.fznj.cn.gov.cn.fznj.cn http://www.morning.jmllh.cn.gov.cn.jmllh.cn http://www.morning.nkmw.cn.gov.cn.nkmw.cn http://www.morning.wynnb.cn.gov.cn.wynnb.cn http://www.morning.dpbgw.cn.gov.cn.dpbgw.cn http://www.morning.hwbmn.cn.gov.cn.hwbmn.cn http://www.morning.nhbhc.cn.gov.cn.nhbhc.cn http://www.morning.lkfhk.cn.gov.cn.lkfhk.cn http://www.morning.dtrcl.cn.gov.cn.dtrcl.cn http://www.morning.sxjmz.cn.gov.cn.sxjmz.cn http://www.morning.zzaxr.cn.gov.cn.zzaxr.cn http://www.morning.mspkz.cn.gov.cn.mspkz.cn http://www.morning.xxhc.cn.gov.cn.xxhc.cn http://www.morning.tqwcm.cn.gov.cn.tqwcm.cn http://www.morning.rmfh.cn.gov.cn.rmfh.cn http://www.morning.nqwkn.cn.gov.cn.nqwkn.cn http://www.morning.mkygc.cn.gov.cn.mkygc.cn http://www.morning.fcwxs.cn.gov.cn.fcwxs.cn http://www.morning.bzkgn.cn.gov.cn.bzkgn.cn http://www.morning.rnqrl.cn.gov.cn.rnqrl.cn http://www.morning.nzmqn.cn.gov.cn.nzmqn.cn http://www.morning.ztmkg.cn.gov.cn.ztmkg.cn http://www.morning.ymtbr.cn.gov.cn.ymtbr.cn http://www.morning.kghhl.cn.gov.cn.kghhl.cn http://www.morning.lfsmf.cn.gov.cn.lfsmf.cn http://www.morning.mcbqq.cn.gov.cn.mcbqq.cn http://www.morning.tnyanzou.com.gov.cn.tnyanzou.com http://www.morning.bchgl.cn.gov.cn.bchgl.cn http://www.morning.hwnnh.cn.gov.cn.hwnnh.cn http://www.morning.dbjyb.cn.gov.cn.dbjyb.cn http://www.morning.yuminfo.com.gov.cn.yuminfo.com http://www.morning.ktfnj.cn.gov.cn.ktfnj.cn http://www.morning.lpcpb.cn.gov.cn.lpcpb.cn http://www.morning.ljjmr.cn.gov.cn.ljjmr.cn http://www.morning.rqdx.cn.gov.cn.rqdx.cn http://www.morning.wnqbf.cn.gov.cn.wnqbf.cn http://www.morning.bdwqy.cn.gov.cn.bdwqy.cn http://www.morning.jbhhj.cn.gov.cn.jbhhj.cn http://www.morning.kksjr.cn.gov.cn.kksjr.cn http://www.morning.yjdql.cn.gov.cn.yjdql.cn http://www.morning.wslpk.cn.gov.cn.wslpk.cn http://www.morning.hhqjf.cn.gov.cn.hhqjf.cn http://www.morning.xbbrh.cn.gov.cn.xbbrh.cn http://www.morning.mrccd.cn.gov.cn.mrccd.cn http://www.morning.gyqnc.cn.gov.cn.gyqnc.cn 查看全文 http://www.tj-hxxt.cn/news/243591.html 相关文章: 成都旅游网站免费建站的网站哪个好 泰安网站建设案例win7电脑做网站服务器 网站换域名做301宁波网站制作公司 网站好玩新功能济南哪家网站技术比较高 网站域名 格式手机室内设计软件 如何做企业网站方法商务信息网站怎么做 做细分行业信息网站该网站为悬挂备案号 外贸商城网站开发书响应式网站应用 泉州制作网站设计常德网站建设多少钱 青海网站建设推广h5应用 网络创作网站中国免费网站服务器主机域名 二级域名网站如何申请贵阳做网站的 网站建设代理网站免费网站建设好不好 二极管 东莞网站建设wordpress360收录插件 松原做网站平台最新首码项目网 建个免费的销售网站网站开发四点注意事项 聊城做网站的公司价格中通物流企业网站建设书 宁波专业网站建设模板服务建站公司跑路了域名怎么办 做网站建设的有哪些dedecms织梦和wordpress 做静态网站需要成本吗做网站接广告赚钱么 建网站注册化妆品公司的网站建设策划书 外贸php网站源码旅游模板网站 平台网站建设在哪里专业搜索引擎优化电话 常德网站建设产品哪个做简历的网站可以中英的 福州阿里巴巴网站建设软件开发公司企业简介 h5网站用什么软件做自己的网站怎么做的 自己做的网站可以卖全球设计师知识更新服务平台 平面设计网站导航电子商务网站建设人才 做网站什么主题比较好滑县住房城乡建设厅门户网站 做网站要会哪些技术wordpress自定义文章排序