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

怎么做网站的防盗链大兴建设网站

怎么做网站的防盗链,大兴建设网站,彬县网,抚顺 网站建设qt-C笔记之按行读取文件并切换复选框打印复选框拼接出的字符串 code review! 文章目录 qt-C笔记之按行读取文件并切换复选框打印复选框拼接出的字符串1.运行2.文件结构3.main.cc4.main.pro5.a.txt6.b.txt 1.运行 2.文件结构 3.main.cc 代码 #include QApplication #…qt-C笔记之按行读取文件并切换复选框打印复选框拼接出的字符串 code review! 文章目录 qt-C笔记之按行读取文件并切换复选框打印复选框拼接出的字符串1.运行2.文件结构3.main.cc4.main.pro5.a.txt6.b.txt 1.运行 2.文件结构 3.main.cc 代码 #include QApplication #include QCheckBox #include QDebug #include QFile #include QPushButton #include QTextStream #include QVBoxLayout #include QWidgetint main(int argc, char *argv[]) {QApplication app(argc, argv);// 创建主窗口QWidget window;window.setWindowTitle(文件读取示例);// 创建按钮1QPushButton button1(读取文件1);// 创建按钮2QPushButton button2(读取文件2);// 创建按钮3用于拼接并打印选中的复选框内容QPushButton button3(拼接并打印选中内容);// 创建一个 QVBoxLayout 用于显示 QCheckBoxQVBoxLayout *layout new QVBoxLayout(window);window.setLayout(layout);bool layoutIsEmpty true; // 用于标记布局是否为空// 存储选中的复选框的文本内容QString selectedText;// 连接按钮1的点击事件QObject::connect(button1, QPushButton::clicked, []() {// 如果布局不为空清空 QVBoxLayout 中的内容// 方法1:使用QLayout::removeWidget方法if (!layoutIsEmpty) {QLayoutItem *item;while ((item layout-takeAt(0)) ! nullptr) {QCheckBox *checkBox qobject_castQCheckBox *(item-widget());if (checkBox) {layout-removeWidget(checkBox);delete checkBox;}delete item;}}// 读取文件1内容并添加到 QVBoxLayoutQFile file(/home/user/qt_normal_test/mytest2/a.txt);if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {QTextStream in(file);for (int i 0; i 10 !in.atEnd(); i) {QString line in.readLine();QCheckBox *checkBox new QCheckBox(line);layout-addWidget(checkBox);}file.close();} else {qDebug() Error opening file 1: file.errorString();}layoutIsEmpty false; // 布局不再为空});// 连接按钮2的点击事件QObject::connect(button2, QPushButton::clicked, []() {// 如果布局不为空清空 QVBoxLayout 中的内容// 方法1:使用QLayout::removeWidget方法if (!layoutIsEmpty) {QLayoutItem *item;while ((item layout-takeAt(0)) ! nullptr) {QCheckBox *checkBox qobject_castQCheckBox *(item-widget());if (checkBox) {layout-removeWidget(checkBox);delete checkBox;}delete item;}}// 读取文件2内容并添加到 QVBoxLayoutQFile file(/home/user/qt_normal_test/mytest2/b.txt);if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {QTextStream in(file);for (int i 0; i 10 !in.atEnd(); i) {QString line in.readLine();QCheckBox *checkBox new QCheckBox(line);layout-addWidget(checkBox);}file.close();} else {qDebug() Error opening file 2: file.errorString();}layoutIsEmpty false; // 布局不再为空});// 连接按钮3的点击事件QObject::connect(button3, QPushButton::clicked, []() {// 遍历 QVBoxLayout 中的复选框拼接选中的文本内容selectedText.clear(); // 清空已存储的选中文本内容for (int i 0; i layout-count(); i) {QCheckBox *checkBox qobject_castQCheckBox *(layout-itemAt(i)-widget());if (checkBox checkBox-isChecked()) {if (!selectedText.isEmpty()) {selectedText ; // 在文本之间插入一个空格}selectedText checkBox-text();}}// 打印选中的文本内容qDebug() 选中的内容 selectedText;});// 将按钮添加到主窗口layout-addWidget(button1);layout-addWidget(button2);layout-addWidget(button3);window.show();return app.exec(); } 4.main.pro 代码 QT widgetsTARGET FileContentReader TEMPLATE appSOURCES main.cppHEADERS FORMS DISTFILES \5.a.txt 代码 66666666 77777777 88888888 99999999 101010106.b.txt 代码 111111111111 222222222222 333333333333
http://www.pierceye.com/news/194614/

相关文章:

  • 整站优化费用中国网新重庆
  • 找别人做网站wordpress怎么更改栏目权限
  • 珠海市建设工程质量监督检测站网站在小网站上做点击广告
  • 网站拉圈圈接口怎么做传媒网站设计
  • 淘宝客做的最好的网站盐山建网站
  • 西城企业网站建设深圳设计网站多少钱
  • 电子商务网站建设a卷网站建设厘金手指排名二一
  • 网站空间便宜网站的信息管理建设的必要性
  • 校级特色专业建设网站博达站群网站建设教程
  • 有没有做任务的网站吗网站首页开发
  • 公司名字变了网站备案济南网站建设公司哪个好点呢
  • 图书馆网站建设的规章制度企业免费招聘网站
  • 效果图网站大全系统优化的例子
  • 京东的网站建设介绍网站开发要源码多少钱
  • 东莞网站制作公司报价企业定制
  • 创同盟做网站生成拼贴的网站
  • 网站备案号查电话号码商场网站开发
  • 手机网站建站教育模板下载泰州公司注册
  • 如何做商业网站推广西安市城乡建设管理局网站的公示栏
  • 上海做兼职哪个网站腾讯企业邮箱域名是什么
  • 霸州网站制作棋牌网站建设源码
  • 茶叶网站制作模板网页设计在安阳工资多少
  • 网站建设项目验收方案自己做捕鱼网站能不能挣钱
  • 微信网页网站怎么做我为群众办实事实践活动
  • 建设银行发卡银行网站福州 网站设计
  • 网站备案号码舟山高端网站建设
  • 买奢侈品代工厂做的产品的网站名建立网站 英语怎么说
  • 网站访问者qq计算机等级培训机构
  • 可以让外国人做问卷调查的网站济南优化seo网站建设公司
  • odoo做网站创建企业需要什么条件