r24691 by jghali - Avoid unnecessary QList::indexOf() call in getItemNrFromUniqueID()

scribus-commit scribus-commit at lists.scribus.net
Wed Aug 11 00:11:11 UTC 2021


Author: jghali
Date: Wed Aug 11 00:11:11 2021
New Revision: 24691

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24691
Log:
Avoid unnecessary QList::indexOf() call in getItemNrFromUniqueID()

Modified:
    trunk/Scribus/scribus/scribusdoc.cpp
    trunk/Scribus/scribus/scribusdoc.h

Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24691&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp	(original)
+++ trunk/Scribus/scribus/scribusdoc.cpp	Wed Aug 11 00:11:11 2021
@@ -5553,7 +5553,7 @@
 }
 
 
-int ScribusDoc::getItemNrFromUniqueID(uint unique)
+int ScribusDoc::getItemNrFromUniqueID(uint unique) const
 {
 	// FIXME : don't work for items inside groups
 	// Needs to fix group/ungroup undo first
@@ -5562,7 +5562,7 @@
 	{
 		if (Items->at(i)->uniqueNr == unique)
 		{
-			ret = Items->indexOf(Items->at(i));
+			ret = i;
 			break;
 		}
 	}

Modified: trunk/Scribus/scribus/scribusdoc.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24691&path=/trunk/Scribus/scribus/scribusdoc.h
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.h	(original)
+++ trunk/Scribus/scribus/scribusdoc.h	Wed Aug 11 00:11:11 2021
@@ -863,11 +863,15 @@
 	 */
 	void itemAddDetails(const PageItem::ItemType itemType, const PageItem::ItemFrameType frameType, PageItem* newItem);
 
-	int getItemNrFromUniqueID(uint unique);
-	//return pointer to item
+	/**
+	 * @brief Get index of item in items list
+	 */
+	int getItemNrFromUniqueID(uint unique) const;
+
+	/**
+	 * @brief Return pointer to item
+	 */
 	PageItem* getItemFromName(const QString& name) const;
-	//itemDelete
-	//itemBlah...
 
 	/**
 	 * @brief Rebuild item lists taking into account layer order.




More information about the scribus-commit mailing list