@ -19,6 +19,7 @@
#include <QGraphicsOpacityEffect>
#include <QKeyEvent>
#include <QMouseEvent>
#include <QPaintEvent>
#include <QPropertyAnimation>
@ -39,8 +40,11 @@ public:
protected:
void paintEvent(QPaintEvent *event) override;
void keyPressEvent(QKeyEvent *event) override;
void mousePressEvent(QMouseEvent *event) override;
private:
QWidget *content_;
int duration_;
QColor color_;
@ -22,6 +22,7 @@
OverlayModal::OverlayModal(QWidget *parent, QWidget *content)
: OverlayWidget(parent)
, content_{content}
, duration_{500}
, color_{QColor(55, 55, 55)}
{
@ -60,6 +61,13 @@ OverlayModal::paintEvent(QPaintEvent *event)
painter.fillRect(rect(), color_);
}
void
OverlayModal::mousePressEvent(QMouseEvent *e)
if (content_ && !content_->geometry().contains(e->pos()))
fadeOut();
OverlayModal::fadeIn()