Bug report #15803

2.18: Move Selection to Top not working in attribute table

Added by Richard Duivenvoorde about 8 years ago. Updated over 7 years ago.

Status:Closed
Priority:High
Assignee:Luigi Pirelli
Category: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

Description

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.

0_0.zip - simple example shapefile (3.01 KB) Richard Duivenvoorde, 2016-11-03 06:40 AM

buttonselectiontotop.png - button in attribute file (45.9 KB) Richard Duivenvoorde, 2016-11-03 06:40 AM

Associated revisions

Revision a82b8cfb
Added by Luigi Pirelli over 7 years ago

[attributetable] fix sortOnTop due to sortOrder wrong enum values from QgsAttributeTableConfig: fixes #15803

Revision c092effc
Added by Luigi Pirelli over 7 years ago

[attributetable] fix sortOnTop due to sortOrder wrong enum values from QgsAttributeTableConfig: fixes #15803
port to 3.0 for https://github.com/qgis/QGIS/pull/4306

Revision 8e60510e
Added by Alessandro Pasotti over 7 years ago

Merge pull request #4444 from boundlessgeo/sort_on_top_portTo3

[attributetable] Fix "Move selection to top" for 3.x regression fixes #15803

Revision 7ba28ec1
Added by Alessandro Pasotti over 7 years ago

Merge pull request #4306 from boundlessgeo/sort_on_top

[attributetable] Fix "Move selection to top": for 2.18 regression fixes #15803

History

#1 Updated by Giovanni Manghi about 8 years ago

  • Priority changed from Normal to Severe/Regression
  • Category set to Attribute table

#2 Updated by Giovanni Manghi about 8 years ago

see also #15663

#3 Updated by Richard Duivenvoorde about 8 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 about 8 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?

#5 Updated by Giovanni Manghi almost 8 years ago

  • Affected QGIS version changed from 2.18.0 to 2.18.4
  • Target version set to Version 2.18

#6 Updated by Giovanni Manghi almost 8 years ago

  • Subject changed from 2.18: Move Selection to Top not working in attribute tabel to 2.18: Move Selection to Top not working in attribute table

see also #15370

#7 Updated by Luigi Pirelli almost 8 years ago

confirmed with latest build (5afdf6f) of 2.18 on the test data

#8 Updated by Luigi Pirelli almost 8 years ago

nor saving project change the behaviour

#9 Updated by Luigi Pirelli almost 8 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.

#10 Updated by Luigi Pirelli almost 8 years ago

this PR should fix https://github.com/qgis/QGIS/pull/4306 for 2.18

#11 Updated by Luigi Pirelli almost 8 years ago

confirmed issue in Master with current latest code b8cb196

#12 Updated by Giovanni Manghi over 7 years ago

  • Regression? set to Yes

#13 Updated by Giovanni Manghi over 7 years ago

  • Priority changed from Severe/Regression to High

#14 Updated by Giovanni Manghi over 7 years ago

  • Easy fix? set to No

#15 Updated by Alessandro Pasotti over 7 years ago

  • Description updated (diff)
  • Pull Request or Patch supplied changed from No to Yes

#16 Updated by Alessandro Pasotti over 7 years ago

  • Assignee set to Luigi Pirelli

#17 Updated by Giovanni Manghi over 7 years ago

Alessandro Pasotti wrote:

Patches:
Master: https://github.com/qgis/QGIS/pull/4444 but I cannot reproduce it
2.18: https://github.com/qgis/QGIS/pull/4306

confirmed, on master seems ok (now?).

#18 Updated by Luigi Pirelli over 7 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:
https://github.com/qgis/QGIS/blob/master/src/core/qgsattributetableconfig.cpp#L200

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

#19 Updated by Luigi Pirelli over 7 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

Also available in: Atom PDF