Add QInputMethod::inputItemClipRectangle()

This property allows a convenient way of getting notified about changes in
the input item clipped rectangle, similar to QIM::cursorRectangle().

Change-Id: I26bf97eeb1f5ef1b7d3aafb03565023091d6df3d
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@theqtcompany.com>
This commit is contained in:
Jan Arve Saether 2016-04-27 10:41:56 +02:00 committed by Jan Arve Sæther
parent eb63c0fa47
commit 9180797247
2 changed files with 18 additions and 0 deletions

View File

@ -182,6 +182,18 @@ QRectF QInputMethod::keyboardRectangle() const
return QRectF();
}
/*!
\property QInputMethod::inputItemClipRectangle
\brief Input item's clipped rectangle in window coordinates.
The clipped input rectangle is often used by various input methods to determine
how much screen real estate is available for the input method (e.g. Virtual Keyboard).
*/
QRectF QInputMethod::inputItemClipRectangle() const
{
Q_D(const QInputMethod);
return inputMethodQueryRectangle_helper(Qt::ImInputItemClipRectangle, d->inputItemTransform);
}
/*!
Requests virtual keyboard to open. If the platform
doesn't provide virtual keyboard the visibility
@ -320,6 +332,8 @@ void QInputMethod::update(Qt::InputMethodQueries queries)
if (queries & (Qt::ImAnchorRectangle))
emit anchorRectangleChanged();
if (queries & (Qt::ImInputItemClipRectangle))
emit inputItemClipRectangleChanged();
}
/*!

View File

@ -57,6 +57,7 @@ class Q_GUI_EXPORT QInputMethod : public QObject
Q_PROPERTY(QRectF cursorRectangle READ cursorRectangle NOTIFY cursorRectangleChanged)
Q_PROPERTY(QRectF anchorRectangle READ anchorRectangle NOTIFY anchorRectangleChanged)
Q_PROPERTY(QRectF keyboardRectangle READ keyboardRectangle NOTIFY keyboardRectangleChanged)
Q_PROPERTY(QRectF inputItemClipRectangle READ inputItemClipRectangle NOTIFY inputItemClipRectangleChanged)
Q_PROPERTY(bool visible READ isVisible NOTIFY visibleChanged)
Q_PROPERTY(bool animating READ isAnimating NOTIFY animatingChanged)
Q_PROPERTY(QLocale locale READ locale NOTIFY localeChanged)
@ -76,6 +77,8 @@ public:
// keyboard geometry in window coords
QRectF keyboardRectangle() const;
QRectF inputItemClipRectangle() const;
enum Action {
Click,
ContextMenu
@ -106,6 +109,7 @@ Q_SIGNALS:
void cursorRectangleChanged();
void anchorRectangleChanged();
void keyboardRectangleChanged();
void inputItemClipRectangleChanged();
void visibleChanged();
void animatingChanged();
void localeChanged();