diff --git a/widget/form/chatform.cpp b/widget/form/chatform.cpp index d52fd9d53..05a986048 100644 --- a/widget/form/chatform.cpp +++ b/widget/form/chatform.cpp @@ -443,3 +443,8 @@ void ChatForm::onFileTansBtnClicked(QString widgetName, QString buttonName) else qDebug() << "no filetransferwidget: " << id; } + +void ChatForm::focusInput() +{ + msgEdit->setFocus(); +} diff --git a/widget/form/chatform.h b/widget/form/chatform.h index 9407f1c11..8fe92b2ce 100644 --- a/widget/form/chatform.h +++ b/widget/form/chatform.h @@ -55,6 +55,7 @@ public slots: void onAvPeerTimeout(int FriendId, int CallId); void onAvMediaChange(int FriendId, int CallId, bool video); void onMicMuteToggle(); + void focusInput(); private slots: void onSendTriggered(); diff --git a/widget/widget.cpp b/widget/widget.cpp index d08ea0fe1..dbdc65af4 100644 --- a/widget/widget.cpp +++ b/widget/widget.cpp @@ -411,6 +411,7 @@ void Widget::addFriend(int friendId, const QString &userId) connect(newfriend->widget, SIGNAL(chatroomWidgetClicked(GenericChatroomWidget*)), this, SLOT(onChatroomWidgetClicked(GenericChatroomWidget*))); connect(newfriend->widget, SIGNAL(removeFriend(int)), this, SLOT(removeFriend(int))); connect(newfriend->widget, SIGNAL(copyFriendIdToClipboard(int)), this, SLOT(copyFriendIdToClipboard(int))); + connect(newfriend->widget, SIGNAL(chatroomWidgetClicked(GenericChatroomWidget*)), newfriend->chatForm, SLOT(focusInput())); connect(newfriend->chatForm, SIGNAL(sendMessage(int,QString)), core, SLOT(sendMessage(int,QString))); connect(newfriend->chatForm, SIGNAL(sendFile(int32_t, QString, QString, long long)), core, SLOT(sendFile(int32_t, QString, QString, long long))); connect(newfriend->chatForm, SIGNAL(answerCall(int)), core, SLOT(answerCall(int)));