返回介绍

QEmbed - File and Image Embedder

发布于 2019-10-04 15:00:07 字数 1860 浏览 833 评论 0 收藏 0

The QEmbed tool, found in qt/tools/qembed, converts arbitrary files into C++ code. This is useful for including image files and other resources directly into your application rather than loading the data from external files.

QEmbed can also generate uncompressed versions of images that can be included directly into your application, thus avoiding both the external file and the need to parse the image file format. This is useful for small images such as icons for which compression is not a great gain.

Usage

    qembed [ general-files ] [ --images image-files ]

  • general-files

    These files can be any type of file.

  • --images image-files

    These files must be in image formats supported by Qt.

Output

The output from QEmbed is a C++ header file which you should include in a C++ source file. In the source file, you should make a wrapper function that suits your application. Two functions are provided; your wrapper function could just call one of these, or you can implement your own. Here's a simple example of usage for each of the supplied functions:

qembed_findImage()

    #include "generated_qembed_file.h"

    QImage myFindImage(const char* name)
    {
        return qembed_findImage(name);
    }

Just call the generated function; name is the original image filename without the extension.

qembed_findData()
    #include "generated_qembed_file.h"

    QByteArray myFindData(const char* name)
    {
        return qembed_findData(name);
    }

Just call the generated function; name is the original filename with the extension

Alternatively, look at the output from QEmbed and write a function tailored to your needs.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文