┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/kitemviews/private
diff options
context:
space:
mode:
authorPan Zhang <[email protected]>2026-03-23 10:12:10 +0800
committerMéven Car <[email protected]>2026-03-23 09:53:40 +0000
commit5e35194b00d84db6aea3370ee8bb0ad560428c62 (patch)
tree82c69960f6848e71e9d0cc2db5d89268228303d3 /src/kitemviews/private
parent4ee6e31fba45e3c0b052f382ce704192853fae1b (diff)
kitemviews: Preserve inline rename when item scrolls out of view
Inline rename was canceled when the edited item scrolled out of view. Scrolling could both finish the edit and recycle the item widget, causing the typed name to be lost. Keep the inline rename editor alive while the item is temporarily offscreen. Update the editor geometry on scroll, avoid recycling the widget while it is being edited, and suppress the temporary FocusOut triggered by hiding the editor. If the user interacts with another item while the edited one is offscreen, finish the hidden edit first so normal selection behavior is preserved. BUG: 506884
Diffstat (limited to 'src/kitemviews/private')
-rw-r--r--src/kitemviews/private/kitemlistroleeditor.cpp5
-rw-r--r--src/kitemviews/private/kitemlistroleeditor.h1
2 files changed, 6 insertions, 0 deletions
diff --git a/src/kitemviews/private/kitemlistroleeditor.cpp b/src/kitemviews/private/kitemlistroleeditor.cpp
index 6105d604f..9cb44a829 100644
--- a/src/kitemviews/private/kitemlistroleeditor.cpp
+++ b/src/kitemviews/private/kitemlistroleeditor.cpp
@@ -64,6 +64,11 @@ bool KItemListRoleEditor::event(QEvent *event)
return KTextEdit::event(event);
}
+void KItemListRoleEditor::setFinishedSignalBlocked(bool blocked)
+{
+ m_blockFinishedSignal = blocked;
+}
+
void KItemListRoleEditor::keyPressEvent(QKeyEvent *event)
{
switch (event->key()) {
diff --git a/src/kitemviews/private/kitemlistroleeditor.h b/src/kitemviews/private/kitemlistroleeditor.h
index eb8a9cb5e..3956380cd 100644
--- a/src/kitemviews/private/kitemlistroleeditor.h
+++ b/src/kitemviews/private/kitemlistroleeditor.h
@@ -45,6 +45,7 @@ public:
QByteArray role() const;
void setAllowUpDownKeyChainEdit(bool allowChainEdit);
+ void setFinishedSignalBlocked(bool blocked);
bool eventFilter(QObject *watched, QEvent *event) override;
Q_SIGNALS: