句柄绘图qt_使用Qt的QLabel获取绘图句柄问题!

我觉得你能明确那个format没错就成功了一半了吧,对应的QImage的format应该是QImage::Format_RGB888,你可以构造的时候就传入data,或者构造完再修改也可以另外如果你传入char*作为data的话,要确保这个char*保持有效才可以,Qt是不会自己进行拷贝的,文档说的很清楚:QImage::QImage(uchar * data, int width, int he...
摘要由CSDN通过智能技术生成

我觉得你能明确那个format没错就成功了一半了吧,对应的QImage的format应该是QImage::Format_RGB888,你可以构造的时候就传入data,或者构造完再修改也可以

另外如果你传入char*作为data的话,要确保这个char*保持有效才可以,Qt是不会自己进行拷贝的,文档说的很清楚:

QImage::QImage(uchar * data, int width, int height, Format format, QImageCleanupFunction cleanupFunction = 0, void * cleanupInfo = 0)

Constructs an image with the given width, height and format, that uses an existing memory buffer, data. The width and height must be specified in pixels, data must be 32-bit aligned, and each scanline of data in the image must also be 32-bit aligned.

The buffer must remain valid throughout the life of the QImage and all copies that have not been modified or otherwise detached from the original buffer. The image does not delete the buffer at destruction. You can provide a function pointer cleanupFunction along with an extra pointer cleanupInfo that will be called when the last

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值