Bug 410312

Summary: Inconsistent navigation of blending modes with keyboard
Product: [Applications] krita Reporter: Karl Ove Hufthammer <karl>
Component: Layer StackAssignee: Dmitry Kazakov <dimula73>
Status: RESOLVED FIXED    
Severity: normal CC: dimula73, ghevan, halla
Priority: NOR    
Version: git master (please specify the git hash!)   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: Video showing the bug in action

Description Karl Ove Hufthammer 2019-07-28 14:07:56 UTC
SUMMARY
When I try to cycle through the blending modes of a layer using the up and down arrow keys, the ordering is inconsistent with the drop-down menu, and ends in an endless loop.


STEPS TO REPRODUCE
1. Open an image with at least two layers.
2. Select the top layer.
3. From the layer blending mode drop-down, select the top mode (‘Addition’).
4. Keep pressing the ‘Down Arrow’ key.


OBSERVED RESULT
The order the various blending modes are chosen does not correspond to the order in the drop down. And after a few presses, one ends up with an endless cycle (‘Normal’, ‘Overlay’, ‘Parallel’, ‘Penumbra A’, ‘Penumbra B’, ‘Penumbra C’, ‘Penumbra D’, ‘Normal’, …).



EXPECTED RESULT
Pressing the down/up arrow keys should cycle the blending modes in the same order as they are shown in the drop-down. There should be no endless cycle.


SOFTWARE/OS VERSIONS
Operating System: openSUSE Tumbleweed 20190724
KDE Plasma Version: 5.16.2
KDE Frameworks Version: 5.59.0
Qt Version: 5.13.0
Kernel Version: 5.2.1-1-default
OS Type: 64-bit


ADDITIONAL INFORMATION
The initial list of blending modes cycled depend on the initial blending mode selected. But the endless cycle at the end is always identical (and begins with the ‘Normal’ blending mode).
Comment 1 vanyossi 2019-07-28 17:00:40 UTC
Hi!

I tried reproducing following the instructions you posted but I could not, up and down scrolled trough content in order, however it was not limited to visible blending modes.

could you post a video to understan what is happening?
Comment 2 Karl Ove Hufthammer 2019-07-28 17:40:09 UTC
Created attachment 121800 [details]
Video showing the bug in action

Here’s a video showing how blending mode selection works when I press the down arrow key. Looking at the video, I noticed that right before cycling back to the ‘Normal’ mode, a different mode is selected, but just for a fraction of a second. Perhaps that’s a clue to what’s causing the bug?
Comment 3 Karl Ove Hufthammer 2019-07-28 17:43:01 UTC
(Removed NEEDSINFO status.)
Comment 4 vanyossi 2019-07-28 19:23:25 UTC
Im not sure we can do much here, the behaviour seems to have changed in our framework of choice. Now when the cursor gets to a "category title" entry it resets to "Normal"

This is not reproductible in macos as the blending combobox never keeps focus.
Comment 5 Halla Rempt 2019-07-29 09:58:39 UTC
I've seen this happen on Linux as well, it might be a regression in Qt's handling of itemviews, or it might be something we can work around.
Comment 6 Dmitry Kazakov 2020-08-18 13:51:38 UTC
I can reproduce the issue on Windows
Comment 7 Dmitry Kazakov 2020-08-18 21:14:48 UTC
Git commit 66068abb8878a21fa2a3f0db3ec105e4105c7123 by Dmitry Kazakov.
Committed on 18/08/2020 at 21:14.
Pushed by dkazakov into branch 'krita/4.3'.

Fix jumps in composite op combobox when using mouse wheel or keyboard

1) In KisCompositeOpComboBox::selectCompositeOp() we shouldn't reselect
   the same composite op all the time. Composite ops are not unique in
   the list (they are duplicated in favourite category), therefore
   such reselection may break the order.

2) keyPressEvent() and wheelEvent() should skip category items. Otherwise
   it would fallback to "Normal" blending mode.

3) KisSortedCategorizedListModel::indexOf() should search for the element
   in the order of the sorted model, not the original one. Obviously,
   we should first select from "Favourite" category.

M  +17   -2    libs/ui/kis_categorized_list_model.h
M  +152  -0    libs/ui/widgets/kis_cmb_composite.cc
M  +3    -0    libs/ui/widgets/kis_cmb_composite.h

https://invent.kde.org/graphics/krita/commit/66068abb8878a21fa2a3f0db3ec105e4105c7123
Comment 8 Dmitry Kazakov 2020-08-18 21:15:07 UTC
Git commit b053074393d9080dbb269d83c8df6dcb18e54a67 by Dmitry Kazakov.
Committed on 18/08/2020 at 21:14.
Pushed by dkazakov into branch 'master'.

Fix jumps in composite op combobox when using mouse wheel or keyboard

1) In KisCompositeOpComboBox::selectCompositeOp() we shouldn't reselect
   the same composite op all the time. Composite ops are not unique in
   the list (they are duplicated in favourite category), therefore
   such reselection may break the order.

2) keyPressEvent() and wheelEvent() should skip category items. Otherwise
   it would fallback to "Normal" blending mode.

3) KisSortedCategorizedListModel::indexOf() should search for the element
   in the order of the sorted model, not the original one. Obviously,
   we should first select from "Favourite" category.

M  +17   -2    libs/ui/kis_categorized_list_model.h
M  +152  -0    libs/ui/widgets/kis_cmb_composite.cc
M  +3    -0    libs/ui/widgets/kis_cmb_composite.h

https://invent.kde.org/graphics/krita/commit/b053074393d9080dbb269d83c8df6dcb18e54a67