QT5 QList<QImage> 中后面数据将前面数据覆盖问题的解决方案

QT5 中有一个Implicit Sharing的概念,叫做隐式共享,许多QT中许多C++类用隐式数据共享来减少copy带来的资源占用问题。

当作为参数传递时,隐式数据共享是安全和高效的,因为仅仅是指向数据的指针进行传递,而数据只在有函数对它进行改写是才进行复制。(copy on write)


QT的如下类均用到了这个机理,如果不希望进行隐式共享,则需要多加注意了。

QDBusPendingCall

The QDBusPendingCall class refers to one pending asynchronous call

QDBusUnixFileDescriptor

The QDBusUnixFileDescriptor class holds one Unix file descriptor.

QBitmap

The QBitmap class provides monochrome (1-bit depth) pixmaps.

QIcon

The QIcon class provides scalable icons in different modes and states.

QImage

The QImage class provides a hardware-independent image representation that allows direct access to the pixel data, and can be used as a paint device.

QPicture

The QPicture class is a paint device that records and replays QPainter commands.

QPixmap

The QPixmap class is an off-screen image representation that can be used as a paint device.

QCursor

The QCursor class provides a mouse cursor with an arbitrary shape.

QKeySequence

The QKeySequence class encapsulates a key sequence as used by shortcuts.

QPalette

The QPalette class contains color groups for each widget state.

QOpenGLDebugMessage

The QOpenGLDebugMessage class wraps an OpenGL debug message.

QBrush

The QBrush class defines the fill pattern of shapes drawn by QPainter.

QGradient

The QGradient class is used in combination with QBrush to specify gradient fills.

QPainterPath

The QPainterPath class provides a container for painting operations, enabling graphical shapes to be constructed and reused.

QPen

The QPen class defines how a QPainter should draw lines and outlines of shapes.

QPolygon

The QPolygon class provides a vector of points using integer precision.

QPolygonF

The QPolygonF class provides a vector of points using floating point precision.

QRegion

The QRegion class specifies a clip region for a painter.

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值