Merge pull request #532 from salahmak/esc-cancel-upload

Pressing escape hides PreviewUploadOverlay
This commit is contained in:
DeepBlueV7.X 2021-03-20 23:15:28 +00:00 committed by GitHub
commit e46ddbbb45
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 0 deletions

View file

@ -203,3 +203,14 @@ PreviewUploadOverlay::setPreview(const QString &path)
setLabels(split[1], mime.name(), data_.size()); setLabels(split[1], mime.name(), data_.size());
init(); init();
} }
void
PreviewUploadOverlay::keyPressEvent(QKeyEvent *event)
{
if (event->matches(QKeySequence::Cancel)) {
emit aborted();
close();
} else {
QWidget::keyPressEvent(event);
}
}

View file

@ -25,6 +25,7 @@ public:
void setPreview(const QImage &src, const QString &mime); void setPreview(const QImage &src, const QString &mime);
void setPreview(const QByteArray data, const QString &mime); void setPreview(const QByteArray data, const QString &mime);
void setPreview(const QString &path); void setPreview(const QString &path);
void keyPressEvent(QKeyEvent *event);
signals: signals:
void confirmUpload(const QByteArray data, const QString &media, const QString &filename); void confirmUpload(const QByteArray data, const QString &media, const QString &filename);