summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorKonstantinos Sideris <sideris.konstantin@gmail.com>2017-04-30 13:00:11 +0300
committerKonstantinos Sideris <sideris.konstantin@gmail.com>2017-04-30 13:00:11 +0300
commite6fd80f87f31d15c2a1ec73a22ba3e76647151f0 (patch)
tree91c92edd84bf6e6c8e137ef766e383845aedb6fc /src
parentClose fullscreen overlay with out of contents click (diff)
downloadnheko-e6fd80f87f31d15c2a1ec73a22ba3e76647151f0.tar.xz
Fix MainWindow being out of focus when the fullscreen overlay is closed
That was probably a Linux specific issue or my mouse is buggy.
Diffstat (limited to 'src')
-rw-r--r--src/ImageOverlayDialog.cc13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/ImageOverlayDialog.cc b/src/ImageOverlayDialog.cc

index 04bda711..55e0df00 100644 --- a/src/ImageOverlayDialog.cc +++ b/src/ImageOverlayDialog.cc
@@ -17,6 +17,7 @@ #include <QDebug> #include <QPainter> +#include <QTimer> #include "ImageOverlayDialog.h" @@ -36,6 +37,13 @@ ImageOverlayDialog::ImageOverlayDialog(QPixmap image, QWidget *parent) setWindowState(Qt::WindowFullScreen); raise(); + + connect(this, SIGNAL(closing()), this, SLOT(closeDialog())); +} + +void ImageOverlayDialog::closeDialog() +{ + QTimer::singleShot(100, this, &ImageOverlayDialog::reject); } // TODO: Move this into Utils @@ -110,9 +118,8 @@ void ImageOverlayDialog::mousePressEvent(QMouseEvent *event) if (event->button() != Qt::LeftButton) return; - // FIXME: The main window needs double click to regain focus. if (close_button_.contains(event->pos())) - close(); + emit closing(); else if (!content_.contains(event->pos())) - close(); + emit closing(); }