Bug report #15803
2.18: Move Selection to Top not working in attribute table
|Affected QGIS version:||2.18.4||Regression?:||Yes|
|Operating System:||Easy fix?:||No|
|Pull Request or Patch supplied:||Yes||Resolution:|
|Crashes QGIS or corrupts data:||No||Copied to github as #:||23723|
In my current 2.18 the button 'Move Selection to top' (see attached screenshot) in the attributes table is not working.
in 2.14 on exact same machine + data it just works.
[attributetable] fix sortOnTop due to sortOrder wrong enum values from QgsAttributeTableConfig: fixes #15803
#3 Updated by Richard Duivenvoorde over 3 years ago
Yep, confirmed here Paolo's trick: if you in the lower left corner of the attribute table temporarily use 'Show Selected Features' and then go back to 'Show All Features' the button is working temporarily(!).
Closing and reopening the attribute table again and the problem is their again.
Looks like some signal is not coming through?
In debig info I see:
src/app/qgsmaptoolselectutils.cpp: 293: (getMatchingFeatures) [7873ms] Number of new selected features: 5
#4 Updated by Richard Duivenvoorde over 3 years ago
Further investigating. It's getting stranger.
I have a new laptop, and so a fresh compiled QGIS, and I tested this there: no problem??
So thinking that it was something in the old laptop then, I started QGIS there with a new config, created a project and.. working.
Thinking it was a plugin, I removed all plugins from my profile.. but working with the created project :-(
WHICH made me think:
- it is the saved(!) PROJECT, and yes: if I open QGIS 2.18 (master seems to work), load the zipped shp attached in a non saved project, the sorting is NOT working
- as soon as I save the projects, it IS working...
Can others test this out?
#9 Updated by Luigi Pirelli over 3 years ago
the issue affect also Master (qgis3 - 64d1848)
the reason is that the sortColum is for some reason initialised to something differet to -1 => it does not sort when selectedOnTop is activated.
the rough fix is doing sort to current orderColumn() that has 0 as first value.
Investigating why orderColumn is set and if it create some more regressions.
#18 Updated by Luigi Pirelli about 3 years ago
discovered that the problem is still available on master if the layer has been loaded from a project with wrong setting values:
The proposed patche force the sortOrder value to be in the correct range value eg:
- Qt::AscendingOrder = 0
- QtDescendingOrder = 1
but the default value is loaded from the project in the tag:
<attributetableconfig ... sortOrder="<value>" >
that is loaded through code:
if for some reason (and seems many project can be affected) the value is not 0 or 1 => the sortOrder is skipped during sort => not applied