Merge pull request #679 from Kirillpt/iss_672

add shortcut Escape button for closing images. issue #672
pull/684/head
DeepBlueV7.X 3 years ago committed by GitHub
commit d84c1f59a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      src/dialogs/ImageOverlay.cpp
  2. 2
      src/dialogs/ImageOverlay.h

@ -28,8 +28,10 @@ ImageOverlay::ImageOverlay(QPixmap image, QWidget *parent)
setAttribute(Qt::WA_TranslucentBackground, true); setAttribute(Qt::WA_TranslucentBackground, true);
setAttribute(Qt::WA_DeleteOnClose, true); setAttribute(Qt::WA_DeleteOnClose, true);
setWindowState(Qt::WindowFullScreen); 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(); raise();
} }

@ -8,6 +8,7 @@
#include <QDialog> #include <QDialog>
#include <QMouseEvent> #include <QMouseEvent>
#include <QPixmap> #include <QPixmap>
#include <QShortcut>
namespace dialogs { namespace dialogs {
@ -32,5 +33,6 @@ private:
QRect content_; QRect content_;
QRect close_button_; QRect close_button_;
QRect save_button_; QRect save_button_;
QShortcut *close_shortcut_;
}; };
} // dialogs } // dialogs

Loading…
Cancel
Save