Bug 514427 - Krita 5.3.0 : Adding a new layer with a shortcut that contains "Shift" leaves the old layer selected
Summary: Krita 5.3.0 : Adding a new layer with a shortcut that contains "Shift" leaves...
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Layer Stack (other bugs)
Version First Reported In: nightly build (please specify the git hash!)
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords: triaged
Depends on:
Blocks:
 
Reported: 2026-01-10 22:44 UTC by bugs.kde.org.attic708
Modified: 2026-01-28 09:11 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description bugs.kde.org.attic708 2026-01-10 22:44:03 UTC
Hi, this is my first bug report. Thank you for making krita an excellent software :)

SUMMARY
In the latest nightly appimage, krita 5.3.0 3f968be4ab, adding a new layer via a shortcut that contains "Shift" (ex. adding a new vector layer with the default shortcut "Shift+Insert") leaves the old layer selected. Both the old and the newly created layer are selected.

I also have a custom shortcut "Shift+Up" for adding a paint layer, and the same thing happens too.

This is bothersome because subsequent actions (ex. group layers, move layers up/down, toggle alpha lock) apply to both selected layers, and requires systematically deselecting the old layer in order to exclude it from the action.

Executing the equivalent action via the menu (Layer > New > Add vector layer) or using the "+" button in the layer docker does not produce the bug.

STEPS TO REPRODUCE
1. Open a krita document with one layer
2. Select the layer in the layer docker
3. Add a new vector layer with the shortcut "Shift+Insert"

OBSERVED RESULT
Both the old and new layer are selected.

EXPECTED RESULT
Only the new layer is selected.

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
(available in the Info Center app, or by running `kinfo` in a terminal window)
Linux/KDE Plasma: 
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
I tried to reproduce in a few nightly appimages I had laying around :
- 2b41674864 (2025-12-17) : no bug
- f15d826435 (2025-12-20) : no bug
- 74b40eb94f (2025-12-23) : no bug
- ff1d70541d (2025-12-29) : bugged

I'm fairly sure it's caused by the following commit from December 25. A few days ago, I reverted it locally and no longer had the problem, although it's harder to revert today because there are some git conflicts :
- https://invent.kde.org/graphics/krita/-/commit/d3eaaf15976380a5df6370dfa9ccd7f5b281f34f
Comment 1 dra.w.p.il.e+bugskde 2026-01-11 02:24:39 UTC
Thanks for the thorough report! I can confirm the issue and also that reverting d3eaaf15976380a5df6370dfa9ccd7f5b281f34f fixes it. Specifically, it's the second part of that selectionCommand function, where it clears the selection if modifiers are held.
Comment 2 dra.w.p.il.e+bugskde 2026-01-14 07:00:43 UTC
When fixing this, also verify that the fix fixes Bug 514563. It's very similar and outright reverting the commit fixes it, but a more elaborate fix should be checked against both.
Comment 3 Bug Janitor Service 2026-01-15 15:47:14 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/krita/-/merge_requests/2601
Comment 4 Dmitry Kazakov 2026-01-28 09:11:19 UTC
Git commit 071d8bdd5ec0eba01b3297d646300a420c59570d by Dmitry Kazakov, on behalf of Luna Lovecraft.
Committed on 28/01/2026 at 09:11.
Pushed by dkazakov into branch 'master'.

Layer selection fixes

This fixes layer selection on qt5 (as i forgot to test my
previous patch on qt5), fixes an issue where layer selection
was behaving different from how it does in stable, and 
properly fixes shift selection on qt6
Related: bug 514563

Test Plan
---------

1. Build with qt5
2. Create a bunch of layers
3. Ctrl click an unselected layer
4. Layer gets selected/unselected properly


1. Build with qt6
2. Create a bunch of layers
3. Shift click to select multiple layers
4. Layers get selected properly

M  +18   -0    plugins/dockers/layerdocker/NodeDelegate.cpp
M  +48   -9    plugins/dockers/layerdocker/NodeView.cpp

https://invent.kde.org/graphics/krita/-/commit/071d8bdd5ec0eba01b3297d646300a420c59570d