[Kstars-devel] branches/kstars/summer/kstars/kstars/tools

Prakash Mohan prak902000 at gmail.com
Sat May 30 18:01:45 CEST 2009


SVN commit 975638 by prakash:

Implementing a more effective QList::contains() instead of manually iterating through the QList

CCMAIL: kstars-devel at kde.org


 M  +2 -7      observinglist.cpp  
 M  +1 -1      observinglist.h  


--- branches/kstars/summer/kstars/kstars/tools/observinglist.cpp #975637:975638
@@ -193,13 +193,8 @@
 //    ui->MiniButton->hide();
 }
 
-bool ObservingList::contains( const SkyObject *q ) {
-    // TODO: I guess there's a more effecient way of doing this using some method. Check QList reference. In fact, I think there's an QList::contains() method - Akarsh
-    foreach ( SkyObject* o, obsList() ) {
-        if ( o == q ) return true;
-    }
-
-    return false;
+bool ObservingList::contains(  SkyObject *q ) {
+    return obsList().contains( q );    
 }
 
 
--- branches/kstars/summer/kstars/kstars/tools/observinglist.h #975637:975638
@@ -87,7 +87,7 @@
     /**@return true if the object is in the observing list
         *@p o pointer to the object to test.
         */
-    bool contains( const SkyObject *o );
+    bool contains( SkyObject *o );
 
     /**@return true if the window is in its default "large" state.
         */


More information about the Kstars-devel mailing list