Remove QPropertyAnimation from modals to work around a regression on Qt 5.10.1 (#87)
This commit is contained in:
parent
59e4148a7c
commit
fdd5051dcf
8 changed files with 18 additions and 72 deletions
|
|
@ -23,7 +23,6 @@
|
|||
OverlayModal::OverlayModal(QWidget *parent, QWidget *content)
|
||||
: OverlayWidget(parent)
|
||||
, content_{content}
|
||||
, duration_{500}
|
||||
, color_{QColor(55, 55, 55)}
|
||||
{
|
||||
auto layout = new QVBoxLayout();
|
||||
|
|
@ -32,21 +31,6 @@ OverlayModal::OverlayModal(QWidget *parent, QWidget *content)
|
|||
|
||||
setLayout(layout);
|
||||
|
||||
opacity_ = new QGraphicsOpacityEffect(this);
|
||||
setGraphicsEffect(opacity_);
|
||||
|
||||
opacity_->setOpacity(1);
|
||||
animation_ = new QPropertyAnimation(opacity_, "opacity", this);
|
||||
animation_->setStartValue(1);
|
||||
animation_->setEndValue(0);
|
||||
animation_->setDuration(duration_);
|
||||
animation_->setEasingCurve(QEasingCurve::Linear);
|
||||
|
||||
connect(animation_, &QPropertyAnimation::finished, [this]() {
|
||||
if (animation_->direction() == QAbstractAnimation::Forward)
|
||||
this->close();
|
||||
});
|
||||
|
||||
content->setFocus();
|
||||
}
|
||||
|
||||
|
|
@ -63,22 +47,7 @@ void
|
|||
OverlayModal::mousePressEvent(QMouseEvent *e)
|
||||
{
|
||||
if (isDismissible_ && content_ && !content_->geometry().contains(e->pos()))
|
||||
fadeOut();
|
||||
}
|
||||
|
||||
void
|
||||
OverlayModal::fadeIn()
|
||||
{
|
||||
animation_->setDirection(QAbstractAnimation::Backward);
|
||||
animation_->start();
|
||||
show();
|
||||
}
|
||||
|
||||
void
|
||||
OverlayModal::fadeOut()
|
||||
{
|
||||
animation_->setDirection(QAbstractAnimation::Forward);
|
||||
animation_->start();
|
||||
hide();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -86,6 +55,6 @@ OverlayModal::keyPressEvent(QKeyEvent *event)
|
|||
{
|
||||
if (event->key() == Qt::Key_Escape) {
|
||||
event->accept();
|
||||
fadeOut();
|
||||
hide();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue