Bug report #18508

Integers should be shown in full, and not with exponential notation

Added by Mike Taves about 2 years ago. Updated about 2 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:GUI
Affected QGIS version:3.0.0 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:26396

Description

With QGIS 3 on Windows via OSGeo4W and a PostGIS table with integer columns, the values are sometimes represented in a lossy scientific/exponential notation.

For instance, an integer 15050072 viewed in QGIS 3's attribute table/identify window is displayed as 1.50501e+07, which has lost parts of the integer value (i.e. it is lossy).

This same value from other software (psql, pgAdmin, Python, etc.) is always showwn in full, and never in exponential notation. Unlike floating-point types, integers are lossless and deserve to be shown in full, often because they are IDs or something useful.

Fortunately, the Feature Attribute dialog shows the integer in full, so it can be viewed/modified. Unfortunately, the only way to copy this attribute to the clipboard is to toggle editing ON, click Edit feature form, and copy there (hopefully without unintentionally editing the attribute in the process!)

The obvious affected components are the attribute tables, and the identify window. Features like "copy cell content"/"copy attribute value" are expected to copy the integer value too.

Associated revisions

Revision 054470f0
Added by Nyall Dawson about 2 years ago

Never show int/long attributes in scientific notation

Fixes #18508, #18302

Revision 1d102b29
Added by Nyall Dawson about 2 years ago

Never show int/long attributes in scientific notation

Fixes #18508, #18302

(cherry-picked from 054470f)

History

#1 Updated by Harrissou Santanna about 2 years ago

  • Status changed from Open to Feedback

Hi
The first part of your message (relative to exponential values shown) is a duplicate of #18302
Mike Toews wrote:

The obvious affected components are the attribute tables, and the identify window. Features like "copy cell content"/"copy attribute value" are expected to copy the integer value too.

They do not work as expected? Right-click on a field and select "copy cell content" does copy the content here. No need to toggle to editing.

#2 Updated by Mike Taves about 2 years ago

I'll describe the behaviour of these components separately.

From the Identify Results window: Copy attribute value: 1.50501e+07 (lossy). Same behavior for Editing ON/OFF, as values cannot be modified in this dialog.

From the Feature Form (accessed from the Identify Results), integer is correctly formatted in full in a spinBox widget on the default form.
  • Editing OFF: spinBox is disabled, so selecting or right-clicking the widget has no effect, therefore it's content's cannot be copied. Only viewed.
  • Editing ON: spinBox is enabled, so value can be selected/copied, but has risk of modifying value in the process.
From the Attribute Table, the value is shown as 1.50501e+07 (lossy), and here are some actions:
  • Editing OFF:
    • Copying feature row correctly copies full integer value, however this action copies geometry and other attributes as well.
    • Right-clicking cell and choosing Copy cell content copies "1.50501e+07" to the clipboard.
  • Editing ON:
    • Copying feature row correctly copies full integer value, however this action copies geometry and other attributes as well.
    • Clicking cell selects full integer value, so full value can be copied, but has risk of modifying value in the process.

#3 Updated by Harrissou Santanna about 2 years ago

I generally agree with you that we should not have to toggle to editing a layer in order to be able to copy features values. This is prone to data corruption and in some environment, not all users have edit capabilities on all the layers they work with.

Editing OFF: spinBox is disabled, so selecting or right-clicking the widget has no effect, therefore it's content's cannot be copied. Only viewed

I think this is worth a specific issue report: it should be allowed to copy values from widget in feature form. Could you check if it works with textbox? how it works in 2.18? And would be nice to also check the other limitations you mention in your message with 2.18.

Editing OFF:
  • Copying feature row correctly copies full integer value, however this action copies geometry and other attributes as well.
  • Right-clicking cell and choosing Copy cell content copies "1.50501e+07" to the clipboard

Again, a specific issue report: copying value from cell should copy the actual value and not the displayed one. How does selecting the cell and doing Ctrl+C/Ctrl+V behave?

My idea with new issue reports is to have each report refering to a single issue then easier for devs to understand and pick it according to their area of interest or skills. (You can however reference this discussion in the report).

#4 Updated by Nyall Dawson about 2 years ago

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

Also available in: Atom PDF