Make sure ripple is destroyed when overlay host widget is (segfault error)
This commit is contained in:
parent
8a64b5a981
commit
80e9a5a4b8
|
@ -21,24 +21,27 @@ QtMaterialRippleOverlay::~QtMaterialRippleOverlay()
|
|||
|
||||
void QtMaterialRippleOverlay::addRipple(QtMaterialRipple *ripple)
|
||||
{
|
||||
//ripple->setOverlay(this);
|
||||
//m_ripples.push_back(ripple);
|
||||
//ripple->start();
|
||||
ripple->setOverlay(this);
|
||||
m_ripples.push_back(ripple);
|
||||
ripple->start();
|
||||
|
||||
connect(this, SIGNAL(destroyed(QObject*)), ripple, SLOT(stop()));
|
||||
connect(this, SIGNAL(destroyed(QObject*)), ripple, SLOT(deleteLater()));
|
||||
}
|
||||
|
||||
void QtMaterialRippleOverlay::addRipple(const QPoint &position, qreal radius)
|
||||
{
|
||||
//QtMaterialRipple *ripple = new QtMaterialRipple(position);
|
||||
//ripple->setRadiusEndValue(radius);
|
||||
//addRipple(ripple);
|
||||
QtMaterialRipple *ripple = new QtMaterialRipple(position);
|
||||
ripple->setRadiusEndValue(radius);
|
||||
addRipple(ripple);
|
||||
}
|
||||
|
||||
void QtMaterialRippleOverlay::removeRipple(QtMaterialRipple *ripple)
|
||||
{
|
||||
//if (m_ripples.removeOne(ripple)) {
|
||||
// delete ripple;
|
||||
// update();
|
||||
//}
|
||||
if (m_ripples.removeOne(ripple)) {
|
||||
delete ripple;
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
Loading…
Reference in New Issue