Replace deprecated QPixmap::grabWindow function

preferencesAboutTextFull
Craig Watson 9 years ago
parent 7e2b463853
commit 51bfde681e
  1. 5
      src/gui/UBScreenMirror.cpp
  2. 7
      src/podcast/UBPodcastController.cpp

@ -98,8 +98,9 @@ void UBScreenMirror::grabPixmap()
// WHY HERE?
// this is the case we are showing the desktop but the is no widget and we use the last widget rectagle to know
// what we have to grab. Not very good way of doing
WId windowID = qApp->desktop()->screen(mScreenIndex)->winId();
mLastPixmap = QPixmap::grabWindow(windowID, mRect.x(), mRect.y(), mRect.width(), mRect.height());
QDesktopWidget * desktop = QApplication::desktop();
QScreen * screen = QApplication::primaryScreen();
mLastPixmap = screen->grabWindow(desktop->effectiveWinId(), mRect.x(), mRect.y(), mRect.width(), mRect.height());
}
mLastPixmap = mLastPixmap.scaled(width(), height(), Qt::KeepAspectRatio, Qt::SmoothTransformation);

@ -761,7 +761,12 @@ void UBPodcastController::timerEvent(QTimerEvent *event)
&& event->timerId() == mScreenGrabingTimerEventID
&& mSourceWidget == qApp->desktop())
{
QPixmap desktop = QPixmap::grabWindow(qApp->desktop()->screen(UBApplication::applicationController->displayManager()->controleScreenIndex())->winId());
QDesktopWidget * dtop = QApplication::desktop();
QRect dtopRect = dtop->screenGeometry();
QScreen * screen = QApplication::primaryScreen();
QPixmap desktop = screen->grabWindow(dtop->effectiveWinId(),
dtopRect.x(), dtopRect.y(), dtopRect.width(), dtopRect.height());
{
QPainter p(&mLatestCapture);

Loading…
Cancel
Save