From 9180797247ebad855bf9713dd5574f9eef5296f2 Mon Sep 17 00:00:00 2001 From: Jan Arve Saether Date: Wed, 27 Apr 2016 10:41:56 +0200 Subject: 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 --- src/gui/kernel/qinputmethod.cpp | 14 ++++++++++++++ src/gui/kernel/qinputmethod.h | 4 ++++ 2 files changed, 18 insertions(+) (limited to 'src/gui/kernel') diff --git a/src/gui/kernel/qinputmethod.cpp b/src/gui/kernel/qinputmethod.cpp index b81e166d3a..365b088840 100644 --- a/src/gui/kernel/qinputmethod.cpp +++ b/src/gui/kernel/qinputmethod.cpp @@ -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(); } /*! diff --git a/src/gui/kernel/qinputmethod.h b/src/gui/kernel/qinputmethod.h index 22e4677eaa..1a63d1314e 100644 --- a/src/gui/kernel/qinputmethod.h +++ b/src/gui/kernel/qinputmethod.h @@ -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(); -- cgit v1.2.3