[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdelibs/kparts
From: David Faure <faure () kde ! org>
Date: 2011-01-18 19:13:18
Message-ID: 20110118191318.89B88AC8B6 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1215452 by dfaure:
Simplify StatusBarExtension::childObject using KGlobal::findDirectChild like in all other extensions
M +2 -3 plugin.h
M +2 -15 statusbarextension.cpp
--- trunk/KDE/kdelibs/kparts/plugin.h #1215451:1215452
@@ -152,9 +152,8 @@
/**
* Returns a list of plugin objects loaded for @p parent. This
- * functions basically calls the queryList method of
- * QObject to retrieve the list of child objects inheriting
- * KParts::Plugin .
+ * functions basically iterates over the children of the given object
+ * and returns those that inherit from KParts::Plugin.
**/
static QList<Plugin *> pluginObjects( QObject *parent );
--- trunk/KDE/kdelibs/kparts/statusbarextension.cpp #1215451:1215452
@@ -25,6 +25,7 @@
#include <kstatusbar.h>
#include <kmainwindow.h>
#include <kdebug.h>
+#include <kglobal.h>
#include <kparts/part.h>
#include <kparts/event.h>
@@ -98,25 +99,11 @@
delete d;
}
-
StatusBarExtension *StatusBarExtension::childObject( QObject *obj )
{
- if ( !obj )
- return 0;
-
- // we try to do it on our own, in hope that we are faster than
- // queryList, which looks kind of big :-)
- const QObjectList &children = obj->children();
- QObjectList::ConstIterator it = children.begin();
- for (; it != children.end(); ++it ) {
- KParts::StatusBarExtension* ext = ::qobject_cast<KParts::StatusBarExtension *>( *it );
- if ( ext )
- return ext;
+ return KGlobal::findDirectChild<KParts::StatusBarExtension*>(obj);
}
- return 0;
-}
-
bool StatusBarExtension::eventFilter(QObject * watched, QEvent* ev)
{
if ( !GUIActivateEvent::test( ev ) ||
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic