mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-10-30 17:40:47 +03:00
Merge pull request #679 from Kirillpt/iss_672
add shortcut Escape button for closing images. issue #672
This commit is contained in:
commit
d84c1f59a4
2 changed files with 5 additions and 1 deletions
|
@ -28,8 +28,10 @@ ImageOverlay::ImageOverlay(QPixmap image, QWidget *parent)
|
|||
setAttribute(Qt::WA_TranslucentBackground, true);
|
||||
setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
setWindowState(Qt::WindowFullScreen);
|
||||
close_shortcut_ = new QShortcut(QKeySequence(Qt::Key_Escape), this);
|
||||
|
||||
connect(this, SIGNAL(closing()), this, SLOT(close()));
|
||||
connect(close_shortcut_, &QShortcut::activated, this, &ImageOverlay::closing);
|
||||
connect(this, &ImageOverlay::closing, this, &ImageOverlay::close);
|
||||
|
||||
raise();
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include <QDialog>
|
||||
#include <QMouseEvent>
|
||||
#include <QPixmap>
|
||||
#include <QShortcut>
|
||||
|
||||
namespace dialogs {
|
||||
|
||||
|
@ -32,5 +33,6 @@ private:
|
|||
QRect content_;
|
||||
QRect close_button_;
|
||||
QRect save_button_;
|
||||
QShortcut *close_shortcut_;
|
||||
};
|
||||
} // dialogs
|
||||
|
|
Loading…
Reference in a new issue