https://bugs.kde.org/show_bug.cgi?id=508684

cwo <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|6.5.0                       |6.6.0
  Fixed/Implemented|                            |
                 In|                            |
      Latest Commit|                            |https://invent.kde.org/plas
                   |                            |ma/plasma-desktop/-/commit/
                   |                            |3f7b65e1411ab16b111af59b801
                   |                            |41593581a1d0c
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #35 from cwo <[email protected]> ---
Git commit 3f7b65e1411ab16b111af59b80141593581a1d0c by Christoph Wolk.
Committed on 01/01/2026 at 23:35.
Pushed by cwo into branch 'master'.

containments/desktop: constrain delegate size by cell size

Both the FolderView (parent of the GridView) and the GridView's delegate
fight over when icons are hovered. One reason for this is to limit the
area that is activating on hover to the actual area covered by the
delegate, which may be smaller as the GridView has to handle the case of
the delegate having one row of text or two (or even more if the user
changed the maximum setting. (Other apps are split about how to handle
this; kickoff's grid will activate hover anywhere in the cellSize area,
but Dolphin behaves like FolderView here).

The problem is that three different ways of calculating the delegate
size interact: The delegate itself uses its contentSize which is based
on the actual sizes, the GridView internals use the cellSize, and the
FolderView's logic for determining hover first uses the cellSize (via
the GridView internals) to figure out which item is being hovered, then
the actual size to figure out if it's really hovered. More specifically,
the delegate checks this on containsMouseChanged, and the FolderView
checks on positionChanged.

This can only work if the delegate size is never larger than the
cellSize - otherwise you can end up in the situation where the delegate
thinks it's hovered, the FolderView disagrees (because the first part,
mapping the item from its position through the GridView, fails, even if
were it to find the correct item, the check for the actual sizes might
succeed). If that happens, the delegate won't consider itself hovered
again if the user moves the pointer out of the the dead zone fully over
the item, as its containsMouse hasn't changed, and the pointer is over
the item but the item is not hovered. But the cellSize is an
approximation of the actual size using gridUnits for text height, and
this approximation is slightly short on multi-line text, causing a dead
zone of about three pixels or so.

There's several ways to fix this:

- ideally, we don't have different components fight over when the
  delegates are hovered in the first place. But as everything in
  FolderView depends on everything else (as evidenced by the fact that
  we have several components fighting over what is hovered), this might
  involve a long and complicated refactoring of the whole code
- still somewhat ideally, we use a better approximation for cellSize.
  But this likely still wouldn't be perfect and might still cause issues
  if even the better approximation is wrong. (And there's a bunch of
  extra logic in there, so everything is not quite straightforward to
  understand, and fully relying on this seems error-prone).
- less ideally, but probably necessary: we don't allow the delegate to
  ever be larger than the cellSize. Doing that can only cause problems,
  and the GridView will position items in the next row based on cellSize
  anyway, so if it's off by more than a few pixels, it'll cover other
  delegates. (It might still do that anyway with the limited delgate
  size if the delegate overflows, but there still wouldn't be any
  benefit to having the delegate be larger, it at best doesn't make
  things actively worse by itself)

This change implements the third option; the second and first can be
looked into in the future.
FIXED-IN: 6.6.0

M  +1    -1    containments/desktop/package/contents/ui/FolderView.qml

https://invent.kde.org/plasma/plasma-desktop/-/commit/3f7b65e1411ab16b111af59b80141593581a1d0c

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to