Skip to content

Commit

Permalink
Close Latest Uploads window using escape key
Browse files Browse the repository at this point in the history
  • Loading branch information
Adlanehichembr committed Jun 7, 2024
1 parent a1dda59 commit e5dba85
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/widgets/uploadhistory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <QDateTime>
#include <QDesktopWidget>
#include <QFileInfo>
#include <QKeyEvent>
#include <QPixmap>

void scaleThumbnail(QPixmap& pixmap)
Expand Down Expand Up @@ -97,6 +98,13 @@ void UploadHistory::addLine(const QString& path, const QString& fileName)
ui->historyContainer->addWidget(line);
}

void UploadHistory::keyPressEvent(QKeyEvent* event)
{
if (event->key() == Qt::Key_Escape) {
close();
}
}

UploadHistory::~UploadHistory()
{
delete ui;
Expand Down
3 changes: 3 additions & 0 deletions src/widgets/uploadhistory.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ public slots:
void setEmptyMessage();
void addLine(QString const&, QString const&);

protected:
void keyPressEvent(QKeyEvent* event);

Ui::UploadHistory* ui;
};
#endif // UPLOADHISTORY_H

0 comments on commit e5dba85

Please sign in to comment.