Rebase...
This commit is contained in:
parent
69113dad77
commit
fcc93ad038
@ -34,6 +34,12 @@ protected:
|
|||||||
void mousePressEvent(QMouseEvent *event) override;
|
void mousePressEvent(QMouseEvent *event) override;
|
||||||
void paintEvent(QPaintEvent *event) override;
|
void paintEvent(QPaintEvent *event) override;
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void closing();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void closeDialog();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void scaleImage(int width, int height);
|
void scaleImage(int width, int height);
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
#include "ImageOverlayDialog.h"
|
#include "ImageOverlayDialog.h"
|
||||||
|
|
||||||
@ -34,6 +35,8 @@ ImageOverlayDialog::ImageOverlayDialog(QPixmap image, QWidget *parent)
|
|||||||
setAttribute(Qt::WA_DeleteOnClose, true);
|
setAttribute(Qt::WA_DeleteOnClose, true);
|
||||||
|
|
||||||
setWindowState(Qt::WindowFullScreen);
|
setWindowState(Qt::WindowFullScreen);
|
||||||
|
|
||||||
|
connect(this, SIGNAL(closing()), this, SLOT(closeDialog()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImageOverlayDialog::reject()
|
void ImageOverlayDialog::reject()
|
||||||
@ -53,6 +56,11 @@ void ImageOverlayDialog::reject()
|
|||||||
QDialog::reject();
|
QDialog::reject();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ImageOverlayDialog::closeDialog()
|
||||||
|
{
|
||||||
|
QTimer::singleShot(100, this, &ImageOverlayDialog::reject);
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: Move this into Utils
|
// TODO: Move this into Utils
|
||||||
void ImageOverlayDialog::scaleImage(int max_width, int max_height)
|
void ImageOverlayDialog::scaleImage(int max_width, int max_height)
|
||||||
{
|
{
|
||||||
@ -125,9 +133,8 @@ void ImageOverlayDialog::mousePressEvent(QMouseEvent *event)
|
|||||||
if (event->button() != Qt::LeftButton)
|
if (event->button() != Qt::LeftButton)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// FIXME: The main window needs double click to regain focus.
|
|
||||||
if (close_button_.contains(event->pos()))
|
if (close_button_.contains(event->pos()))
|
||||||
close();
|
emit closing();
|
||||||
else if (!content_.contains(event->pos()))
|
else if (!content_.contains(event->pos()))
|
||||||
close();
|
emit closing();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user