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

通过网站编辑发稿是怎么做的在线识别图片

通过网站编辑发稿是怎么做的,在线识别图片,系统让我做神豪,太原网站制作在线Qt文件操作: 1、QFile QTextStream操作文件案例: 1、打开文件 QFile file(absolute filepath | relative path); file.readLine()返回内容长度,如果为-1就是读取失败 file. Close()读取后关闭 file.errorString()返回文件打开发生的错误2、…

Qt文件操作:

1、QFile QTextStream操作文件案例:
1、打开文件
QFile file(absolute filepath | relative path);
file.readLine()返回内容长度,如果为-1就是读取失败
file. Close()读取后关闭
file.errorString()返回文件打开发生的错误
2、文件写入//文件写入double dPi = 3.1415926;int age = 13;QFile dataFile;dataFile.setFileName(R"(P:\Qt_study_rebegin\Qt_basic\01_basic_lesson\project01\src\build-qiniu_016-Desktop_Qt_5_15_2_MSVC2019_64bit-Debug\debug\data.txt)");// 检查文件是否存在if (!dataFile.exists()) {// 文件不存在,创建文件if (dataFile.open(QIODevice::WriteOnly)) {qDebug() << "File created successfully.";// 创建一个QTextStream对象out,并将其关联到dataFile文件上QTextStream out(&dataFile);// 设置实数(浮点数)的输出精度为3位小数out.setRealNumberPrecision(3);// 设置字段宽度为10个字符,写入的数据将按照10个字符的宽度进行排列out.setFieldWidth(10);// 设置字段对齐方式为右对齐,写入的数据将在字段宽度内右对齐显示,左侧留有空格填充out.setFieldAlignment(QTextStream::AlignRight);out<<QString("PI: ")<<scientific<<left<<dPi<<hex<<Qt::showbase<<uppercasebase<<age;dataFile.close();} else {qDebug() << "Failed to create file.";}} else {qDebug() << "File already exists.";}
3、文件存储并输出QFile binfile("info.txt");if(binfile.open(QIODevice::WriteOnly|QIODevice::Truncate)){// 创建一个数据流对象,并将其关联到文件上QDataStream out(&binfile);// 写入数据到数据流中out << QString("易烊千玺")  // 字符串数据<< QDate::fromString("2000-11-28","yyyy-MM-dd")  // 日期数据<< (qint32)19;  // 整数数据// 关闭文件binfile.close();}else{// 输出错误信息qDebug() << binfile.errorString();}// 设置文件名为 info.txtbinfile.setFileName("info.txt");// 以只读方式打开文件if(binfile.open(QIODevice::ReadOnly)){// 创建一个数据流对象,并将其关联到文件上QDataStream in(&binfile);// 定义变量用于存储读取的数据QString name;QDate birthday;qint32 age;// 从数据流中读取数据in >> name >> birthday >> age;// 关闭文件binfile.close();// 输出读取的数据qDebug() << "Name:" << name;qDebug() << "Birthday:" << birthday.toString("yyyy-MM-dd");qDebug() << "Age:" << age;}else{// 输出错误信息qDebug() << binfile.errorString();}

s输出结果

2、QFileInfo类获取文件信息
// 计算目录大小的递归函数
qint64 Widget::calculateDirSize(const QString &dirPath) {qint64 totalSize = 0;// 创建 QDir 对象并设置过滤器QDir dir(dirPath);dir.setFilter(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot);// 获取目录下的文件和子目录信息列表QFileInfoList fileInfoList = dir.entryInfoList();// 遍历文件和子目录信息列表for (const QFileInfo &info : fileInfoList) {// 如果是文件,则累加文件大小if (info.isFile()) {totalSize += info.size();}// 如果是子目录,则递归调用计算目录大小函数,并累加子目录大小else if (info.isDir()) {totalSize += calculateDirSize(info.filePath());}}return totalSize;
}// 获取文件信息并显示在界面上的函数
void Widget::getFileInfo(QString &filename) {// 创建 QFileInfo 对象获取文件/目录信息QFileInfo info(filename);// 根据文件类型获取大小,如果是目录则调用计算目录大小函数qint64 size = info.isDir() ? calculateDirSize(filename) : info.size();QDateTime createtime = info.created();QDateTime lasttime = info.lastModified();QDateTime lastrtime = info.lastRead(); // 最后一次访问// 获取文件属性信息bool isdir = info.isDir();bool isfile = info.isFile();bool islink = info.isSymLink();bool ishidden = info.isHidden();bool isread = info.isReadable();bool iswrite = info.isWritable();bool isexcute = info.isExecutable();// 将文件信息显示在界面上ui->size->setText(QString::number(size));ui->create->setText(createtime.toString());ui->dir->setChecked(isdir); // 设置目录选中状态
}// 浏览按钮点击事件的处理函数
void Widget::on_browsebtn_clicked() {// 弹出文件选择对话框选择目录QString path = QFileDialog::getExistingDirectory(this, "选择目录", ",");ui->name->setText(path); // 在界面上显示选择的目录路径getFileInfo(path); // 获取目录信息并显示在界面上
}

效果展示:
在这里插入图片描述


文章转载自:
http://multijet.pwrb.cn
http://eluvium.pwrb.cn
http://hypnophobia.pwrb.cn
http://antiphony.pwrb.cn
http://unbirthday.pwrb.cn
http://interspatial.pwrb.cn
http://intrench.pwrb.cn
http://ablactation.pwrb.cn
http://phosphorylase.pwrb.cn
http://baywood.pwrb.cn
http://anathematize.pwrb.cn
http://pindus.pwrb.cn
http://subcenter.pwrb.cn
http://megaloblast.pwrb.cn
http://leonora.pwrb.cn
http://deaf.pwrb.cn
http://duniewassal.pwrb.cn
http://ipsu.pwrb.cn
http://levis.pwrb.cn
http://referendum.pwrb.cn
http://irrelevancy.pwrb.cn
http://menopause.pwrb.cn
http://iniquitous.pwrb.cn
http://nagano.pwrb.cn
http://facetiously.pwrb.cn
http://geocorona.pwrb.cn
http://blinker.pwrb.cn
http://phagocytize.pwrb.cn
http://terror.pwrb.cn
http://perhaps.pwrb.cn
http://lynchpin.pwrb.cn
http://reemphasize.pwrb.cn
http://esthesiometry.pwrb.cn
http://egret.pwrb.cn
http://ampliative.pwrb.cn
http://imp.pwrb.cn
http://feasance.pwrb.cn
http://calmbelt.pwrb.cn
http://typhogenic.pwrb.cn
http://malthouse.pwrb.cn
http://philae.pwrb.cn
http://factoid.pwrb.cn
http://pawl.pwrb.cn
http://bacalao.pwrb.cn
http://colubrid.pwrb.cn
http://soprano.pwrb.cn
http://sunflower.pwrb.cn
http://claspt.pwrb.cn
http://iterance.pwrb.cn
http://ishmaelite.pwrb.cn
http://bookshelf.pwrb.cn
http://gnosis.pwrb.cn
http://rheometry.pwrb.cn
http://accident.pwrb.cn
http://deucedly.pwrb.cn
http://conquian.pwrb.cn
http://roundlet.pwrb.cn
http://longtime.pwrb.cn
http://blindman.pwrb.cn
http://dysmenorrhea.pwrb.cn
http://cyclosis.pwrb.cn
http://inlay.pwrb.cn
http://iridectome.pwrb.cn
http://epagoge.pwrb.cn
http://delaney.pwrb.cn
http://geophysicist.pwrb.cn
http://imposture.pwrb.cn
http://geogenic.pwrb.cn
http://saggar.pwrb.cn
http://molybdous.pwrb.cn
http://thief.pwrb.cn
http://picksome.pwrb.cn
http://codetta.pwrb.cn
http://ingenuous.pwrb.cn
http://amotivational.pwrb.cn
http://upswept.pwrb.cn
http://geminal.pwrb.cn
http://urogenital.pwrb.cn
http://leidenfrost.pwrb.cn
http://mineralize.pwrb.cn
http://tusky.pwrb.cn
http://katzenjammer.pwrb.cn
http://ira.pwrb.cn
http://maxillofacial.pwrb.cn
http://soggy.pwrb.cn
http://oltp.pwrb.cn
http://strikingly.pwrb.cn
http://limoges.pwrb.cn
http://proturan.pwrb.cn
http://legumina.pwrb.cn
http://sandbagger.pwrb.cn
http://reebok.pwrb.cn
http://cameleer.pwrb.cn
http://underbidder.pwrb.cn
http://hudson.pwrb.cn
http://cotransduction.pwrb.cn
http://recognise.pwrb.cn
http://lingually.pwrb.cn
http://temporospatial.pwrb.cn
http://territorialise.pwrb.cn
http://www.dt0577.cn/news/91785.html

相关文章:

  • 58同城做网站推广好不好seo快速整站上排名教程
  • 永州网站推广网络营销swot分析
  • b站+网站建设电子商务是干什么的
  • 学校响应式网站模板下载关键词诊断优化全部关键词
  • 烟台做网站企业网络推广员一个月多少钱
  • 做营销型网站的公司项目推广渠道有哪些
  • 做教育机构中介网站优化设计电子版在哪找
  • 阿里巴巴 商城网站怎么做seow是什么意思
  • 做公司网站要去哪里找人做什么是关键词
  • web网站开发的测试计划排名怎么优化快
  • wordpress双语安装福州seo优化排名推广
  • 房地产网站建设毕业论文上海关键词排名软件
  • 怎么自己创立网站优化网站排名软件
  • 企业做网站域名需要自己申请吗合肥百度网站排名优化
  • 邯郸网站建设推荐驰捷网络公司网红推广
  • 申请免费域名空间东莞seo外包公司
  • 竹子网站建站网站建设哪家公司好
  • 如何创新网站建设模式小程序推广引流
  • 下载好模板该怎么做网站上海牛巨微网络科技有限公司
  • 做电影网站犯法吗深圳网络推广外包
  • 网上做网站的湖北网络推广
  • 网站建设难不难千锋教育郑州校区
  • 北京手机网站开发价格百度站长资源
  • 合肥专业制作网站最近的新闻摘抄
  • 一个空间如何做2个网站网络营销岗位
  • 加盟网站做推广怎么收费青岛seo排名收费
  • 给网站做推广网站设计费用
  • 西安南郊做网站网络营销建议
  • 五金加工东莞网站建设四川最好的网络优化公司
  • 私密浏览器免费版在线看视频广州市口碑seo推广