summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows/qwindowsinputcontext.cpp
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@theqtcompany.com>2016-04-05 14:22:45 +0200
committerLiang Qi <liang.qi@theqtcompany.com>2016-04-05 14:22:45 +0200
commitf2856875843efce9a00e90dad05bde358ab82197 (patch)
tree93346c38504ce04f0bf02dfe4a21299feb1be8ed /src/plugins/platforms/windows/qwindowsinputcontext.cpp
parenta7b04275082d065f392e7f18c54ea9b41507ae40 (diff)
parenta2970719c26c946fd6fea7d902aad6706a4ca6ea (diff)
Merge remote-tracking branch 'origin/5.7' into dev
Conflicts: examples/corelib/ipc/ipc.pro src/plugins/platforms/xcb/qxcbbackingstore.cpp tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp Change-Id: Ia006e10ff1732fe78f90138c41f05b59b49486cf
Diffstat (limited to 'src/plugins/platforms/windows/qwindowsinputcontext.cpp')
-rw-r--r--src/plugins/platforms/windows/qwindowsinputcontext.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/plugins/platforms/windows/qwindowsinputcontext.cpp b/src/plugins/platforms/windows/qwindowsinputcontext.cpp
index 1fa208031f..ddadbbea5d 100644
--- a/src/plugins/platforms/windows/qwindowsinputcontext.cpp
+++ b/src/plugins/platforms/windows/qwindowsinputcontext.cpp
@@ -54,6 +54,8 @@
#include <QtGui/QPalette>
#include <QtGui/QGuiApplication>
+#include <private/qhighdpiscaling_p.h>
+
#include <algorithm>
QT_BEGIN_NAMESPACE
@@ -165,7 +167,8 @@ Q_CORE_EXPORT QLocale qt_localeFromLCID(LCID id); // from qlocale_win.cpp
HIMC QWindowsInputContext::m_defaultContext = 0;
QWindowsInputContext::CompositionContext::CompositionContext() :
- hwnd(0), haveCaret(false), position(0), isComposing(false)
+ hwnd(0), haveCaret(false), position(0), isComposing(false),
+ factor(1)
{
}
@@ -270,9 +273,12 @@ void QWindowsInputContext::cursorRectChanged()
if (!m_compositionContext.hwnd)
return;
const QInputMethod *inputMethod = QGuiApplication::inputMethod();
- const QRect cursorRectangle = inputMethod->cursorRectangle().toRect();
- if (!cursorRectangle.isValid())
+ const QRectF cursorRectangleF = inputMethod->cursorRectangle();
+ if (!cursorRectangleF.isValid())
return;
+ const QRect cursorRectangle =
+ QRectF(cursorRectangleF.topLeft() * m_compositionContext.factor,
+ cursorRectangleF.size() * m_compositionContext.factor).toRect();
qCDebug(lcQpaInputMethods) << __FUNCTION__<< cursorRectangle;
@@ -390,7 +396,7 @@ bool QWindowsInputContext::startComposition(HWND hwnd)
qCDebug(lcQpaInputMethods) << __FUNCTION__ << fo << window << "language=" << m_languageId;
if (!fo || QWindowsWindow::handleOf(window) != hwnd)
return false;
- initContext(hwnd, fo);
+ initContext(hwnd, QHighDpiScaling::factor(window), fo);
startContextComposition();
return true;
}
@@ -522,12 +528,13 @@ bool QWindowsInputContext::endComposition(HWND hwnd)
return true;
}
-void QWindowsInputContext::initContext(HWND hwnd, QObject *focusObject)
+void QWindowsInputContext::initContext(HWND hwnd, qreal factor, QObject *focusObject)
{
if (m_compositionContext.hwnd)
doneContext();
m_compositionContext.hwnd = hwnd;
m_compositionContext.focusObject = focusObject;
+ m_compositionContext.factor = factor;
// Create a hidden caret which is kept at the microfocus
// position in update(). This is important for some
// Chinese input methods.