Merge "workaround on textarea input breaking"
This commit is contained in:
commit
36cd79b590
@ -75,9 +75,7 @@ AppletInterface::AppletInterface(DeclarativeAppletScript *script, const QVariant
|
||||
this, &AppletInterface::statusChanged);
|
||||
|
||||
connect(applet(), &Plasma::Applet::destroyedChanged,
|
||||
this, [=] () {
|
||||
setVisible(!applet()->destroyed());
|
||||
});
|
||||
this, &AppletInterface::destroyedChanged);
|
||||
|
||||
connect(applet(), &Plasma::Applet::activated,
|
||||
this, &AppletInterface::activated);
|
||||
@ -132,9 +130,7 @@ AppletInterface::AppletInterface(Plasma::Applet *a, const QVariantList &args, QQ
|
||||
this, &AppletInterface::statusChanged);
|
||||
|
||||
connect(applet(), &Plasma::Applet::destroyedChanged,
|
||||
[=] () {
|
||||
setVisible(!applet()->destroyed());
|
||||
});
|
||||
this, &AppletInterface::destroyedChanged);
|
||||
|
||||
connect(appletScript(), &DeclarativeAppletScript::formFactorChanged,
|
||||
this, &AppletInterface::formFactorChanged);
|
||||
@ -187,6 +183,36 @@ void AppletInterface::init()
|
||||
}
|
||||
}
|
||||
|
||||
void AppletInterface::destroyedChanged(bool destroyed)
|
||||
{
|
||||
//if an item loses its scene before losing the focus, will never
|
||||
//be able to gain focus again
|
||||
if (destroyed && window() && window()->activeFocusItem()) {
|
||||
QQuickItem *focus = window()->activeFocusItem();
|
||||
QQuickItem *candidate = focus;
|
||||
bool isAncestor = false;
|
||||
|
||||
//search if the current focus item is a child or granchild of the applet
|
||||
while (candidate) {
|
||||
if (candidate == this) {
|
||||
isAncestor = true;
|
||||
break;
|
||||
}
|
||||
candidate = candidate->parentItem();
|
||||
}
|
||||
|
||||
//Found? remove focus for the whole hyerarchy
|
||||
candidate = focus;
|
||||
|
||||
while (candidate && candidate != this) {
|
||||
candidate->setFocus(false);
|
||||
candidate = candidate->parentItem();
|
||||
}
|
||||
}
|
||||
|
||||
setVisible(!destroyed);
|
||||
}
|
||||
|
||||
Plasma::Types::FormFactor AppletInterface::formFactor() const
|
||||
{
|
||||
return applet()->formFactor();
|
||||
|
@ -353,6 +353,9 @@ protected Q_SLOTS:
|
||||
protected:
|
||||
bool eventFilter(QObject *watched, QEvent *event);
|
||||
|
||||
private Q_SLOTS:
|
||||
void destroyedChanged(bool destroyed);
|
||||
|
||||
private:
|
||||
|
||||
QStringList m_actions;
|
||||
|
Loading…
Reference in New Issue
Block a user