[SPTSDKUX-5571] changing screenshot save logic 76/237776/9
authorRahul Dadhich <r.dadhich@samsung.com>
Fri, 3 Jul 2020 09:02:26 +0000 (14:32 +0530)
committerKarthik Bhat <kv.bhat@samsung.com>
Mon, 6 Jul 2020 05:03:20 +0000 (05:03 +0000)
Change-Id: I9dc024ecccf6f4087f49d9d478dbfbb30fd16c94
Signed-off-by: Rahul Dadhich <r.dadhich@samsung.com>
tizen/src/ui/menu/screenshotdialog.cpp

index c57a7bb..be5e7b7 100644 (file)
@@ -177,9 +177,12 @@ bool ScreenShotDialog::slotSave()
         return false;
     }
 
-    QPixmap pixmap(shotData);
+    QImage image(scene->sceneRect().size().toSize(), QImage::Format_ARGB32);  // Create the image with the exact size of the shrunk scene
+    image.fill(Qt::transparent);                                              // Start all pixels transparent
+    QPainter painter(&image);
+    scene->render(&painter);
     qDebug() << filename;
-    pixmap.save(filename);
+    image.save(filename);
 
     return true;
 }
@@ -190,8 +193,12 @@ void ScreenShotDialog::slotCopy()
 
     QClipboard *clipboard = QApplication::clipboard();
     if (clipboard != NULL) {
+       QImage image(scene->sceneRect().size().toSize(), QImage::Format_ARGB32);  // Create the image with the exact size of the shrunk scene
+       image.fill(Qt::transparent);                                              // Start all pixels transparent
+       QPainter painter(&image);
+       scene->render(&painter);
         clipboard->clear();
-        clipboard->setPixmap(shotData);
+        clipboard->setImage(image);
     } else {
         qWarning("cannot copy to clipboard");
     }