chatgui: preserve input focus on chat refresh (save/restore focusWidget in loadChannel)
This commit is contained in:
1 parent
6887c47ddd
commit
3f01dd59b2
1 file changed
+6
-1
@@ -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() {
|
||||
|
||||
Reference in new issue
Block a user