diff --git a/widget/form/chatform.cpp b/widget/form/chatform.cpp index 05a986048..d52fd9d53 100644 --- a/widget/form/chatform.cpp +++ b/widget/form/chatform.cpp @@ -443,8 +443,3 @@ 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 8fe92b2ce..9407f1c11 100644 --- a/widget/form/chatform.h +++ b/widget/form/chatform.h @@ -55,7 +55,6 @@ 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/form/genericchatform.cpp b/widget/form/genericchatform.cpp index dd3b793ed..7c44f9ba5 100644 --- a/widget/form/genericchatform.cpp +++ b/widget/form/genericchatform.cpp @@ -201,3 +201,8 @@ void GenericChatForm::onEmoteInsertRequested(QString str) msgEdit->setFocus(); // refocus so that we can continue typing } + +void GenericChatForm::focusInput() +{ + msgEdit->setFocus(); +} diff --git a/widget/form/genericchatform.h b/widget/form/genericchatform.h index d8b20281d..9c0e67763 100644 --- a/widget/form/genericchatform.h +++ b/widget/form/genericchatform.h @@ -51,6 +51,7 @@ signals: void sendMessage(int, QString); public slots: + void focusInput(); protected slots: void onChatContextMenuRequested(QPoint pos); diff --git a/widget/widget.cpp b/widget/widget.cpp index dbdc65af4..0f7147f0d 100644 --- a/widget/widget.cpp +++ b/widget/widget.cpp @@ -663,6 +663,7 @@ Group *Widget::createGroup(int groupId) connect(newgroup->widget, SIGNAL(chatroomWidgetClicked(GenericChatroomWidget*)), this, SLOT(onChatroomWidgetClicked(GenericChatroomWidget*))); connect(newgroup->widget, SIGNAL(removeGroup(int)), this, SLOT(removeGroup(int))); + connect(newgroup->widget, SIGNAL(chatroomWidgetClicked(GenericChatroomWidget*)), newgroup->chatForm, SLOT(focusInput())); connect(newgroup->chatForm, SIGNAL(sendMessage(int,QString)), core, SLOT(sendGroupMessage(int,QString))); return newgroup; }