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.