Figure out segfault

This commit is contained in:
johanneshilden 2017-10-13 22:37:05 +03:00
parent 696dc2ed2a
commit 8a64b5a981
3 changed files with 35 additions and 11 deletions

View File

@ -21,24 +21,24 @@ 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();
}
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();
//}
}
/*!

View File

@ -3,6 +3,7 @@
#include <QtWidgets/QGraphicsDropShadowEffect>
#include <QtWidgets/QVBoxLayout>
#include <QEvent>
#include <QDebug>
#include "qtmaterialflatbutton.h"
/*!
@ -104,13 +105,18 @@ void QtMaterialAutoComplete::updateResults(QString text)
item->setHaloVisible(false);
item->setFixedHeight(50);
d->menuLayout->addWidget(item);
//item->installEventFilter(this);
}
} else if (diff < 0) {
for (int c = 0; c < -diff; c++) {
QWidget *widget = d->menuLayout->itemAt(0)->widget();
if (widget) {
d->menuLayout->removeWidget(widget);
delete widget;
//widget->setParent(0);
//qDebug() << widget->parent();
//qDebug() << widget->parentWidget();
//delete widget;
widget->deleteLater();
}
}
}
@ -163,3 +169,20 @@ bool QtMaterialAutoComplete::QtMaterialAutoComplete::event(QEvent *event)
}
return QtMaterialTextField::event(event);
}
bool QtMaterialAutoComplete::eventFilter(QObject *watched, QEvent *event)
{
Q_D(QtMaterialAutoComplete);
switch (event->type())
{
case QEvent::MouseButtonPress: {
qDebug() << "mouse pressl";
d->menu->hide();
break;
}
default:
break;
}
return QtMaterialTextField::eventFilter(watched, event);
}

View File

@ -20,6 +20,7 @@ protected slots:
protected:
bool event(QEvent *event) Q_DECL_OVERRIDE;
bool eventFilter(QObject *watched, QEvent *event) Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(QtMaterialAutoComplete)