Bug 462879 - Krita doesn't switch and makes newly imported or created layer active [git 9ba7789]
Summary: Krita doesn't switch and makes newly imported or created layer active [git 9b...
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Layer Stack (show other bugs)
Version: nightly build (please specify the git hash!)
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: sh_zam
URL:
Keywords:
: 463035 (view as bug list)
Depends on:
Blocks:
 
Reported: 2022-12-11 04:12 UTC by Raghavendra kamath
Modified: 2022-12-14 12:01 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Raghavendra kamath 2022-12-11 04:12:53 UTC
SUMMARY
This is most probably a side effect of the new check-box feature added in the layer docker. When the user imports a new layer krita doesn't switch active layer to the newly imported layer. user has to click on it again to activate it. Generally when people import a new layer they intend to move it or transform it or perform other operations on it. So it is ideal to have the newly imported layer to become automatically active.

STEPS TO REPRODUCE
1. Open krita from the nightly build and create a new document
2. Import a layer either via Layer > Import/Export > Import layer or drag and drop an image
3. Notice the new layer is not automatically selected and active
Comment 1 Raghavendra kamath 2022-12-11 04:23:50 UTC
This happens even to the newly added or created layer via the add button in the layer docker. Ideally Krita should switch to the newly created layer
Comment 2 sh_zam 2022-12-12 08:57:48 UTC
Okay, looks like this has to be fixed like deif_lou suggested in the MR. The newly created layer has to be activated and selected to keep things consistent.
Comment 3 Bug Janitor Service 2022-12-12 11:22:31 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/krita/-/merge_requests/1672
Comment 4 sh_zam 2022-12-14 12:00:46 UTC
Git commit dc824a4c0c73e726950354d8f8a55ac25ac23424 by Sharaf Zaman.
Committed on 14/12/2022 at 04:57.
Pushed by rempt into branch 'master'.

LayerBox: Fix the bug with layer not getting selected

When a new layer was created we wouldn't select it due to
selectionModel()->hasSelection() clause -- which assumed that if there
was a already a layer selected then the new layer would clear selection
when it shouldn't.

In addition to this, there was a bug caused by currentChanged calling
setData(). This resulted in dataChanged() being called by a signal which
in turn called setCurrentIndex again but this time since no selection
flags were persisted this would update the selection when it shouldn't.

Now, we add a signal blocker since we're just adding a UserRole and the
only calls that seem to rely on this signal are updateUI -- which gets
called anyways. So, it should be safe, I assume.

M  +2    -7    plugins/dockers/layerdocker/NodeView.cpp

https://invent.kde.org/graphics/krita/commit/dc824a4c0c73e726950354d8f8a55ac25ac23424
Comment 5 Halla Rempt 2022-12-14 12:01:03 UTC
*** Bug 463035 has been marked as a duplicate of this bug. ***