[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    koffice/kexi
From:       Jaroslaw Staniek <js () iidea ! pl>
Date:       2004-04-02 20:33:03
Message-ID: 20040402203303.1608199D3 () office ! kde ! org
[Download RAW message or body]

CVS commit by staniek: 

findFirstChild updated


  M +11 -5     kexi_utils.h   1.8


--- koffice/kexi/kexi_utils.h  #1.7:1.8
@@ -22,4 +22,6 @@
 
 #include <qstring.h>
+#include <qobjectlist.h>
+
 #include "kexi_global.h"
 
@@ -64,10 +66,14 @@ namespace Kexi
                 return static_cast<type*>(o);
         }
-/*      inline QObject* findParent(QObject* o, const char* className)
+
+        //! \return first found child of \a o, that inherit \a className.
+        //! Returned pointer type is casted.
+        template<class type>
+        type* findFirstChild(QObject *o, const char* className)
         {
-                while ( ((o=o->parent())) && !o->inherits(className) )
-                        ;
-                return o;
-        }*/
+                QObjectList *l = o->queryList( className );
+                QObjectListIt it( *l );
+                return static_cast<type*>(it.current());
+        }
 
 } //namespace


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic