<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.kde.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugs.kde.org/"
          
          maintainer="sysadmin@kde.org"
>

    <bug>
          <bug_id>418922</bug_id>
          
          <creation_ts>2020-03-16 14:40:02 +0000</creation_ts>
          <short_desc>On large document, merging down a layer results in different layer getting selected after the merge</short_desc>
          <delta_ts>2020-08-19 22:09:41 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>2</classification_id>
          <classification>Applications</classification>
          <product>krita</product>
          <component>Layer Stack</component>
          <version>git master (please specify the git hash!)</version>
          <rep_platform>Compiled Sources</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>NOR</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Raghavendra kamath">raghu</reporter>
          <assigned_to name="Dmitry Kazakov">dimula73</assigned_to>
          <cc>dimula73</cc>
    
    <cc>halla</cc>
          
          <cf_commitlink>https://invent.kde.org/graphics/krita/commit/87d27964b5893f67c95deb03d73198a8acb6849a</cf_commitlink>
          <cf_versionfixedin></cf_versionfixedin>
          <cf_sentryurl></cf_sentryurl>
          <votes>0</votes>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1916535</commentid>
    <comment_count>0</comment_count>
    <who name="Raghavendra kamath">raghu</who>
    <bug_when>2020-03-16 14:40:02 +0000</bug_when>
    <thetext>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</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1916642</commentid>
    <comment_count>1</comment_count>
    <who name="Halla Rempt">halla</who>
    <bug_when>2020-03-17 08:46:08 +0000</bug_when>
    <thetext>Yes, I see this happen.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1951839</commentid>
    <comment_count>2</comment_count>
    <who name="Dmitry Kazakov">dimula73</who>
    <bug_when>2020-08-19 22:09:09 +0000</bug_when>
    <thetext>Git commit 8fd316da11d6ec5c8a129bc88dd042fb0bcdc659 by Dmitry Kazakov.
Committed on 19/08/2020 at 22:08.
Pushed by dkazakov into branch &apos;krita/4.3&apos;.

Fix temporary wrongly selected layer when merging down huge layers

The problem happened because of our workaround for Qt&apos;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&apos;s behavior after the
removal, but that didn&apos;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</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1951842</commentid>
    <comment_count>3</comment_count>
    <who name="Dmitry Kazakov">dimula73</who>
    <bug_when>2020-08-19 22:09:41 +0000</bug_when>
    <thetext>Git commit 87d27964b5893f67c95deb03d73198a8acb6849a by Dmitry Kazakov.
Committed on 19/08/2020 at 22:09.
Pushed by dkazakov into branch &apos;master&apos;.

Fix temporary wrongly selected layer when merging down huge layers

The problem happened because of our workaround for Qt&apos;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&apos;s behavior after the
removal, but that didn&apos;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</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>