diff --git a/include/TextInputWidget.h b/include/TextInputWidget.h index 225750f23d245ca850cd14c7b1d913b169b80405..7fae4ae04014d503e9877dde5572c7ff283aea65 100644 --- a/include/TextInputWidget.h +++ b/include/TextInputWidget.h @@ -46,6 +46,7 @@ public: public slots: void onSendButtonClicked(); + inline void focusLineEdit(); private slots: void addSelectedEmoji(const QString &emoji); @@ -64,3 +65,8 @@ private: FlatButton *send_message_button_; EmojiPickButton *emoji_button_; }; + +inline void TextInputWidget::focusLineEdit() +{ + input_->setFocus(); +} diff --git a/src/ChatPage.cc b/src/ChatPage.cc index 9f20d54fb20f2f86c9a9cdf32c53de07d0943830..43b1f0d37052a4c632f9a76fd6f102da5f62ff85 100644 --- a/src/ChatPage.cc +++ b/src/ChatPage.cc @@ -125,6 +125,7 @@ ChatPage::ChatPage(QSharedPointer<MatrixClient> client, QWidget *parent) connect(client_.data(), SIGNAL(loggedOut()), this, SLOT(logout())); connect(room_list_, &RoomList::roomChanged, this, &ChatPage::changeTopRoomInfo); + connect(room_list_, &RoomList::roomChanged, text_input_, &TextInputWidget::focusLineEdit); connect(room_list_, &RoomList::roomChanged, view_manager_, &TimelineViewManager::setHistoryView); connect(view_manager_, &TimelineViewManager::unreadMessages, this, [=](const QString &roomid, int count) {