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

Wrong image preview and image preview size in form #33682

Closed
hkautz opened this issue Jan 9, 2020 · 7 comments · Fixed by #37093
Closed

Wrong image preview and image preview size in form #33682

hkautz opened this issue Jan 9, 2020 · 7 comments · Fixed by #37093
Assignees
Labels
Attribute Table Bug Either a bug report, or a bug fix. Let's hope for the latter! Forms High Priority

Comments

@hkautz
Copy link

hkautz commented Jan 9, 2020

I have problems with the integrated document viewer when an attribute form is created with the drag and drop designer.

I am working with a gpkg layer (polygon) where some attributes are paths to images/photos.
For fill in data, I use the Attributes Form -> for better structure I use the form Layout drag and drop designer. (Layout see attachment as sshot_1.png)
and for images/photos the Widget Type „Attachment“.

I have defined the image width/height in the Integrated Document Viewer to 150X150px.
When visualizing the table in the form view, some strange things in displaying the former inserted pictures appear: The images start as a 1x1px image and grows automatically to the full size as wide as the attribute form. Completely ignoring the defined 150x150px. Until every single image reaches the full size, the system is blocked so I can only watch the images growing.

The second issue when working with this layer is following:
(This issue could not be reproduced in the attached sample– it only appeared in the original project but I suggest it could have the same origin)

When switching between different features, I would expect that:

  • If an image was selected and saved before, it should be displayed.
  • If no image has been selected before, the image path and the preview should be empty

What on my system appears is following:

  • If an image was selected and saved before, the image grows as described in the first part.
  • If no image has been selected before, the image path is empty but the image from the feature I selected before is displayed by growing.

How to Reproduce

  1. create a layer (.shp or .gpkg layer) with attribute fields for the photo path. Type Text, Length: 250 (Or use the sample data attached)
  2. in the layer properties choose Attribute form
  3. Use the Drag and Drop Designer and structure the form as in the sshot_1.png
    Tab1 (create Category Tab1 as a Tab, foto1 as a group in a container and so on)
    Define the widget type "Attachment" for each of these fields
    In the Integrated Document Viewer set the Type to Image and try to set a preview size of 150x150px
  4. Change to edit mode and digitize some objects and add on some features fotos per path.
  5. Save and stop editing
  6. in the attribute table switch to Form View and select different features.
  7. Voila - !
    QGIS and OS versions
QGIS version 3.4.13-Madeira QGIS code revision QGIS code revision
Compiled against Qt 5.11.2 Running against Qt 5.11.2
Compiled against GDAL/OGR 2.4.1 Running against GDAL/OGR 2.4.1
Compiled against GEOS 3.8.0-CAPI-1.13.1 Running against GEOS 3.8.0-CAPI-1.13.1
PostgreSQL Client Version 11.5 SpatiaLite Version 4.3.0
QWT Version 6.1.3 QScintilla2 Version 2.10.8
Compiled against PROJ 5.2.0 Running against PROJ Rel. 5.2.0, September 15th, 2018
Active python plugins attributePainter; latlontools; mapswipetool_plugin; openlayers_plugin; Qgis2threejs; qgis2web; quick_map_services; SelectWithin; shapetools; db_manager; MetaSearch; processing
problem.zip
sshot-1
@hkautz hkautz added the Bug Either a bug report, or a bug fix. Let's hope for the latter! label Jan 9, 2020
@gioman
Copy link
Contributor

gioman commented Jan 9, 2020

How to Reproduce

1. create a layer (.shp or .gpkg layer) with attribute fields for the photo path. Type Text, Length: 250 (Or use the sample data attached)

2. in the layer properties choose Attribute form

3. Use the Drag and Drop Designer and structure the form as in the sshot_1.png
   Tab1 (create Category Tab1 as a Tab, foto1 as a group in a container and so on)
   Define the widget type "Attachment" for each of these fields
   In the Integrated Document Viewer set the Type to Image and try to set a preview size of 150x150px

4. Change to edit mode and digitize some objects and add on some features fotos per path.

5. Save and stop editing

6. in the attribute table switch to Form View and select different features.

7. Voila - !

@hkautz could you attach an already prepared project? thanks!

@gioman gioman added the Feedback Waiting on the submitter for answers label Jan 9, 2020
@hkautz
Copy link
Author

hkautz commented Jan 10, 2020

@gioman THX for replying - in the attached problem.zip is the gpkg included which you can open and see the issue.

@gioman gioman changed the title Wrong Image-Preview size in Integrated Document View in complex Drag & Drop Designer Form Layout Wrong image preview size in form Jan 17, 2020
@gioman gioman removed the Feedback Waiting on the submitter for answers label Jan 17, 2020
@gioman gioman changed the title Wrong image preview size in form Wrong image preview and image preview size in form Jan 17, 2020
@gioman
Copy link
Contributor

gioman commented Jan 17, 2020

@hkautz

There are actually two (or more?) issues. The one about the wrong preview size and the "growing" effect:

Peek 2020-01-17 13-19

and the fact that if the if the form points to a picture with a path that is wrong/not available then QGIS shows the WRONG picture. In the image below the path

d:\problem\pictures\b.jpg

does not exist, but in form view QGIS shows the image of the previous record/feature. I'll tag this as HIGH PRIORITY as showing the wrong picture can leas to very bad results/decisions...

Peek 2020-01-17 13-21

By the way I tested on QGIS master on Windows.

@alexbruy
Copy link
Contributor

Probably related to #23223

@elpaso
Copy link
Contributor

elpaso commented Jan 23, 2020

@alexbruy do you want to take this?
If not, I can have a look, doesn't sound trivial though.

@alexbruy
Copy link
Contributor

@elpaso unfortunately I don't have much time — need to do other work and also preparing to 5 day workshop.

@elpaso elpaso self-assigned this Jun 10, 2020
elpaso added a commit to elpaso/QGIS that referenced this issue Jun 10, 2020
elpaso added a commit to elpaso/QGIS that referenced this issue Jun 12, 2020
Fixes qgis#33682  (maybe)

Cherry-pick from master commit 72c0ae7
@qnmai
Copy link

qnmai commented Jul 10, 2020

@elpaso Which version of QGIS takes this change into consideration? Cheers

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! Forms High Priority
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants