From d3140a9ad69b81c28200b8d9d46aa72f31201ac1 Mon Sep 17 00:00:00 2001 From: Yuriy Puchkov Date: Mon, 22 Feb 2021 17:38:21 +0200 Subject: [PATCH] QPixmap use the other overload which returns QPixmap by-value (cherry picked from commit 65ff17441628e20c4890f806d02f53647b9e1277) --- src/widgets/capturelauncher.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/widgets/capturelauncher.cpp b/src/widgets/capturelauncher.cpp index d120b80d..74e834cd 100644 --- a/src/widgets/capturelauncher.cpp +++ b/src/widgets/capturelauncher.cpp @@ -116,12 +116,24 @@ void CaptureLauncher::startDrag() { QDrag* dragHandler = new QDrag(this); QMimeData* mimeData = new QMimeData; +#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)) + mimeData->setImageData(m_imageLabel->pixmap(Qt::ReturnByValue)); +#else mimeData->setImageData(m_imageLabel->pixmap()); +#endif dragHandler->setMimeData(mimeData); +#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)) + dragHandler->setPixmap( + m_imageLabel->pixmap(Qt::ReturnByValue) + .scaled( + 256, 256, Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation)); + dragHandler->exec(); +#else dragHandler->setPixmap(m_imageLabel->pixmap()->scaled( 256, 256, Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation)); dragHandler->exec(); +#endif } void CaptureLauncher::connectCaptureSlots()