summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vcl/inc/qt5/QtWidget.hxx3
-rw-r--r--vcl/qt5/QtFrame.cxx5
-rw-r--r--vcl/qt5/QtWidget.cxx18
3 files changed, 19 insertions, 7 deletions
diff --git a/vcl/inc/qt5/QtWidget.hxx b/vcl/inc/qt5/QtWidget.hxx
index 801cd290ff88..e2a22d3c9f18 100644
--- a/vcl/inc/qt5/QtWidget.hxx
+++ b/vcl/inc/qt5/QtWidget.hxx
@@ -19,6 +19,7 @@
#pragma once
+#include <QtCore/QRect>
#include <QtWidgets/QWidget>
#include <rtl/ustring.hxx>
@@ -36,6 +37,8 @@ class QtWidget : public QWidget
QtFrame& m_rFrame;
bool m_bNonEmptyIMPreeditSeen;
+ mutable bool m_bInInputMethodQueryCursorRectangle;
+ mutable QRect m_aImCursorRectangle;
int m_nDeltaX;
int m_nDeltaY;
diff --git a/vcl/qt5/QtFrame.cxx b/vcl/qt5/QtFrame.cxx
index 2e396fa8ce07..b8f649e64b78 100644
--- a/vcl/qt5/QtFrame.cxx
+++ b/vcl/qt5/QtFrame.cxx
@@ -799,8 +799,9 @@ void QtFrame::ToTop(SalFrameToTop nFlags)
pWidget->activateWindow();
else if ((nFlags & SalFrameToTop::GrabFocus) || (nFlags & SalFrameToTop::GrabFocusOnly))
{
- pWidget->activateWindow();
- pWidget->setFocus();
+ if (!(nFlags & SalFrameToTop::GrabFocusOnly))
+ pWidget->activateWindow();
+ pWidget->setFocus(Qt::OtherFocusReason);
}
}
diff --git a/vcl/qt5/QtWidget.cxx b/vcl/qt5/QtWidget.cxx
index 6362a1353d54..cd47492808cc 100644
--- a/vcl/qt5/QtWidget.cxx
+++ b/vcl/qt5/QtWidget.cxx
@@ -625,6 +625,7 @@ QtWidget::QtWidget(QtFrame& rFrame, Qt::WindowFlags f)
: QWidget(Q_NULLPTR, f)
, m_rFrame(rFrame)
, m_bNonEmptyIMPreeditSeen(false)
+ , m_bInInputMethodQueryCursorRectangle(false)
, m_nDeltaX(0)
, m_nDeltaY(0)
{
@@ -800,11 +801,18 @@ QVariant QtWidget::inputMethodQuery(Qt::InputMethodQuery property) const
}
case Qt::ImCursorRectangle:
{
- const qreal fRatio = m_rFrame.devicePixelRatioF();
- SalExtTextInputPosEvent aPosEvent;
- m_rFrame.CallCallback(SalEvent::ExtTextInputPos, &aPosEvent);
- return QVariant(QRect(aPosEvent.mnX / fRatio, aPosEvent.mnY / fRatio,
- aPosEvent.mnWidth / fRatio, aPosEvent.mnHeight / fRatio));
+ if (!m_bInInputMethodQueryCursorRectangle)
+ {
+ m_bInInputMethodQueryCursorRectangle = true;
+ SalExtTextInputPosEvent aPosEvent;
+ m_rFrame.CallCallback(SalEvent::ExtTextInputPos, &aPosEvent);
+ const qreal fRatio = m_rFrame.devicePixelRatioF();
+ m_aImCursorRectangle.setRect(aPosEvent.mnX / fRatio, aPosEvent.mnY / fRatio,
+ aPosEvent.mnWidth / fRatio,
+ aPosEvent.mnHeight / fRatio);
+ m_bInInputMethodQueryCursorRectangle = false;
+ }
+ return QVariant(m_aImCursorRectangle);
}
case Qt::ImAnchorPosition:
{