From 6bb7746d174b799082e2feb05364a65d9fd6b214 Mon Sep 17 00:00:00 2001 From: lupoDharkael Date: Sun, 30 Jul 2017 18:08:02 +0200 Subject: [PATCH] Fix problem with save dialog and clipboard copy --- src/capture/capturewidget.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/capture/capturewidget.cpp b/src/capture/capturewidget.cpp index c1660279..a687feb9 100644 --- a/src/capture/capturewidget.cpp +++ b/src/capture/capturewidget.cpp @@ -364,8 +364,16 @@ void CaptureWidget::keyPressEvent(QKeyEvent *e) { QString CaptureWidget::saveScreenshot(bool toClipboard) { QString savePath, saveMessage; - bool ok = false; SystemNotification notify; + if (toClipboard) { + if (m_selection.isNull()) { // copy full screen when no selection + QApplication::clipboard()->setPixmap(m_screenshot->getScreenshot()); + } else { + QApplication::clipboard()->setPixmap(m_screenshot->getScreenshot() + .copy(getExtendedSelection())); + } + } + bool ok = false; if(m_forcedSavePath.isEmpty()) { if(isVisible()) { hide(); @@ -380,9 +388,6 @@ QString CaptureWidget::saveScreenshot(bool toClipboard) { notify.sendMessage(saveMessage); } } - if (toClipboard) { - copyScreenshot(); - } if(ok) { saveMessage = tr("Capture saved in ") + savePath; notify.sendMessage(saveMessage); @@ -392,9 +397,9 @@ QString CaptureWidget::saveScreenshot(bool toClipboard) { } void CaptureWidget::copyScreenshot() { - if (m_selection.isNull()) { + if (m_selection.isNull()) { // copy full screen when no selection QApplication::clipboard()->setPixmap(m_screenshot->getScreenshot()); - } else { // copy full screen when no selection + } else { QApplication::clipboard()->setPixmap(m_screenshot->getScreenshot() .copy(getExtendedSelection())); }