This repository was archived by the owner on Aug 31, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44#include " ChatWidget.hpp"
55
66#include < QApplication>
7+ #include < QMouseEvent>
78#include < QQmlContext>
89#include < QQmlEngine>
910#include < QQuickItem>
@@ -38,6 +39,8 @@ ChatWidget::ChatWidget(
3839 setResizeMode (QQuickWidget::SizeRootObjectToView);
3940 setFocusPolicy (Qt::StrongFocus);
4041
42+ setAttribute (Qt::WA_NoMousePropagation, true );
43+
4144 if (registerOwnContext) {
4245 auto ideContext = new Core::IContext{this };
4346 ideContext->setWidget (this );
@@ -53,6 +56,14 @@ void ChatWidget::focusInEvent(QFocusEvent *event)
5356 QMetaObject::invokeMethod (rootObject (), " focusInput" );
5457}
5558
59+ void ChatWidget::mousePressEvent (QMouseEvent *event)
60+ {
61+ if (!hasFocus ())
62+ setFocus (Qt::MouseFocusReason);
63+
64+ QQuickWidget::mousePressEvent (event);
65+ }
66+
5667void ChatWidget::clear ()
5768{
5869 QMetaObject::invokeMethod (rootObject (), " clearChat" );
Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ class ChatWidget : public QQuickWidget
4242
4343protected:
4444 void focusInEvent (QFocusEvent *event) override ;
45+ void mousePressEvent (QMouseEvent *event) override ;
4546};
4647
4748} // namespace QodeAssist::Chat
You can’t perform that action at this time.
0 commit comments