Qt的矢量图形剪贴板格式 [英] Vector graphics clipboard format for Qt

查看:259
本文介绍了Qt的矢量图形剪贴板格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望我的Qt应用程序能够以兼容的方式将简单的矢量图形保存到剪贴板.在Windows上,我希望能够将图形粘贴到Microsoft Word或Powerpoint.在Linux上,我想与Open Office兼容.

I want my Qt application to be able to save simple vector graphics to clipboard in a compatible way. On windows I want to be able to paste the graphics into Microsoft Word or Powerpoint. On Linux I want to be compatible with the Open Office.

您会推荐哪种格式? Qt可以轻松生成EMF吗? SVG是否可以选择?

Which format would you recommend? Can Qt generate EMF in an easy way? Is SVG an option?

更新:

我当前的计划是添加一段本机的win32代码,以将图形呈现给Windows上的emf.此代码在Linux上将不可用.

My current plan is to add a piece of native win32 code to render the graphics to emf on windows. This code will not be available on linux.

推荐答案

QGraphicsView 类及其相关的辅助函数可以通过 QPicture呈现为QT图元文件格式 QSVGGenerator的a>类(您可以为其编写EMF转换程序)和SVG 类,并通过 QPrinter 后记/pdf.它还可以渲染为位图格式和其他各种目标.

The QGraphicsView class and its associated helpers can render to a QT metafile format through the QPicture class (for which you could write a translator to EMF), to SVG through the QSVGGenerator class and to postscript/pdf through QPrinter. It can also render to bitmap formats and various other targets.

AFAIK它没有通用的渲染到EMF"功能-您将不得不写入QT图元文件之类的其他内容,然后转换为EMF.如果只需要图形基元的子集,则可能只需要在翻译器中支持该子集即可.否则,您可以使用SVG,而您可以通过QSVGGenerator直接从QT获取.

AFAIK it doesn't have a generic 'render to EMF' facility - you would have to write to something else like the QT Metafile and convert to EMF. If you only need a subset of the graphics primitives you might only need to support that subset in the translator. Otherwise you could go from SVG, which you can get directly from QT through QSVGGenerator.

这篇关于Qt的矢量图形剪贴板格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆