Bug 418922 - On large document, merging down a layer results in different layer getting selected after the merge
Summary: On large document, merging down a layer results in different layer getting se...
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Layer Stack (show other bugs)
Version: git master (please specify the git hash!)
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Dmitry Kazakov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-03-16 14:40 UTC by Raghavendra kamath
Modified: 2020-08-19 22:09 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Raghavendra kamath 2020-03-16 14:40:02 UTC
SUMMARY

On large documents (12k x 16k) merging down a layer selects a layer below the resulting layer after the merge. This happens briefly until the resulting layer is reselected and active again. But if the document is heavy enough the switch never happens and the selection stays in the wrong layer.


STEPS TO REPRODUCE
1. Create a new document of dimension 12000 X 16000
2. Create 4-5 layers
3. Choose layer number 4 and merge it down with Ctrl + E 
4. For a brief moment the layer that is selected in the layer stack after the merge is layer 2 instead of resulting layer 3.

OBSERVED RESULT
Active layer is slow to revert to merged result layer, and if document is heavy it stays stuck on the wrong layer in the bottom of the resulting layer

EXPECTED RESULT
Layer highlight and selection should not be moved to bottom layer

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 5.18.2
KDE Frameworks Version: 5.67.0
Qt Version: 5.14.1
Kernel Version: 5.5.7-arch1-1
OS Type: 64-bit
Processors: 8 × Intel® Core™ i7-4790K CPU @ 4.00GHz
Memory: 15.6 GiB of RAM
Comment 1 Halla Rempt 2020-03-17 08:46:08 UTC
Yes, I see this happen.
Comment 2 Dmitry Kazakov 2020-08-19 22:09:09 UTC
Git commit 8fd316da11d6ec5c8a129bc88dd042fb0bcdc659 by Dmitry Kazakov.
Committed on 19/08/2020 at 22:08.
Pushed by dkazakov into branch 'krita/4.3'.

Fix temporary wrongly selected layer when merging down huge layers

The problem happened because of our workaround for Qt's removed
item avoidance algorithm. On element removal, Qt selects an item above
that, but we need a reverse, below it.

The previous implementation just tried to fix Qt's behavior after the
removal, but that didn't seem to work correctly in case of merge down.
Therefore, this patch implements a special signal that is fired *before*
beginRemoveRows(), that fixes the selection before Qt can lay its hands
on it.
Related: bug 345601

M  +15   -0    libs/ui/kis_node_filter_proxy_model.cpp
M  +4    -0    libs/ui/kis_node_filter_proxy_model.h
M  +1    -0    libs/ui/kis_node_model.cpp
M  +1    -0    libs/ui/kis_node_model.h
M  +9    -9    plugins/dockers/layerdocker/LayerBox.cpp
M  +1    -1    plugins/dockers/layerdocker/LayerBox.h

https://invent.kde.org/graphics/krita/commit/8fd316da11d6ec5c8a129bc88dd042fb0bcdc659
Comment 3 Dmitry Kazakov 2020-08-19 22:09:41 UTC
Git commit 87d27964b5893f67c95deb03d73198a8acb6849a by Dmitry Kazakov.
Committed on 19/08/2020 at 22:09.
Pushed by dkazakov into branch 'master'.

Fix temporary wrongly selected layer when merging down huge layers

The problem happened because of our workaround for Qt's removed
item avoidance algorithm. On element removal, Qt selects an item above
that, but we need a reverse, below it.

The previous implementation just tried to fix Qt's behavior after the
removal, but that didn't seem to work correctly in case of merge down.
Therefore, this patch implements a special signal that is fired *before*
beginRemoveRows(), that fixes the selection before Qt can lay its hands
on it.
Related: bug 345601

M  +15   -0    libs/ui/kis_node_filter_proxy_model.cpp
M  +4    -0    libs/ui/kis_node_filter_proxy_model.h
M  +1    -0    libs/ui/kis_node_model.cpp
M  +1    -0    libs/ui/kis_node_model.h
M  +9    -9    plugins/dockers/layerdocker/LayerBox.cpp
M  +1    -1    plugins/dockers/layerdocker/LayerBox.h

https://invent.kde.org/graphics/krita/commit/87d27964b5893f67c95deb03d73198a8acb6849a