Verified Commit b2bd3c3d authored by Antonio Prcela's avatar Antonio Prcela 🏞
Browse files

Cancel drag and drop if there is no screenshot in the preview.

parent 25e28f6c
......@@ -174,6 +174,7 @@ KSWidget::KSWidget(Platform::GrabModes theGrabModes, QWidget *parent)
mPlaceholderLabel->setTextInteractionFlags(Qt::NoTextInteraction);
mPlaceholderLabel->setWordWrap(true);
mPlaceholderLabel->setAlignment(Qt::AlignCenter);
mPlaceholderLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
// Match opacity of QML placeholder label component
auto *effect = new QGraphicsOpacityEffect(mPlaceholderLabel);
effect->setOpacity(0.5);
......@@ -227,6 +228,7 @@ bool KSWidget::isScreenshotSet()
void KSWidget::showPlaceholderText(const QString &label)
{
mImageWidget->hide();
mPlaceholderLabel->setText(label);
mPlaceholderLabel->show();
}
......@@ -236,6 +238,7 @@ void KSWidget::setScreenshotPixmap(const QPixmap &thePixmap)
if (mPlaceholderLabel->isVisible()) {
mPlaceholderLabel->hide();
}
mImageWidget->show();
mImageWidget->setScreenshot(thePixmap);
}
......
......@@ -518,6 +518,9 @@ void SpectacleCore::populateCommandLineParser(QCommandLineParser *lCmdLineParser
void SpectacleCore::doStartDragAndDrop()
{
auto lExportManager = ExportManager::instance();
if (lExportManager->pixmap().isNull()) {
return;
}
QUrl lTempFile = lExportManager->tempSave();
if (!lTempFile.isValid()) {
return;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment