implement a specialized findChild; this makes it look like there's the usual findChild, but this one is defanged

svn path=/trunk/KDE/kdebase/runtime/; revision=1070552
This commit is contained in:
Aaron J. Seigo 2010-01-06 00:23:31 +00:00
parent 092bf9d3e6
commit 5946da0f42
2 changed files with 17 additions and 0 deletions

View File

@ -349,6 +349,22 @@ void AppletInterface::debug(const QString &msg)
kDebug() << msg; kDebug() << msg;
} }
QObject *AppletInterface::findChild(const QString &name) const
{
if (name.isEmpty()) {
return 0;
}
foreach (QGraphicsItem *item, applet()->childItems()) {
QGraphicsWidget *widget = dynamic_cast<QGraphicsWidget *>(item);
if (widget && widget->objectName() == name) {
return widget;
}
}
return 0;
}
void AppletInterface::gc() void AppletInterface::gc()
{ {
QTimer::singleShot(0, m_appletScriptEngine, SLOT(collectGarbage())); QTimer::singleShot(0, m_appletScriptEngine, SLOT(collectGarbage()));

View File

@ -224,6 +224,7 @@ enum QtScrollBarPolicy {
Q_INVOKABLE bool hasExtension(const QString &extension) const; Q_INVOKABLE bool hasExtension(const QString &extension) const;
Q_INVOKABLE void debug(const QString &msg); Q_INVOKABLE void debug(const QString &msg);
Q_INVOKABLE QObject *findChild(const QString &name) const;
Plasma::DataEngine *dataEngine(const QString &name); Plasma::DataEngine *dataEngine(const QString &name);