Skip to content
Snippets Groups Projects
Commit e6fd80f8 authored by Konstantinos Sideris's avatar Konstantinos Sideris
Browse files

Fix MainWindow being out of focus when the fullscreen overlay is closed

That was probably a Linux specific issue or my mouse is buggy.
parent 41f6dbe0
No related branches found
No related tags found
No related merge requests found
......@@ -32,6 +32,12 @@ protected:
void mousePressEvent(QMouseEvent *event) override;
void paintEvent(QPaintEvent *event) override;
signals:
void closing();
private slots:
void closeDialog();
private:
void scaleImage(int width, int height);
......
......@@ -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();
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment