Qt画图时有时需要从源文件的图片中截取某一部分置入目标区域,这时使用
void QPainter::drawImage(const QRect & target, const QImage & image, const QRect & source, Qt::ImageConversionFlags flags = Qt::AutoColor)重载方法
英文文档:This is an overloaded function.
Draws the rectangular portion source of the given image into the target rectangle in the paint device.
Note: The image is scaled to fit the rectangle, if both the image and rectangle size disagree.
将image中处于source位置(矩形)的部分画面画入target(矩形)中,若大小不一致,则自适应大小。
本文介绍如何使用Qt的QPainter::drawImage方法,从源图片中截取特定部分并自适应地放置到目标区域。这对于实现复杂的UI设计非常有用,尤其是在需要精确控制图像显示的情况下。

3282

被折叠的 条评论
为什么被折叠?



