fix logic of install/remove eventfilter

This commit is contained in:
Marco Martin 2014-08-07 13:22:48 +02:00
parent 1baddcc004
commit 11b2da667d
2 changed files with 13 additions and 8 deletions

View File

@ -88,11 +88,17 @@ AppletInterface::AppletInterface(DeclarativeAppletScript *script, const QVariant
}
connect(this, &AppletInterface::expandedChanged, [=](bool expanded) {
//FIXME: this is obviously wrong: the filter should be installed when the
//applet goes popup and removed when it goes normal,
//this is a not really working heuristic
if (fullRepresentationItem() && fullRepresentationItem()->parentItem()) {
fullRepresentationItem()->parentItem()->installEventFilter(this);
//if both compactRepresentationItem and fullRepresentationItem exist,
//the applet is in a popup
if (expanded) {
if (compactRepresentationItem() && fullRepresentationItem() &&
fullRepresentationItem()->window() && compactRepresentationItem()->window() &&
fullRepresentationItem()->window() != compactRepresentationItem()->window() &&
fullRepresentationItem()->parentItem()) {
fullRepresentationItem()->parentItem()->installEventFilter(this);
} else if (fullRepresentationItem() && fullRepresentationItem()->parentItem()) {
fullRepresentationItem()->parentItem()->removeEventFilter(this);
}
}
});
}

View File

@ -658,8 +658,7 @@ QList<QObject *> ContainmentInterface::actions() const
void ContainmentInterface::mouseReleaseEvent(QMouseEvent *event)
{
//event->setAccepted(m_containment->containmentActions().contains(Plasma::ContainmentActions::eventToString(event)));
event->setAccepted(false);
event->setAccepted(m_containment->containmentActions().contains(Plasma::ContainmentActions::eventToString(event)));
}
void ContainmentInterface::mousePressEvent(QMouseEvent *event)
@ -723,7 +722,7 @@ void ContainmentInterface::mousePressEvent(QMouseEvent *event)
//end workaround
desktopMenu.exec(event->globalPos());
event->setAccepted(false);
event->setAccepted(true);
}
void ContainmentInterface::wheelEvent(QWheelEvent *event)