Bug 435925

Summary: Cursor in annotations or comments field jumps around while face detection is running
Product: [Applications] digikam Reporter: Jens <jens-bugs.kde.org>
Component: Faces-DetectionAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: caulier.gilles, metzpinguin
Priority: NOR    
Version: 7.2.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 8.0.0
Sentry Crash Report:
Attachments: screenvideo showing bug when editing captions during face detection

Description Jens 2021-04-19 17:18:42 UTC
SUMMARY
see $SUBJECT

STEPS TO REPRODUCE
1. start face detection on a number of images with the new engine (which is better but slower).
2. while it's running, try to edit a caption of an image, or description. 


OBSERVED RESULT
For each image, when face detection advances to the next image, the cursor in any input field jumps. Editing will be destroyed and mangled.

EXPECTED RESULT
Editing image metadata should be possible with any background task running.

SOFTWARE/OS VERSIONS
KDE Neon with Digikam Appimage and all updates applied.
Comment 1 Maik Qualmann 2021-04-19 17:33:38 UTC
I cannot reproduce the problem. When I start face recognition and switch to album view, I can easily edit the title or caption in the left sidebar. What do you mean with the cursor jumps? Left / right or up and down, to the beginning of the line, etc?

Maik
Comment 2 Maik Qualmann 2021-04-19 17:34:44 UTC
I also mean detection not recognition.

Maik
Comment 3 Jens 2021-04-19 20:36:10 UTC
Created attachment 137714 [details]
screenvideo showing bug when editing captions during face detection

Here's a video where I start face detection/recognition, and while it's running, try to edit the image captions. I am only typing the ABC, occasionally deleteing everything when the chaos is too big. Everything else - selection, cursor jumping to the first letter, order reversed, missing characters, etc is caused by Digikam.
Comment 4 Maik Qualmann 2021-04-20 05:48:02 UTC
Of course, you must not be in an item view that is currently being updated by adding newly found faces. Adding new elements naturally triggers events to reload the sidebar. If we suppressed this, we would have the problem that the information in the sidebar is not up-to-date. Just go to the album view or another search / date / tag album.

Maik
Comment 5 Maik Qualmann 2021-04-20 05:49:16 UTC

*** This bug has been marked as a duplicate of bug 402322 ***
Comment 6 Jens 2021-04-24 09:50:33 UTC
I am already in the album view.

My workflow is:
- import images
- geotag images
- select all images in album -> right click -> Detect faces
- while detection is running (because this takes time),
  - rate images (this works)
  - tag images (this also works)
  - add descriptions (this doesn't work unless I copy & paste the text)
  - etc.

The weird thing is, with the old algorithm this worked quite well.
Since the new (really better, thank you!) algorithm for face detection is implemented, the input fields reset after each image.

The problem would probably also be solved if the sidebars would remember the cursor position of the currently active field (if any) and restore it, when it's being reloaded.
Comment 7 Jens 2021-04-24 09:51:50 UTC
Or, alternatively, skip or postpone reloading the sidebar if there is a focused input field in the sidebar.
This makes sense, because in this case, users probably don't care about the tags being up to date because they are doing other editing. Reload as soon as the input field loses focus.
Comment 8 Maik Qualmann 2021-04-24 11:21:15 UTC
I cannot reproduce the problem as you describe it. I can easily edit the title and caption fields. In this scenario there are almost no events as no new items are added to the view and the current selection does not change automatically. Have you activated OpenCL? Possibly a problem with your graphics card / driver in conjunction with the hardware acceleration in Qt.

Maik
Comment 9 caulier.gilles 2022-01-10 05:42:02 UTC
Hi Jens and happy new year,

What about this file using current 7.5.0 pre-release Bundle
available here :

https://files.kde.org/digikam/

Thanks in advance

Gilles Caulier
Comment 10 Maik Qualmann 2022-10-30 17:19:56 UTC
Git commit ffb8026d8637d2646d421a56a8810a6fbabbb4bf by Maik Qualmann.
Committed on 30/10/2022 at 17:18.
Pushed by mqualmann into branch 'master'.

massive reduction unnecessary sidebar updates
FIXED-IN: 8.0.0

M  +1    -1    NEWS
M  +8    -6    core/libs/properties/itempropertiessidebardb.cpp

https://invent.kde.org/graphics/digikam/commit/ffb8026d8637d2646d421a56a8810a6fbabbb4bf
Comment 11 Jens 2022-10-30 17:46:06 UTC
Thank you! Will look at this as soon as an appimage is posted.