Bug report #17312
Attribute Table refresh issue using the Quick Field Calculation Bar
Status: | Closed | ||
---|---|---|---|
Priority: | High | ||
Assignee: | Luigi Pirelli | ||
Category: | Attribute table | ||
Affected QGIS version: | master | Regression?: | Yes |
Operating System: | Windows | Easy fix?: | No |
Pull Request or Patch supplied: | No | Resolution: | fixed/implemented |
Crashes QGIS or corrupts data: | No | Copied to github as #: | 25210 |
Description
The Attribute Table doesn't immediately update when fields are set with the Quick Field Calculation Bar.
Steps to replicate the issue:
- Open the Attribute Table of any vector layer
- Start editing
- Select an existing field in the drop-down list of the Quick Field Calculation Bar
- Fill the textbox of the Bar with a value or an expression
- Click on Update All button: the table doesn't update
- Change the focus (e.g. filling the texbox with another value or selecting another field in the drop-down list): the table doesn't update
- Force the refresh of the table (e.g. clicking on cells, resizing/sorting the columns, scrolling the table, resizing the table window): the table updates
Same behavior with Update Selected and Update Filtered buttons.
The user has the perception that the Update buttons do not work (priority: High).
The issue also occurs in QGIS 2.18-dev.
Related issues
Associated revisions
Update Attr Table after field calculation: fixes #17312
Update Attr Table after field calculation: fixes #17312
History
#1 Updated by sand thorn about 7 years ago
I confirm this on
OS: Windows 10 64-bit
QGIS: 2.18.13-20 64-bit (via OSGeo4W pre-compiled) (Thanks to Giovanni Manghi to give me how to try this)
A click on "Update All", "Update Filtered", "Update Selected" should also raise an update event on all shown cells, but it doesn't. You have to click once more in the table area to get the shown cells updated.
I don't know this behaviour is on purpose or a been-forever bug or a regression. However I guess it would be nice if we don't have to have another click, would you agree?
#2 Updated by Jürgen Fischer about 7 years ago
- Related to Bug report #17187: Attribute Table refresh issue added
#3 Updated by Giovanni Manghi about 7 years ago
- Operating System set to Windows
It seems to affect Windows, as on Linux with the same patch the table is auto-refreshed.
#4 Updated by Luigi Pirelli about 7 years ago
trying to replicate
#5 Updated by Luigi Pirelli about 7 years ago
replicated on 2.18.13-21 on win and linux
#6 Updated by Giovanni Manghi about 7 years ago
Luigi Pirelli wrote:
replicated on 2.18.13-21 on win and linux
that's weird, work as expected for me on Linux.
#7 Updated by Luigi Pirelli about 7 years ago
hmmm... probably having a different feature show option? I was able to replicate with "Show All feature"
#8 Updated by Luigi Pirelli about 7 years ago
- Assignee set to Luigi Pirelli
#9 Updated by Giovanni Manghi about 7 years ago
Luigi Pirelli wrote:
hmmm... probably having a different feature show option? I was able to replicate with "Show All feature"
here too.
can you attach here the dataset you tested?
#10 Updated by Luigi Pirelli about 7 years ago
this is a side effect of avoid reloading of data during editing
https://issues.qgis.org/projects/qgis/repository/revisions/6c84b6ea45e02ba71506fdbc6f5a24800c56b1dc/diff/src/gui/attributetable/qgsattributetablemodel.cpp
The reload was triggered by endEditCommand triggered here:
https://github.com/qgis/QGIS/blob/release-2_18/src/app/qgsattributetabledialog.cpp#L514
Adding a explicit column reload after calculation fix the issue.
e.g. adding the following code after the above lines
// refresh table with updated values // fixes http://issues.qgis.org/issues/17312 QgsAttributeTableModel* masterModel = mMainView->masterModel(); int modelColumn = masterModel->fieldIdx( fieldindex ); masterModel->reload( masterModel->index( 0, modelColumn ), masterModel->index( masterModel->rowCount() - 1, modelColumn ) );
Checking if it's necessary to add more explicit reloads in other parts of QgsAttributeTableDialog
Attached test file and project used to replicate.
#11 Updated by Luigi Pirelli about 7 years ago
no, no more reload is necessary. Explicitely reload is present every time endEditCommand is triggered
#12 Updated by Luigi Pirelli about 7 years ago
#13 Updated by Luigi Pirelli about 7 years ago
this tests fails locally also without my patch! on travis the build is successfull :/
#14 Updated by Luigi Pirelli about 7 years ago
a simplified patch:
QgsAttributeTableModel* masterModel = mMainView->masterModel();
masterModel->reload( masterModel->index( 0, 0 ), masterModel->index( masterModel->rowCount() - 1, masterModel->columnCount() - 1 )
works for 2.18 and master... the patch does not fail current master tests.
Now creating a failing test to avoid the issue again.
#15 Updated by Luigi Pirelli about 7 years ago
for 2.18 added PR https://github.com/qgis/QGIS/pull/5433
next steps will be PR for 3.0 and add a test to avoid regressions
#16 Updated by Luigi Pirelli about 7 years ago
- Status changed from Open to Closed
- % Done changed from 0 to 100
Applied in changeset qgis|d6a39e9018d2e48d32db45f07f9a26e8d1bf9867.
#17 Updated by Luigi Pirelli about 7 years ago
- Status changed from Closed to Open
still have to be fixed on master where I want to add unit test
#18 Updated by Luigi Pirelli about 7 years ago
- Status changed from Open to Closed
Applied in changeset qgis|192d6f93d03efa785d9d96e04a71afd82dcbc1b2.
#19 Updated by Giovanni Manghi about 7 years ago
- Resolution set to fixed/implemented
#20 Updated by Steve Lowman about 7 years ago
Please re-open this. I have a calculation failing to display until 'Save' is clicked'. This is in QGIS 2.18.15 LTR, working with a shapefile in W10.
#21 Updated by Luigi Pirelli about 7 years ago
Steve Lowman wrote:
Please re-open this. I have a calculation failing to display until 'Save' is clicked'. This is in QGIS 2.18.15 LTR, working with a shapefile in W10.
I'll try to replicate tomorrow (first on linux)... tnx for the report
#22 Updated by Luigi Pirelli about 7 years ago
can't replicate on Linux with latest 2.18 build (2ef6a82)
doing a verification on Win, btw do you a specific procedure that replicate the issue? Steve, if I follow that explained in this issue I can't replicate.
Luigi Pirelli wrote:
Steve Lowman wrote:
Please re-open this. I have a calculation failing to display until 'Save' is clicked'. This is in QGIS 2.18.15 LTR, working with a shapefile in W10.
I'll try to replicate tomorrow (first on linux)... tnx for the report
#23 Updated by Giovanni Manghi about 7 years ago
Steve Lowman wrote:
Please re-open this. I have a calculation failing to display until 'Save' is clicked'. This is in QGIS 2.18.15 LTR, working with a shapefile in W10.
just tested on 2.18.15 on Windows and works ok for me.
#24 Updated by Luigi Pirelli about 7 years ago
Giovanni Manghi wrote:
Steve Lowman wrote:
Please re-open this. I have a calculation failing to display until 'Save' is clicked'. This is in QGIS 2.18.15 LTR, working with a shapefile in W10.
just tested on 2.18.15 on Windows and works ok for me.
please Steve:
1) check for an updated QGIS
2) if the error persist, give us a procedure to replicate... until this the tiket will remain closed
tnx