首页| 论坛| 消息
主题:zhengtianzuo系列-QmlImageProvider
zhengtianzuo发表于 2017-10-14 17:14
关于 QQuickImageProvider 官方的描述
The QQuickImageProvider class provides an interface for supporting pixmaps and threaded image requests in QML.

有时候希望将QPixmap或者QImage中的图像显示到Qml中, 这时候就需要用到QQuickImageProvider了
继承QQuickImageProvider 新建一个类:

```
class ImageProvider : public QQuickImageProvider
{
public:
ImageProvider::ImageProvider(ImageType type, Flags flags = Flags()) :
QQuickImageProvider(type, flags)
{
}
~ImageProvider(){}
QPixmap requestPixmap(const QString &id, QSize *size, const QSize &requestedSize)
{
QString strFileName = QCoreApplication::applicationDirPath() + "/" + id;
qDebug()
回帖(15):
15楼:
14楼:zhengtianzuo:崩溃的原因找到了吗? (2017-10-18 11:23) 
在emit finished();这里 ..
13楼:自强不吸:1.增大maxCount只会加大cpu的压力,而且在板子上跑,资源本来有限
2.AsyncImageRes ..

全部回帖(15)»
最新回帖
收藏本帖
发新帖