@democrite
It is a race between two different things trying to set focus. The CodeView with a strong focus setting, and BookBrowser trying to set the focus on just the renamed file. Sometimes one wins other times the other wins.
Making the following simple change in BookBrowser.cpp to try to track this down actually slowed it down enough so that it lost the race (always came in second) and therefore won the war as it was the last focus set.
Please give this a try on your own build and let me know if this is what you have been asking for above.
Does it do the trick? If so, I can try to set a timer to add a delay to this routine to guarantee it always loses the race and sets Focus in BookBrowser after a single rename.
Just let me know.
Code:
diff --git a/src/MainUI/BookBrowser.cpp b/src/MainUI/BookBrowser.cpp
index a461a4f0..d45e2d6a 100644
--- a/src/MainUI/BookBrowser.cpp
+++ b/src/MainUI/BookBrowser.cpp
@@ -183,6 +183,7 @@ void BookBrowser::SelectResources(QList<Resource *> resources)
void BookBrowser::SelectRenamedResource()
{
+ qDebug() << "In SelectRenamedResource";
if (m_RenamedResource == NULL) {
return;
}
@@ -190,6 +191,7 @@ void BookBrowser::SelectRenamedResource()
// Set the selection to the resource that was being renamed
UpdateSelection(m_RenamedResource);
// Make sure Book Browser has focus so keyboard navigation works as expected
+ qDebug() << "setting focus";
qobject_cast<QWidget *>(m_TreeView)->setFocus();
m_RenamedResource = NULL;
}