Browse Source

chatgui: preserve input focus on chat refresh (save/restore focusWidget in loadChannel)

topo_upd
Evgeny 3 months ago
parent
commit
0137a1bad4
  1. 7
      tools/chatgui/src/messagelist.cpp

7
tools/chatgui/src/messagelist.cpp

@ -12,6 +12,7 @@
#include <QPixmap>
#include <QDateTime>
#include <QFile>
#include <QApplication>
#include <QDebug>
#include <vector>
#include <memory>
@ -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() {

Loading…
Cancel
Save