diff --git a/tools/chatgui/src/messagelist.cpp b/tools/chatgui/src/messagelist.cpp index abc2c3f5..4702fe7f 100644 --- a/tools/chatgui/src/messagelist.cpp +++ b/tools/chatgui/src/messagelist.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -165,6 +166,7 @@ MessageList::MessageList(DbManager* db, QWidget *parent) } void MessageList::loadChannel(const QString& channelId) { + QWidget* prevFocus = QApplication::focusWidget(); m_model->clear(); m_avatarCache.clear(); m_currentChannelId = channelId; @@ -197,7 +199,10 @@ void MessageList::loadChannel(const QString& channelId) { if (m_model->rowCount() > 0) m_view->scrollToBottom(); - m_inputBar->setFocus(); + if (prevFocus) + prevFocus->setFocus(); + else + m_inputBar->setFocus(); } void MessageList::refresh() {