Bug 201717 - Changing rating filter when images are selected, select all images between first and last selected image
Summary: Changing rating filter when images are selected, select all images between fi...
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Albums-Filters (show other bugs)
Version: 1.0.0
Platform: Gentoo Packages Unspecified
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-07-28 00:51 UTC by Ian Hubbertz
Modified: 2012-06-27 11:15 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 1.0.0
Sentry Crash Report:
caulier.gilles: Junior_Jobs+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ian Hubbertz 2009-07-28 00:51:15 UTC
Version:           1.0.0-beta3 (using KDE 4.2.98)
Installed from:    Gentoo Packages

Steps to reproduce:

1. Activate rating filter (e.g. 4 stars)
2. Select All Images
3. Change rating filter (e.g. 3 stars)

--> Result: All images between (and including) the first and the last image with 4 stars are selected.

--> Expected behaviour: Selection should not change

--> Notes & Workaround: The problem only occurs if "All Images" (Strg-A or dragging a mouse selection recatnagle over all images) have been selected. So, as workaroung, select all images, deselect one and select it again. Then the rating filter can be changed without problems.
Comment 1 caulier.gilles 2009-07-28 06:33:24 UTC
It's relevant of new Qt4 model/View code...

Gilles Caulier
Comment 2 Marcel Wiesweg 2009-07-28 22:07:22 UTC
This is indeep a Qt problem. See this code from QItemSelectionModel:

void QItemSelectionModelPrivate::_q_layoutAboutToBeChanged()
{
    savedPersistentIndexes.clear();
    savedPersistentCurrentIndexes.clear();

    // special case for when all indexes are selected
    if (ranges.isEmpty() && currentSelection.count() == 1) {
        QItemSelectionRange range = currentSelection.first();
        QModelIndex parent = range.parent();
        if (range.top() == 0
            && range.left() == 0
            && range.bottom() == model->rowCount(parent) - 1
            && range.right() == model->columnCount(parent) - 1) {
            tableSelected = true;
            tableParent = parent;
            tableColCount = model->columnCount(parent);
            tableRowCount = model->rowCount(parent);
            return;
        }
    }
...
}

void QItemSelectionModelPrivate::_q_layoutChanged()
{
    // special case for when all indexes are selected
    if (tableSelected && tableColCount == model->columnCount(tableParent)
        && tableRowCount == model->rowCount(tableParent)) {
        ...
    }

    if (savedPersistentCurrentIndexes.isEmpty() && savedPersistentIndexes.isEmpty()) {
        // either the selection was actually empty, or we
        // didn't get the layoutAboutToBeChanged() signal
        return;
    }
...
}

The "special case" is hit in the first method when storing the indexes. In the second method for restoring the selection, the special case is not met, and no indexes have been saved in the savedPersistentIndexes list.

1) For what purpose is this special case added?
2) File a Qt bug?
Comment 3 Marcel Wiesweg 2009-08-03 18:48:05 UTC
Posted to Qt task tracker with number 259089.
Comment 4 Marcel Wiesweg 2009-08-25 18:01:03 UTC
Now it really got added as a task with number 260134.
Comment 5 Ignat Semenov 2009-10-31 15:20:48 UTC
Now it has been fixed in Qt 4.6:
http://qt.nokia.com/developer/task-tracker/index_html?method=entry&id=260134
KDE 4.4 depends on Qt 4.6. Does that mean that this should be closed?
It work sfine now with Qt 4.6 trunk and Digikam trunk.
Comment 6 caulier.gilles 2009-10-31 15:40:07 UTC
For me it can be closed....

Marcel Andi, do you have a fix in digiKam for Qt4 < 4.6 ?

Gilles
Comment 7 Andi Clemens 2009-10-31 15:44:58 UTC
No, because this is an indeep Qt problem. If it is really fixed now, we can ignore the bugreport.
At least I don't feel like fixing bugs for Nokia right now :-)
Comment 8 caulier.gilles 2009-10-31 15:48:12 UTC
Right. well closed...

Gilles