Obsolete Members for QPixmap

以下成员源于类 QPixmap 已过时。 提供它们是为使旧源代码能继续工作。强烈建议不要在新代码中使用它们。

公共函数

(obsolete) void fill (const QPaintDevice * device , const QPoint & p )
(obsolete) void fill (const QPaintDevice * device , int x , int y )
(obsolete) int serialNumber () const

静态公共成员

(obsolete) QPixmap grabWidget (QObject * widget , const QRect & rectangle )
(obsolete) QPixmap grabWidget (QObject * widget , int x = 0, int y = 0, int w = -1, int h = -1)
(obsolete) QPixmap grabWindow (WId window , int x = 0, int y = 0, int width = -1, int height = -1)

成员函数文档编制

void QPixmap:: fill (const QPaintDevice * device , const QPoint & p )

使用 QPainter or the fill( QColor ) overload instead.

void QPixmap:: fill (const QPaintDevice * device , int x , int y )

使用 QPainter or the fill( QColor ) overload instead.

[static] QPixmap QPixmap:: grabWidget ( QObject * widget , const QRect & rectangle )

使用 QWidget::grab () 代替。

[static] QPixmap QPixmap:: grabWidget ( QObject * widget , int x = 0, int y = 0, int w = -1, int h = -1)

使用 QWidget::grab () 代替。

[static] QPixmap QPixmap:: grabWindow ( WId window , int x = 0, int y = 0, int width = -1, int height = -1)

创建并返回通过抓取内容构造的像素图,为给定 window 限定通过 QRect ( x , y , width , height ).

自变量 ( x , y ) 指定窗口偏移,而 ( width , height ) 指定要拷贝的区域。若 width 为负,函数将拷贝一切直到窗口右边界。若 height 为负,函数将拷贝一切直到窗口底部。

窗口系统标识符 ( WId ) 可以检索使用 QWidget::winId () 函数。基本原理是使用窗口标识符而非 QWidget ,允许抓取不属于应用程序的窗口、窗口系统框架、等等。

grabWindow() 函数从屏幕而不是窗口抓取像素,即:若抓取的窗口之上有另一窗口的部分或全部,也会获取上面窗口的像素。通常,鼠标光标不被抓取。

注意:在 X11 若给定 window 没有如根窗口的相同深度,且另一窗口部分 (或完全) 遮盖抓取,将 not 获取上方窗口的像素。像素图遮盖区域的内容将是未定义和未初始化的。

在 Windows、Vista 及更高版本抓取分层窗口,创建通过设置 Qt::WA_TranslucentBackground 属性, 会不工作。相反,抓取桌面 Widget 应该工作。

警告: 一般而言,抓住屏幕外区域是不安全的。这取决于底层窗口系统。

警告: The function is deprecated in Qt 5.0 since there might be platform plugins in which window system identifiers ( WId ) are local to a screen. Use QScreen::grabWindow () 代替。

另请参阅 grabWidget (), 屏幕截图范例 ,和 QScreen .

int QPixmap:: serialNumber () const

返回的数字标识内容对于此 QPixmap 对象。截然不同的 QPixmap objects can only have the same serial number if they refer to the same contents (but they don't have to).

使用 cacheKey () 代替。

警告: The serial number doesn't necessarily change when the pixmap is altered. This means that it may be dangerous to use it as a cache key. For caching pixmaps, we recommend using the QPixmapCache class whenever possible.