summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkarsh Simha <akarsh@kde.org>2016-10-14 10:14:22 (GMT)
committerAkarsh Simha <akarsh@kde.org>2016-10-14 10:28:36 (GMT)
commit42d4149a44d26f92be59de57cce5fa484cd980c6 (patch)
treed1efcc78a3b838f9b67b7aed61a8a0d02479a69a
parente108f42e4467070221ff33a83695349cbdb8328f (diff)
Add utility method to create a QList<T *> from QList<QSharedPointer<T>>
Used by the changes to ObservingList that follow this commit. Happy 20th Birthday, KDE!
-rw-r--r--kstars/auxiliary/ksutils.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/kstars/auxiliary/ksutils.h b/kstars/auxiliary/ksutils.h
index 547b8b8..68b279f 100644
--- a/kstars/auxiliary/ksutils.h
+++ b/kstars/auxiliary/ksutils.h
@@ -136,6 +136,17 @@ namespace KSUtils {
*/
QList<SkyObject *> * castStarObjListToSkyObjList( QList<StarObject *> *starObjList );
+
+ /**
+ *@note Avoid using this method for the same reasons as QSharedPointer::data()
+ */
+ template <typename T> QList<T*> makeVanillaPointerList( const QList<QSharedPointer<T>> &spList ) {
+ QList<T *> vpList;
+ foreach( QSharedPointer<T> sp, spList )
+ vpList.append( sp.data() );
+ return vpList;
+ }
+
/**
*@short Return the genetive form of constellation name, given the abbreviation
*@param code Three-letter IAU abbreviation of the constellation