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

List:       kde-commits
Subject:    branches/extragear/graphics/digikam/modelviewport/digikam/libs/models
From:       Marcel Wiesweg <marcel.wiesweg () gmx ! de>
Date:       2009-12-30 13:53:00
Message-ID: 1262181180.069378.18638.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1067749 by mwiesweg:

Add a static method to retrieve the Album* through data() also for proxy model \
indexes


 M  +5 -0      abstractalbummodel.cpp  
 M  +5 -0      abstractalbummodel.h  


--- branches/extragear/graphics/digikam/modelviewport/digikam/libs/models/abstractalbummodel.cpp \
#1067748:1067749 @@ -293,6 +293,11 @@
     return static_cast<Album*>(index.internalPointer());
 }
 
+Album *AbstractAlbumModel::retrieveAlbum(const QModelIndex& index)
+{
+    return index.data(AbstractAlbumModel::AlbumPointerRole).value<Album*>();
+}
+
 Album *AbstractAlbumModel::rootAlbum() const
 {
     return d->rootAlbum;
--- branches/extragear/graphics/digikam/modelviewport/digikam/libs/models/abstractalbummodel.h \
#1067748:1067749 @@ -114,6 +114,11 @@
         the album is not contained in this model. */
     QModelIndex indexForAlbum(Album *album) const;
 
+    /** Returns the album represented by the index. In contrast to albumForIndex(),
+     *  the index can be from any proxy model, as long as an AbstractAlbumModel is \
at the end. +     */
+    static Album *retrieveAlbum(const QModelIndex& index);
+
     Album *rootAlbum() const;
     /// Return the index corresponding to the root album. If the policy is \
IgnoreRootAlbum, this is an invalid index. */  QModelIndex rootAlbumIndex() const;


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

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