summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gui/kernel/qinputmethod.cpp27
-rw-r--r--src/gui/kernel/qinputmethod.h3
-rw-r--r--src/gui/kernel/qinputmethod_p.h1
-rw-r--r--src/widgets/kernel/qwidget.cpp1
4 files changed, 32 insertions, 0 deletions
diff --git a/src/gui/kernel/qinputmethod.cpp b/src/gui/kernel/qinputmethod.cpp
index 436b0aed1e..438c169f71 100644
--- a/src/gui/kernel/qinputmethod.cpp
+++ b/src/gui/kernel/qinputmethod.cpp
@@ -99,6 +99,33 @@ void QInputMethod::setInputItemTransform(const QTransform &transform)
emit cursorRectangleChanged();
}
+
+/*!
+ \since 5.1
+
+ Returns the input item's geometry in input item coordinates.
+
+ \sa setInputItemRectangle()
+*/
+QRectF QInputMethod::inputItemRectangle() const
+{
+ Q_D(const QInputMethod);
+ return d->inputRectangle;
+}
+
+/*!
+ \since 5.1
+
+ Sets the input item's geometry to be \a rect, in input item coordinates.
+ This needs to be updated by the focused window like QQuickCanvas whenever
+ item is moved inside the scene, or focus is changed.
+*/
+void QInputMethod::setInputItemRectangle(const QRectF &rect)
+{
+ Q_D(QInputMethod);
+ d->inputRectangle = rect;
+}
+
/*!
\property QInputMethod::cursorRectangle
\brief Input item's cursor rectangle in window coordinates.
diff --git a/src/gui/kernel/qinputmethod.h b/src/gui/kernel/qinputmethod.h
index eceebb1c0f..fe6cc3f331 100644
--- a/src/gui/kernel/qinputmethod.h
+++ b/src/gui/kernel/qinputmethod.h
@@ -67,6 +67,9 @@ public:
QTransform inputItemTransform() const;
void setInputItemTransform(const QTransform &transform);
+ QRectF inputItemRectangle() const;
+ void setInputItemRectangle(const QRectF &rect);
+
// in window coordinates
QRectF cursorRectangle() const; // ### what if we have rotations for the item?
diff --git a/src/gui/kernel/qinputmethod_p.h b/src/gui/kernel/qinputmethod_p.h
index 6cfc5e2f88..79b1299722 100644
--- a/src/gui/kernel/qinputmethod_p.h
+++ b/src/gui/kernel/qinputmethod_p.h
@@ -84,6 +84,7 @@ public:
bool objectAcceptsInputMethod(QObject *object);
QTransform inputItemTransform;
+ QRectF inputRectangle;
QPlatformInputContext *testContext;
};
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index 823403c4a6..e5df25e972 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -354,6 +354,7 @@ void QWidgetPrivate::updateWidgetTransform()
QPoint p = q->mapTo(q->topLevelWidget(), QPoint(0,0));
t.translate(p.x(), p.y());
qApp->inputMethod()->setInputItemTransform(t);
+ qApp->inputMethod()->setInputItemRectangle(q->rect());
}
}