-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Update Attribute Table after field calculation: fixes #17312 #5433
Update Attribute Table after field calculation: fixes #17312 #5433
Conversation
My future plan are:
|
The actual test: testqgsattributetable.cpp does not cover this regression because does not control the value rendered in the QgsAttributeTableView In this moment I'm not able to find the way to read the cell view content to compare with the expected an value. |
src/app/qgsattributetabledialog.cpp
Outdated
// refresh table with updated values | ||
// fixes https://issues.qgis.org/issues/17312 | ||
QgsAttributeTableModel* masterModel = mMainView->masterModel(); | ||
masterModel->reload( masterModel->index( 0, 0 ), masterModel->index( masterModel->rowCount() - 1, masterModel->columnCount() - 1 ) ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you kill the return
above and put this in an else?
Is it possible to only reload the affected column (I guess this reloads everything)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, that's was my first solution, but I wasn't able to find the correct api to get the involved column from its name.
my first solution was gettin the column with:
int modelColumn = masterModel->fieldIdx( fieldindex );
Is it the correct way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/**
* get field index from column
*/
int fieldIdx( int col ) const;
/**
* get column from field index
*/
int fieldCol( int idx ) const;
failed PyQgsComposerPicture not related with this PR! |
@m-kuhn reloaded only related column get using masterModel->fieldCol() |
Thanks @luipir |
Description
The attribute table is not updated because listener of endEditCommand does no more reload masterModel to avoid change row postion during editing.
This patch reload masterModel explicitly as done in other part of the same code.
Checklist
fixes #11111
in the commit message next to the description[FEATURE]
in the commit message[needs-docs]
in the commit message and containt sufficient information in the commit message to be documentedscripts/prepare-commit.sh
script before each commit