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

copy/paste feature tool sets integer/decimal fields of destination feature to 0 if the source feature fields are NULL #57710

Open
2 tasks
faridcher opened this issue Jun 7, 2024 · 17 comments
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter!

Comments

@faridcher
Copy link

faridcher commented Jun 7, 2024

What is the bug or the crash?

copy/paste feature tool sets numeric fields of destination feature to 0 if the source feature fields are NULL. It preserves NULL values of string fields. In the following image, a pasted feature is located northeast of the source feature and is selected. The integer and decimal fields are set to zero arbitrarily!

image

Steps to reproduce the issue

use the sample data. start editing the point layer and copy/paste the single point and check its attributes.

test.zip

Versions

3.34.6

Supported QGIS version

  • I'm running a supported QGIS version according to the roadmap.

New profile

Additional context

No response

@faridcher faridcher added the Bug Either a bug report, or a bug fix. Let's hope for the latter! label Jun 7, 2024
@Djedouas
Copy link
Member

Hello,

I can't reproduce the issue on QGIS master nor on QGIS 3.34.7 (Ubuntu 22.04).

I tried with

  • copy/pasting with the attribute table (selecting a row, copy, paste)
  • the copy-move map tool
  • copy/pasting the feature in the map canvas (selecting the feature, copy, paste)

What is the exact tools you used?

Are you on Windows version?

Thanks

@Djedouas Djedouas added the Feedback Waiting on the submitter for answers label Jun 20, 2024
@faridcher
Copy link
Author

faridcher commented Jun 20, 2024

@Djedouas thank you for testing.

  • copy/pasting with the attribute table (selecting a row, copy, paste) --> the bug shows up
  • the copy-move map tool --> no problem
  • copy/pasting the feature in the map canvas (selecting the feature, copy, paste) --> the bug shows up

OS: Debian 12 (testing)

@Djedouas
Copy link
Member

Tested on fedora with QGIS 3.34.6, unable to reproduce.

  • copy/pasting with the attribute table (selecting a row, copy, paste) --> no problem
  • the copy-move map tool --> no problem
  • copy/pasting the feature in the map canvas (selecting the feature, copy, paste) --> no problem

Every time I have correct fields values of NULL for all 3 fields:

image


Could you maybe have configured widgets in the attributes form layer parameters? With default values or something?

@faridcher
Copy link
Author

@Djedouas I just stared with a new blank project, and added the layer, without any widget configuration (default values). You may verify in the sample project/data files. I can record a video if warranted?

@Djedouas
Copy link
Member

Yes please it can help.

Thanks!

@faridcher
Copy link
Author

Screencast
06_21_2024-10:27:18_AM.webm

@Djedouas
Copy link
Member

Screencast is perfect, thank you!

Unfortunately, I can't reproduce the issue.

It could be a default setting in QGIS parameters I don't know about. Could you try with a completely new profile?

image

Thanks

@faridcher
Copy link
Author

Sure, unfortunately with the new profile, the same problems occur.

@Djedouas
Copy link
Member

Can you test the following please:

  1. Create a feature with an empty string in string field (not a NULL value, an empty value)
  2. Copy this feature
  3. Paste it
  4. Check if the string value of the pasted feature is NULL or empty

@Djedouas
Copy link
Member

OS: Debian 12 (testing)

Do you use QGIS package https://ubuntugis.qgis.org/ubuntugis-ltr/ to have QGIS dependencies on Debian testing?

At some point QGIS relies on OGR to read the clipboard content and determine field values.

What GDAL/OGR version are you using (see in QGIS about menu)?

@Djedouas
Copy link
Member

Also, can you copy this

wkt_geom	fid	string	integer1	decimal1
Point (51.37065479056155937 35.65868137095111479)	1			

and directly paste it in the editable attribute table (or editable layer in the map canvas) please?

(note the tabulations at the end of the line)

@Djedouas
Copy link
Member

I created a VM with Debian 12 testing and was able to reproduce the issue!

@Djedouas
Copy link
Member

What is strange is that I have the issue when on Debian 12 testing KDE plasma Wayland, but I don't have the issue on Debian 12 testing KDE plasma X11.

It might come from the clipboard integration.

What do you use?

@faridcher
Copy link
Author

faridcher commented Jun 21, 2024

I am on Debian 12 with Gnome and Wayland
pasting the feature with WKT, creates it as expected. with NULL for all 3 attribute fields.
Since I am on Debian, I use its repository to install qgis and not ubuntugis!
Gdal 3.9.0

@Djedouas
Copy link
Member

If I copy the feature to xclipboard and paste it with keyboard, the bug shows up again. So it''s clearly from GDAL and Wayland and not QGIS

Can you provide a screencast of this please?


I've found a problem in QGIS clipboard with NULL values for which I will post a fix in a PR next week, but I'm not entirely sure that it's related to your issue.

In fact, a feature copy action in QGIS

  • creates internal copied features (QGIS format)
  • puts text in the system clipboard

The paste action in QGIS shoud paste internal copied features object, even if there is text in the clipboard.

The problem I found is that inside the clipboard text, NULL values are transformed to 0 (for int and double).

In every QGIS version I can reproduce this :

  1. copy the feature
  2. paste the text somewhere
  3. copy the text
  4. paste in QGIS
  5. --> we get the 0s

So it seems that your paste action is always taking the text from the clipboard... if it is the case my PR will fix this.


I'm not sure that I am being very clear here, but we can continue to investigate later on after the PR is merged.

Thanks!

@faridcher
Copy link
Author

faridcher commented Jun 21, 2024

I take back:

If I copy the feature to xclipboard and paste it with keyboard, the bug shows up again. So it''s clearly from GDAL and Wayland and not QGIS

Sure. We will test with your commit later; you may back reference this issue in your PR. Please remove the feedback label so this issue remains open.

thanks for your time on this

Djedouas added a commit to Djedouas/QGIS that referenced this issue Jun 24, 2024
Numeric attribues with a NULL value were represented with a 0 value
in the system text and html clipboard.

Related to qgis#57710.
Djedouas added a commit to Djedouas/QGIS that referenced this issue Jun 24, 2024
Numeric attributes with a NULL value were represented with a 0 value
in the system text and html clipboard.

Related to qgis#57710.
Djedouas added a commit to Djedouas/QGIS that referenced this issue Jun 24, 2024
Numeric attributes with a NULL value were represented with a 0 value
in the system text and html clipboard.

Related to qgis#57710.
Djedouas added a commit to Djedouas/QGIS that referenced this issue Jun 24, 2024
Numeric attributes with a NULL value were represented with a 0 value
in the system text and html clipboard.

Related to qgis#57710.
Djedouas added a commit to Djedouas/QGIS that referenced this issue Jun 24, 2024
Numeric attributes with a NULL value were represented with a 0 value
in the system text and html clipboard.

Related to qgis#57710.
Djedouas added a commit to Djedouas/QGIS that referenced this issue Jun 24, 2024
Numeric attributes with a NULL value were represented with a 0 value
in the system text and html clipboard.

Related to qgis#57710.
Djedouas added a commit to Djedouas/QGIS that referenced this issue Jun 24, 2024
Numeric attributes with a NULL value were represented with a 0 value
in the system text and html clipboard.

Related to qgis#57710.
nyalldawson pushed a commit that referenced this issue Jun 24, 2024
Numeric attributes with a NULL value were represented with a 0 value
in the system text and html clipboard.

Related to #57710.
nyalldawson pushed a commit that referenced this issue Jun 24, 2024
Numeric attributes with a NULL value were represented with a 0 value
in the system text and html clipboard.

Related to #57710.
Copy link

github-actions bot commented Jul 6, 2024

The QGIS project highly values your report and would love to see it addressed. However, this issue has been left in feedback mode for the last 14 days and is being automatically marked as "stale".
If you would like to continue with this issue, please provide any missing information or answer any open questions. If you could resolve the issue yourself meanwhile, please leave a note for future readers with the same problem and close the issue.
In case you should have any uncertainty, please leave a comment and we will be happy to help you proceed with this issue.
If there is no further activity on this issue, it will be closed in a week.

@github-actions github-actions bot added the stale Uh oh! Seems this work is abandoned, and the PR is about to close. label Jul 6, 2024
@Djedouas Djedouas removed Feedback Waiting on the submitter for answers stale Uh oh! Seems this work is abandoned, and the PR is about to close. labels Jul 8, 2024
nyalldawson pushed a commit that referenced this issue Jul 19, 2024
Numeric attributes with a NULL value were represented with a 0 value
in the system text and html clipboard.

Related to #57710.
nyalldawson pushed a commit that referenced this issue Jul 20, 2024
Numeric attributes with a NULL value were represented with a 0 value
in the system text and html clipboard.

Related to #57710.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter!
Projects
None yet
Development

No branches or pull requests

2 participants