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

正规网站备案代理门户网站建设进一步提升

正规网站备案代理,门户网站建设进一步提升,模板网站可以自己买空间吗吗,设计衣服网站引言 之前做项目的时候#xff0c;需要自己生成一个pdf文件#xff0c;好久之前保存的草稿#xff0c;今天就把它发表一下吧#xff0c;留着自己以后有需要的时候在来查阅。 QString ReportMainWindow::createPdfFile() {QString strDirPath QDir::tempPath() /T…引言 之前做项目的时候需要自己生成一个pdf文件好久之前保存的草稿今天就把它发表一下吧留着自己以后有需要的时候在来查阅。 QString ReportMainWindow::createPdfFile() {QString strDirPath QDir::tempPath() /TempPdf;QDir dir(strDirPath);if (!dir.exists()){bool bIsCreate dir.mkdir(strDirPath);LOG_INFO(Create temp pdf dir);}QString strPdfFile strDirPath /temp.pdf;QFile pdfFile(strPdfFile); // 输出文件名if (!pdfFile.open(QIODevice::WriteOnly)){LOG_INFO(Cannot open file);return strPdfFile ;}QPdfWriter *pdfWriter new QPdfWriter(pdfFile); // 实例化QPdfWriter 可以设置PDF文件的一些参数pdfWriter-setPageSize(QPagedPaintDevice::A4); // 设置纸张为A4纸pdfWriter-setResolution(QPrinter::ScreenResolution); // 设置分辨率 屏幕分辨率 打印机分辨率// 高分辨率pdfWriter-setPageMargins(QMarginsF(30, 30, 30, 30)); // 设置页边距 顺序是:左上右下QPainter *pdfPainter new QPainter(pdfWriter); // qt绘制工具QRect viewRect pdfPainter-viewport();int nWidth viewRect.width();int nHeight viewRect.height();LOG_INFO(----viewRect width:, viewRect.width(),height:, viewRect.height());QRect reportRect this-rect();int nReportWidth reportRect.width();int nReportHeight reportRect.height();// 设置标题QTextOption option(Qt::AlignCenter); // 标题居中显示option.setWrapMode(QTextOption::WordWrap); // 标题自动换行// 设置标题字体 需要使用QT的QFontQFont font;font.setFamily(宋体); // 设置字体 微软雅黑、宋体之类的font.setPointSize(15); // 设置字体大小font.setBold(false); // 加粗pdfPainter-setFont(font);pdfPainter-drawText(QRect(170.00 / nReportWidth * nWidth, 40.00 / nReportHeight * nHeight,650.00 / nReportWidth * nWidth, 20.00 / nReportHeight * nHeight),tr(Coronary Image Reconstruction Report), option);LOG_INFO(X, 371.00 / nReportWidth * nWidth, Y,53.00 / nReportHeight * nHeight, W,450.00 / nReportWidth * nWidth, H,20.00 / nReportHeight * nHeight);option.setAlignment(Qt::AlignLeft);font.setPointSize(9); // 设置字体大小font.setBold(false); // 加粗pdfPainter-setFont(font);pdfPainter-drawText(QRect(89.00 / nReportWidth * nWidth, 75.00 / nReportHeight * nHeight,450.00 / nReportWidth * nWidth, 20.00 / nReportHeight * nHeight),tr(Institutional Information));font.setPointSize(8); // 设置字体大小font.setBold(false); // 加粗pdfPainter-setFont(font);// 以上的内容可以直接拿来使用按照自己的需求进行修改。// 下面的内容涉及到自己的项目中需要展示的参数需要自己根据情况进行改变。pdfPainter-drawText(QRect(89.00 / nReportWidth * nWidth, 105.00 / nReportHeight * nHeight,130.00 / nReportWidth * nWidth, 20.00 / nReportHeight * nHeight),tr(Hospital name:));// 这里的m_pPatientInfo.institutionName是一个结构体变量pdfPainter-drawText(QRect(169.00 / nReportWidth * nWidth, 105.00 / nReportHeight * nHeight,150.00 / nReportWidth * nWidth, 20.00 / nReportHeight * nHeight),m_pPatientInfo.institutionName);pdfPainter-drawText(QRect(664.00 / nReportWidth * nWidth, 105.00 / nReportHeight * nHeight,130.00 / nReportWidth * nWidth, 20.00 / nReportHeight * nHeight),tr(Reporting time:));pdfPainter-drawText(QRect(744.00 / nReportWidth * nWidth, 105.00 / nReportHeight * nHeight,280.00 / nReportWidth * nWidth, 20.00 / nReportHeight * nHeight),m_pPatientInfo.aquisitionTime);option.setAlignment(Qt::AlignLeft);font.setPointSize(9); // 设置字体大小font.setBold(false); // 加粗pdfPainter-setFont(font);pdfPainter-drawText( // 105QRect(89.00 / nReportWidth * nWidth, 133.00 / nReportHeight * nHeight,150.00 / nReportWidth * nWidth, 20.00 / nReportHeight * nHeight),tr(Patient Info));font.setPointSize(8); // 设置字体大小font.setBold(false); // 加粗pdfPainter-setFont(font);pdfPainter-drawText(QRect(89.00 / nReportWidth * nWidth, 161.00 / nReportHeight * nHeight,300.00 / nReportWidth * nWidth, 17.00 / nReportHeight * nHeight),tr(name));pdfPainter-drawText(QRect(139.00 / nReportWidth * nWidth, 161.00 / nReportHeight * nHeight,150.00 / nReportWidth * nWidth, 17.00 / nReportHeight * nHeight),m_pPatientInfo.patientName);pdfPainter-drawText(QRect(384.00 / nReportWidth * nWidth, 161.00 / nReportHeight * nHeight,50.00 / nReportWidth * nWidth, 17.00 / nReportHeight * nHeight),tr(gender));pdfPainter-drawText(QRect(444.00 / nReportWidth * nWidth, 161.00 / nReportHeight * nHeight,150.00 / nReportWidth * nWidth, 17.00 / nReportHeight * nHeight),m_pPatientInfo.patientSex);pdfPainter-drawText(QRect(694.00 / nReportWidth * nWidth, 161.00 / nReportHeight * nHeight,61.00 / nReportWidth * nWidth, 17.00 / nReportHeight * nHeight),tr(Date of Birth));pdfPainter-drawText(QRect(755.00 / nReportWidth * nWidth, 161.00 / nReportHeight * nHeight,130.00 / nReportWidth * nWidth, 17.00 / nReportHeight * nHeight),m_pPatientInfo.patientBirthDate);pdfPainter-drawText(QRect(89.00 / nReportWidth * nWidth, 180.00 / nReportHeight * nHeight,50.00 / nReportWidth * nWidth, 17.00 / nReportHeight * nHeight),tr(patient ID));pdfPainter-drawText(QRect(139.0 / nReportWidth * nWidth, 180.0 / nReportHeight * nHeight,150 / nReportWidth * nWidth, 17 / nReportHeight * nHeight),m_pPatientInfo.patientID);pdfPainter-drawText(QRect(384.00 / nReportWidth * nWidth, 180.00 / nReportHeight * nHeight,61.00 / nReportWidth * nWidth, 17.00 / nReportHeight * nHeight),tr(Date of inspection));pdfPainter-drawText(QRect(444.0 / nReportWidth * nWidth, 180.0 / nReportHeight * nHeight,150.00 / nReportWidth * nWidth, 17.00 / nReportHeight * nHeight),m_pPatientInfo.aquisitionDate);pdfPainter-drawText(QRect(694.00 / nReportWidth * nWidth, 180.00 / nReportHeight * nHeight,61.00 / nReportWidth * nWidth, 17.00 / nReportHeight * nHeight),tr(Image Type));pdfPainter-drawText(QRect(755.00 / nReportWidth * nWidth, 180.00 / nReportHeight * nHeight,61.00 / nReportWidth * nWidth, 17.00 / nReportHeight * nHeight),m_pPatientInfo.modality);font.setPointSize(9); // 设置字体大小font.setBold(false); // 加粗pdfPainter-setFont(font);pdfPainter-drawText(QRect(90.00 / nReportWidth * nWidth, 233.00 / nReportHeight * nHeight,150.00 / nReportWidth * nWidth, 20.00 / nReportHeight * nHeight),tr(Conclusion));pdfPainter-drawText(QRect(674.00 / nReportWidth * nWidth, 233.00 / nReportHeight * nHeight,550.00 / nReportWidth * nWidth, 20.00 / nReportHeight * nHeight),tr(The results of the report are for clinicians reference only));QPen pen(QColor(128, 128, 128));pen.setWidth(4);pen.setStyle(Qt::SolidLine);pdfPainter-setPen(pen);pdfPainter-drawLine(QLineF(90.00 / nReportWidth * nWidth, 255.00 / nReportHeight * nHeight,903.00 / nReportWidth * nWidth, 255.00 / nReportHeight * nHeight));pen.setColor(Qt::black);font.setPointSize(10); // 设置字体大小font.setFamily(宋体);font.setBold(false); // 加粗pdfPainter-setPen(pen);pdfPainter-setFont(font);double dHeight 0.00;int nEveryHeight 0;int nRow1 0;QStringList strMsg1List m_pPatientInfo.strMsg1.split(QString(\n));drawConclussionImpression(dHeight, strMsg1List, nRow1, pdfPainter,nEveryHeight, dHeight, nReportWidth,nReportHeight, nWidth, nHeight);dHeight 30.00 nEveryHeight; // qAbs fontRect.height()font.setPointSize(9); // 设置字体大小font.setBold(false); // 加粗pdfPainter-setFont(font);pdfPainter-drawText(QRect(90.00 / nReportWidth * nWidth, dHeight / nReportHeight * nHeight,150.00 / nReportWidth * nWidth, 20.00 / nReportHeight * nHeight),tr(imression));// dHeight 14;// pen.setWidth(1);// pen.setStyle(Qt::SolidLine);// pdfPainter-setPen(pen);// pdfPainter-drawLine(QLineF(// 90.00 / nReportWidth * nWidth, dHeight / nReportHeight * nHeight,// 883.00 / nReportWidth * nWidth, dHeight / nReportHeight * nHeight));dHeight 28;font.setFamily(宋体);font.setPointSize(10); // 设置字体大小font.setBold(false); // 加粗pdfPainter-setFont(font);double dUpdateHeight 0;int nRow 0;QStringList strMsg2List m_pPatientInfo.strMsg2.split(QString(\n));drawConclussionImpression(dHeight, strMsg2List, nRow, pdfPainter,nEveryHeight, dUpdateHeight, nReportWidth,nReportHeight, nWidth, nHeight);font.setFamily(宋体);font.setPointSize(9); // 设置字体大小pdfPainter-drawText(QRect(89.00 / nReportWidth * nWidth, 870.00 / nReportHeight * nHeight,130.00 / nReportWidth * nWidth, 17.00 / nReportHeight * nHeight),tr(Reporting time:));font.setFamily(Times New Roman);pdfPainter-drawText(QRect(185.00 / nReportWidth * nWidth, 870.00 / nReportHeight * nHeight,450.00 / nReportWidth * nWidth, 17.00 / nReportHeight * nHeight),m_pPatientInfo.aquisitionTime);font.setFamily(宋体);pdfPainter-drawText(QRect(400.00 / nReportWidth * nWidth, 870.00 / nReportHeight * nHeight,130.00 / nReportWidth * nWidth, 17.00 / nReportHeight * nHeight),tr(Reporting Doctor:));pdfPainter-drawText(QRect(530.00 / nReportWidth * nWidth, 870.00 / nReportHeight * nHeight,150.00 / nReportWidth * nWidth, 17.00 / nReportHeight * nHeight),m_pPatientInfo.doctorName);pdfPainter-drawText(QRect(690.00 / nReportWidth * nWidth, 870.00 / nReportHeight * nHeight,130.00 / nReportWidth * nWidth, 17.00 / nReportHeight * nHeight),tr(Reviewing physicians:));pdfPainter-drawText(QRect(820.00 / nReportWidth * nWidth, 870.00 / nReportHeight * nHeight,150.00 / nReportWidth * nWidth, 17.00 / nReportHeight * nHeight),m_pPatientInfo.strReviewingPhysicians);pen.setColor(QColor(128, 128, 128));pen.setWidth(4);pen.setStyle(Qt::SolidLine);pdfPainter-setPen(pen);pdfPainter-drawLine(QLineF(90.00 / nReportWidth * nWidth, 887.00 / nReportHeight * nHeight,903.00 / nReportWidth * nWidth, 887.00 / nReportHeight * nHeight));delete pdfPainter;delete pdfWriter;pdfFile.close();// QDesktopServices::openUrl(QUrl::fromLocalFile(strPdfFile));return strPdfFile; }注意 以上这段代码只是简单的提供了一些思路真正项目中将将一个界面中的内容生成指定格式的pdf需要自己再重新实现。
http://www.zqtcl.cn/news/825167/

相关文章:

  • 广州seo网站策划wordpress关闭主题提示
  • 做门票售卖网站怎么制作自己的水印
  • 网站绑定两个域名怎么做跳转asp 网站后台
  • 百度网站怎么做的赚钱吗郑州资助app下载
  • 成都成华区网站建设天津网站优
  • 大朗网站制作商城网站建设相关费用
  • 付费阅读网站代码搜索引擎推广方式有哪些
  • 企业网站搭建介绍一个电影的网站模板下载
  • wordpress网站插件下载郑州专业网站制作
  • 佛山南海区建网站的公司dw怎么做购物网站
  • 杭州网站关键词排名优化响应式网站好还是自适应网站好
  • 潍坊作风建设网站什么是网站建设技术
  • 网站后台图片不显示东莞市企业招聘信息网
  • 网站发布平台商业网站的网址
  • 免费的培训网站建设门户网站建设管理工作方案
  • 企业网站建设实验感想企业网络推广哪家公司好
  • 网站建设和维护视频如何入侵网站服务器
  • 怎样建设网站空间成都网站设公司
  • 百度文库账号登录入口百度seo规则最新
  • 服务器可以自己的网站吗网络营销策划与创意
  • 广州市招投标网站个人网站可以做论坛
  • 易语言做购物网站春节网站怎么做
  • 建公司网站设计网站公司做网上夫妻去哪个网站
  • 稷山网站建设wordpress单本小说采集
  • 凡客网站规划与建设ppt网站做跳转教程
  • 怎么看网站空间多大做网站旅游销售
  • 天津做手机网站建设旅游网站的目的
  • 飞机查询网站开发的创新点注册公司流程和费用大概多少钱
  • 高质量的邯郸网站建设厦门网页制作厦门小程序app
  • 建设企业网站企业网上银行官网官方二建证从住房建设厅网站调出流程