Rebase...

This commit is contained in:
Konstantinos Sideris 2017-04-30 13:00:11 +03:00 committed by Matthew Hodgson
parent 69113dad77
commit fcc93ad038
2 changed files with 16 additions and 3 deletions

View File

@ -34,6 +34,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);

View File

@ -17,6 +17,7 @@
#include <QDebug>
#include <QPainter>
#include <QTimer>
#include "ImageOverlayDialog.h"
@ -34,6 +35,8 @@ ImageOverlayDialog::ImageOverlayDialog(QPixmap image, QWidget *parent)
setAttribute(Qt::WA_DeleteOnClose, true);
setWindowState(Qt::WindowFullScreen);
connect(this, SIGNAL(closing()), this, SLOT(closeDialog()));
}
void ImageOverlayDialog::reject()
@ -53,6 +56,11 @@ void ImageOverlayDialog::reject()
QDialog::reject();
}
void ImageOverlayDialog::closeDialog()
{
QTimer::singleShot(100, this, &ImageOverlayDialog::reject);
}
// TODO: Move this into Utils
void ImageOverlayDialog::scaleImage(int max_width, int max_height)
{
@ -125,9 +133,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();
}