[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/extragear/graphics/digikam/core/libs/models
From: Marcel Wiesweg <marcel.wiesweg () gmx ! de>
Date: 2010-12-27 10:53:06
Message-ID: 20101227105307.047A4AC8AD () svn ! kde ! org
[Download RAW message or body]
SVN commit 1209569 by mwiesweg:
Separate implementations with and without extravalues.
Hope to fix crash
M +21 -4 imagemodel.cpp
--- branches/extragear/graphics/digikam/core/libs/models/imagemodel.cpp \
#1209568:1209569 @@ -707,25 +707,38 @@
void ImageModel::removeImageInfo(const ImageInfo& info)
{
- removeImageInfos(QList<ImageInfo>() << info, QList<QVariant>());
+ removeImageInfos(QList<ImageInfo>() << info);
}
void ImageModel::removeImageInfos(const QList<ImageInfo>& infos)
{
- removeImageInfos(infos, QList<QVariant>());
+ QList<int> listIndexes;
+ foreach (const ImageInfo& info, infos)
+ {
+ QModelIndex index = indexForImageId(info.id());
+ if (index.isValid())
+ listIndexes << index.row();
}
+ removeRowPairs(ImageModelIncrementalUpdater::toContiguousPairs(listIndexes));
+}
void ImageModel::removeImageInfos(const QList<ImageInfo>& infos, const \
QList<QVariant>& extraValues) {
+ if (extraValues.isEmpty())
+ {
+ removeImageInfos(infos);
+ return;
+ }
+
QList<int> listIndexes;
- const bool extraValue = !extraValues.isEmpty();
for (int i=0; i<infos.size(); i++)
{
- QModelIndex index = extraValue ? indexForImageInfo(infos[i]) : \
indexForImageInfo(infos[i], extraValues[i]); + QModelIndex index = \
indexForImageId(infos[i].id(), extraValues[i]); if (index.isValid())
listIndexes << index.row();
}
+
removeRowPairs(ImageModelIncrementalUpdater::toContiguousPairs(listIndexes));
}
@@ -763,6 +776,10 @@
void ImageModel::removeRowPairs(const QList<QPair<int,int> >& toRemove)
{
+ if (toRemove.isEmpty())
+ {
+ return;
+ }
// Remove old indexes
// Keep in mind that when calling beginRemoveRows all structures announced to be \
removed
// must still be valid, and this includes our hashes as well, which limits what \
we can optimize
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic