StupidBeauty
Read times:1261Posted at:Thu Jan 5 04:25:16 2012
- no title specified

转载:Capturing screenshot with Phonon::VideoWidget::snapshot()

在这漏洞满天飞的年代,遇到臭虫很正常。Phonon有臭虫,导致VideoWidget::snapshot()函数无效。替代方法是QPixmap snapshot = QPixmap ::grabWindow( vwidget ->winId());

http://developer.qt.nokia.com/forums/viewthread/2487

亮点:

inally I got it working by changing this line:

  1. 1.const QPixmap& snapshot = QPixmap::grabWidget(m_videoPlayer->videoWidget());

to

  1. 1.const QPixmap& snapshot = QPixmap::grabWindow(m_videoPlayer->videoWidget()->winId());

As from the documentation, the QPixmap::grabWindow() function grabs pixels from the screen, not from the window, i.e. if there is another window partially or entirely over the one you grab, you get pixels from the overlying window, too. The mouse cursor is generally not grabbed.

The window system identifier (WId) can be retrieved using the QWidget::winId() function. The rationale for using a window identifier and not a QWidget, is to enable grabbing of windows that are not part of the application, window system frames, and so on.

Anyway I think it is definitely a bug in Phonon, so I will submit a test report soon. Thanks again for your time! :)

Your opinions
Your name:Email:Website url:Opinion content:
- no title specified

HxLauncher: Launch Android applications by voice commands