From: Akseli Lahtinen Date: Thu, 24 Jul 2025 09:56:50 +0000 (+0300) Subject: KItemListView: Don't allow starting role editing when animation is running X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/94e08f04f4524fc4993b921a1ae1dd8cc6f8725c 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 --- 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(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; }