1 Star 2 Fork 0

Eric/ImageCppQmlDemo

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
colorimageprovider.h 757 Bytes
一键复制 编辑 原始数据 按行查看 历史
Eric 提交于 2020-01-13 15:55 . update
#ifndef COLORIMAGEPROVIDER_H
#define COLORIMAGEPROVIDER_H
#include<QQuickImageProvider>
class ColorImageProvider : public QQuickImageProvider
{
public:
ColorImageProvider()
: QQuickImageProvider(QQuickImageProvider::Pixmap)
{
}
QPixmap requestPixmap(const QString &id, QSize *size, const QSize &requestedSize)
{
int width = 100;
int height = 50;
if (size)
*size = QSize(width, height);
QPixmap pixmap(requestedSize.width() > 0 ? requestedSize.width() : width,
requestedSize.height() > 0 ? requestedSize.height() : height);
pixmap.fill(QColor(id).rgba());
return pixmap;
}
};
#endif // COLORIMAGEPROVIDER_H
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/jiushiguang_zhiyun/ImageCppQmlDemo.git
git@gitee.com:jiushiguang_zhiyun/ImageCppQmlDemo.git
jiushiguang_zhiyun
ImageCppQmlDemo
ImageCppQmlDemo
master

搜索帮助