Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attribute Table refresh issue using the Quick Field Calculation Bar #25210

Closed
qgib opened this issue Oct 21, 2017 · 24 comments
Closed

Attribute Table refresh issue using the Quick Field Calculation Bar #25210

qgib opened this issue Oct 21, 2017 · 24 comments
Labels
Attribute Table Bug Either a bug report, or a bug fix. Let's hope for the latter! High Priority Regression Something which used to work, but doesn't anymore

Comments

@qgib
Copy link
Contributor

qgib commented Oct 21, 2017

Author Name: Geo Dev (Geo Dev)
Original Redmine Issue: 17312
Affected QGIS version: master
Redmine category:attribute_table
Assignee: Luigi Pirelli


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 issue(s): #25086 (relates)
Redmine related issue(s): 17187


@qgib
Copy link
Contributor Author

qgib commented Oct 21, 2017

Author Name: sand thorn (sand thorn)


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?

@qgib
Copy link
Contributor Author

qgib commented Oct 23, 2017

Author Name: Jürgen Fischer (@jef-n)


@qgib
Copy link
Contributor Author

qgib commented Oct 23, 2017

Author Name: Giovanni Manghi (@gioman)


It seems to affect Windows, as on Linux with the same patch the table is auto-refreshed.


  • operating_system was changed from to Windows

@qgib
Copy link
Contributor Author

qgib commented Oct 23, 2017

Author Name: Luigi Pirelli (@luipir)


trying to replicate

@qgib
Copy link
Contributor Author

qgib commented Oct 23, 2017

Author Name: Luigi Pirelli (@luipir)


replicated on 2.18.13-21 on win and linux

@qgib
Copy link
Contributor Author

qgib commented Oct 23, 2017

Author Name: Giovanni Manghi (@gioman)


Luigi Pirelli wrote:

replicated on 2.18.13-21 on win and linux

that's weird, work as expected for me on Linux.

@qgib
Copy link
Contributor Author

qgib commented Oct 23, 2017

Author Name: Luigi Pirelli (@luipir)


hmmm... probably having a different feature show option? I was able to replicate with "Show All feature"

@qgib
Copy link
Contributor Author

qgib commented Oct 23, 2017

Author Name: Luigi Pirelli (@luipir)


  • assigned_to_id was configured as Luigi Pirelli

@qgib
Copy link
Contributor Author

qgib commented Oct 23, 2017

Author Name: Giovanni Manghi (@gioman)


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?

@qgib
Copy link
Contributor Author

qgib commented Oct 23, 2017

Author Name: Luigi Pirelli (@luipir)


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.


  • 11581 was configured as test.gpkg
  • 11580 was configured as test.qgs

@qgib
Copy link
Contributor Author

qgib commented Oct 23, 2017

Author Name: Luigi Pirelli (@luipir)


no, no more reload is necessary. Explicitely reload is present every time endEditCommand is triggered

@qgib
Copy link
Contributor Author

qgib commented Oct 23, 2017

Author Name: Luigi Pirelli (@luipir)


checking if this patch is affecting tests:
116/261 Test #10175: qgis_dualviewtest .......................***Exception: Other 2.02 sec
145/261 Test #10204: qgis_attributetabletest .................***Exception: Other 1.63 sec

@qgib
Copy link
Contributor Author

qgib commented Oct 23, 2017

Author Name: Luigi Pirelli (@luipir)


this tests fails locally also without my patch! on travis the build is successfull :/

@qgib
Copy link
Contributor Author

qgib commented Oct 23, 2017

Author Name: Luigi Pirelli (@luipir)


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.

@qgib
Copy link
Contributor Author

qgib commented Oct 24, 2017

Author Name: Luigi Pirelli (@luipir)


for 2.18 added PR #5433

next steps will be PR for 3.0 and add a test to avoid regressions

@qgib
Copy link
Contributor Author

qgib commented Oct 24, 2017

Author Name: Luigi Pirelli (@luipir)


Applied in changeset d6a39e9.


  • status_id was changed from Open to Closed
  • done_ratio was changed from 0 to 100

@qgib
Copy link
Contributor Author

qgib commented Oct 24, 2017

Author Name: Luigi Pirelli (@luipir)


still have to be fixed on master where I want to add unit test


  • status_id was changed from Closed to Open

@qgib
Copy link
Contributor Author

qgib commented Oct 31, 2017

Author Name: Luigi Pirelli (@luipir)


Applied in changeset 192d6f9.


  • status_id was changed from Open to Closed

@qgib qgib closed this as completed Oct 31, 2017
@qgib
Copy link
Contributor Author

qgib commented Nov 24, 2017

Author Name: Giovanni Manghi (@gioman)


  • resolution was changed from to fixed/implemented

@qgib
Copy link
Contributor Author

qgib commented Dec 13, 2017

Author Name: Steve Lowman (Steve Lowman)


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.

@qgib
Copy link
Contributor Author

qgib commented Dec 13, 2017

Author Name: Luigi Pirelli (@luipir)


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

@qgib
Copy link
Contributor Author

qgib commented Dec 14, 2017

Author Name: Luigi Pirelli (@luipir)


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

@qgib
Copy link
Contributor Author

qgib commented Dec 14, 2017

Author Name: Giovanni Manghi (@gioman)


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.

@qgib
Copy link
Contributor Author

qgib commented Dec 14, 2017

Author Name: Luigi Pirelli (@luipir)


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

@qgib qgib added Bug Either a bug report, or a bug fix. Let's hope for the latter! High Priority Attribute Table Regression Something which used to work, but doesn't anymore labels May 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Attribute Table Bug Either a bug report, or a bug fix. Let's hope for the latter! High Priority Regression Something which used to work, but doesn't anymore
Projects
None yet
Development

No branches or pull requests

1 participant