Enablers for input methods on Android

Adding QInputMethod::inputItemRectangle()/setInputItemRectangle().

Known bugs: inputItemRectangle() not implemented for graphics view
items; inputItemTransform() implementation was already missing.

Change-Id: I72b1d43350e93858a2b374de3f2199500a96dc79
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
Reviewed-by: BogDan Vatra <bogdan@kde.org>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
This commit is contained in:
Paul Olav Tvete 2013-02-19 12:18:51 +01:00 committed by The Qt Project
parent 323ba46f72
commit c65ecc50ae
4 changed files with 32 additions and 0 deletions

View File

@ -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.

View File

@ -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?

View File

@ -84,6 +84,7 @@ public:
bool objectAcceptsInputMethod(QObject *object);
QTransform inputItemTransform;
QRectF inputRectangle;
QPlatformInputContext *testContext;
};

View File

@ -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());
}
}