Bug 193422 - new icon view (model/view based) : when deleting images the icon view backs to top
Summary: new icon view (model/view based) : when deleting images the icon view backs t...
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Albums-IconView (show other bugs)
Version: 1.0.0
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-05-20 22:55 UTC by Salvatore Brigaglia
Modified: 2017-07-29 05:26 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 1.0.0


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Salvatore Brigaglia 2009-05-20 22:55:41 UTC
Version:           0.11.0 svn (using KDE 4.2.85)
OS:                Linux
Installed from:    SuSE RPMs

If you delete an image from the middle or the bottom of a folder, when in icon, mode the view backs to the first row of images. This is quite annoying because you have to start again to search what you where looking for.
Comment 1 caulier.gilles 2009-05-21 10:24:55 UTC
Salvatore,

Please checkout last code from svn and try again. Marcel work on this part every day...

Gilles Caulier
Comment 2 Salvatore Brigaglia 2009-05-21 22:16:40 UTC
niet... still there. This is also reproduceable if you scroll down an album, hide digikam in the task bar and then resume it... it will show the first row of images!
Comment 3 caulier.gilles 2009-06-19 11:49:36 UTC
Salvatore,

I cannot reproduce this problem using last code from svn...

Gilles Caulier
Comment 4 Andi Clemens 2009-07-01 10:39:32 UTC
The same is true when tagging an album and having a filter turned on.
For example you open an album, turn on the "Not Tagged" filter, and start tagging images. If you tag them, they will disappear and the view is scrolled back to the top.
Before modelview, this was not the case.
Comment 5 Mikolaj Machowski 2009-07-02 20:49:48 UTC
@4, Andi - actually I like this behavior :)
Comment 6 Andi Clemens 2009-07-02 21:06:48 UTC
Why? 
You have 500 images in an album, you set the filter, you tag some items in the middle of the view and than it jumps back... this is not helpful at all.
How can you like that?
:-)
Comment 7 Mikolaj Machowski 2009-07-02 21:55:04 UTC
Andi, I mean that images are vanishing from view. Jumping to beginning isn't nice.
Comment 8 Andi Clemens 2009-07-02 22:04:38 UTC
Yeah sure, removing the items is nice ;-)
So we have the same opinion... :-)
Comment 9 Marcel Wiesweg 2009-07-03 19:23:06 UTC
SVN commit 990995 by mwiesweg:

Part A of the problem: Try to preserve selection across layoutChanged().
Simply store one persistent index and one row number to indicate where about
the selection was before the layout change. That's not perfect but simple
and works for most cases.

CCBUG: 193422

 M  +32 -2     imagecategorizedview.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=990995
Comment 10 Marcel Wiesweg 2009-07-03 19:51:09 UTC
SVN commit 991005 by mwiesweg:

Part B of the problem: Do not call updateScrollBars after layoutChanged(); everything is invalid!

Fix possible crash from Part A's solution.

 M  +6 -3      imagecategorizedview.cpp  
 M  +1 -1      kcategorizedview.cpp  


--- trunk/extragear/graphics/digikam/digikam/imagecategorizedview.cpp #991004:991005
@@ -576,11 +576,14 @@
         QModelIndex indexToAnchor;
         if (currentSelection.contains(current))
             indexToAnchor = current;
-        else
+        else if (!currentSelection.isEmpty())
             indexToAnchor = currentSelection.first().topLeft();
-        d->hintAtSelectionRow = indexToAnchor.row();
-        d->hintAtSelectionIndex = model()->index(d->hintAtSelectionRow == model()->rowCount()
+        if (indexToAnchor.isValid())
+        {
+            d->hintAtSelectionRow = indexToAnchor.row();
+            d->hintAtSelectionIndex = model()->index(d->hintAtSelectionRow == model()->rowCount()
                                             ? d->hintAtSelectionRow : d->hintAtSelectionRow + 1, 0);
+        }
     }
 }
 
--- trunk/extragear/graphics/digikam/digikam/kcategorizedview.cpp #991004:991005
@@ -1769,7 +1769,7 @@
 {
     if (d->proxyModel && d->categoryDrawer && d->proxyModel->isCategorizedModel())
     {
-        d->updateScrollbars();
+        // all cached values are invalidated, recompute immediately
         rowsInsertedArtifficial(QModelIndex(), 0, d->proxyModel->rowCount() - 1);
     }
 }
Comment 11 Marcel Wiesweg 2009-07-03 19:52:51 UTC
For me this problem is solved. If you confirm we can close it.

What is left as WONTFIX is the behavior that when the application is minimized and restored, the view is scrolled to the current selected item. That's Qt behavior.
Comment 12 Andi Clemens 2009-10-08 01:33:30 UTC
So should we close it then...?
Comment 13 Andi Clemens 2009-10-20 18:04:54 UTC
I think it is solved, closing now.
Feel free to re-open it if really necessary.