From 51bfde681ef7baf03c13a0138a6a88e76ed6b255 Mon Sep 17 00:00:00 2001 From: Craig Watson Date: Tue, 22 Dec 2015 17:57:38 +0100 Subject: [PATCH] Replace deprecated QPixmap::grabWindow function --- src/gui/UBScreenMirror.cpp | 5 +++-- src/podcast/UBPodcastController.cpp | 7 ++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/gui/UBScreenMirror.cpp b/src/gui/UBScreenMirror.cpp index a4cda1be..c97ecef8 100644 --- a/src/gui/UBScreenMirror.cpp +++ b/src/gui/UBScreenMirror.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); diff --git a/src/podcast/UBPodcastController.cpp b/src/podcast/UBPodcastController.cpp index 7dbb3644..1a680c78 100644 --- a/src/podcast/UBPodcastController.cpp +++ b/src/podcast/UBPodcastController.cpp @@ -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);