diff options
| author | Akseli Lahtinen <[email protected]> | 2025-07-24 12:56:50 +0300 |
|---|---|---|
| committer | Méven Car <[email protected]> | 2025-07-24 09:56:50 +0000 |
| commit | 94e08f04f4524fc4993b921a1ae1dd8cc6f8725c (patch) | |
| tree | 93da9d0d962d1ad466800764dcda021b32355569 /src | |
| parent | 8fd0c421cf472b19e7da4eca9616945ec4adae5f (diff) | |
KItemListView: Don't allow starting role editing when animation is running
If user presses delete and then F2 in very quick succession, the
inline rename field will get stuck in place, due to the animation
moving the actual item in different place.
To avoid any confusion, disallow starting role editing while any
animations are running.
BUG: 497125
Diffstat (limited to 'src')
| -rw-r--r-- | src/kitemviews/kitemlistview.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/kitemviews/kitemlistview.cpp b/src/kitemviews/kitemlistview.cpp index 3ed4df3e7..75d85be35 100644 --- a/src/kitemviews/kitemlistview.cpp +++ b/src/kitemviews/kitemlistview.cpp @@ -750,7 +750,11 @@ QPixmap KItemListView::createDragPixmap(const KItemSet &indexes) const void KItemListView::editRole(int index, const QByteArray &role) { KStandardItemListWidget *widget = qobject_cast<KStandardItemListWidget *>(m_visibleItems.value(index)); - if (!widget || m_editingRole) { + if (!widget) { + return; + } + if (m_editingRole || m_animation->isStarted(widget)) { + Q_EMIT widget->roleEditingCanceled(index, role, QVariant()); return; } @@ -1916,6 +1920,9 @@ void KItemListView::doLayout(LayoutAnimationHint hint, int changedIndex, int cha if (animate) { if (m_animation->isStarted(widget, KItemListViewAnimation::MovingAnimation)) { + if (m_editingRole) { + Q_EMIT widget->roleEditingCanceled(widget->index(), QByteArray(), QVariant()); + } m_animation->start(widget, KItemListViewAnimation::MovingAnimation, newPos); applyNewPos = false; } |
