Fixed QInputMethod API to use isVisible() instead of visible().

Deprecate the old API for now as not to break existing usages.

Change-Id: I7abbbbe8a34951282537a9d74cded03743f44df7
Reviewed-by: Pekka Vuorela <pekka.ta.vuorela@nokia.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
This commit is contained in:
Samuel Rødal 2012-03-19 14:05:41 +01:00 committed by Qt by Nokia
parent 7e90df7bf5
commit 787da35eb8
3 changed files with 14 additions and 10 deletions

View File

@ -215,7 +215,7 @@ void QInputMethod::hide()
\sa show(), hide()
*/
bool QInputMethod::visible() const
bool QInputMethod::isVisible() const
{
Q_D(const QInputMethod);
QPlatformInputContext *ic = d->platformInputContext();

View File

@ -62,7 +62,7 @@ class Q_GUI_EXPORT QInputMethod : public QObject
Q_PROPERTY(QObject *inputItem READ inputItem WRITE setInputItem NOTIFY inputItemChanged)
Q_PROPERTY(QRectF cursorRectangle READ cursorRectangle NOTIFY cursorRectangleChanged)
Q_PROPERTY(QRectF keyboardRectangle READ keyboardRectangle NOTIFY keyboardRectangleChanged)
Q_PROPERTY(bool visible READ visible NOTIFY visibleChanged)
Q_PROPERTY(bool visible READ isVisible NOTIFY visibleChanged)
Q_PROPERTY(bool animating READ isAnimating NOTIFY animatingChanged)
Q_PROPERTY(QLocale locale READ locale NOTIFY localeChanged)
Q_PROPERTY(Qt::LayoutDirection inputDirection READ inputDirection NOTIFY inputDirectionChanged)
@ -89,7 +89,11 @@ public:
ContextMenu
};
bool visible() const;
#if QT_DEPRECATED_SINCE(5,0)
QT_DEPRECATED bool visible() const { return isVisible(); }
#endif
bool isVisible() const;
void setVisible(bool visible);
bool isAnimating() const;

View File

@ -110,7 +110,7 @@ public:
virtual ~tst_qinputmethod() {}
private slots:
void initTestCase();
void visible();
void isVisible();
void animating();
void keyboarRectangle();
void inputItem();
@ -133,20 +133,20 @@ void tst_qinputmethod::initTestCase()
inputMethodPrivate->testContext = &m_platformInputContext;
}
void tst_qinputmethod::visible()
void tst_qinputmethod::isVisible()
{
QCOMPARE(qApp->inputMethod()->visible(), false);
QCOMPARE(qApp->inputMethod()->isVisible(), false);
qApp->inputMethod()->show();
QCOMPARE(qApp->inputMethod()->visible(), true);
QCOMPARE(qApp->inputMethod()->isVisible(), true);
qApp->inputMethod()->hide();
QCOMPARE(qApp->inputMethod()->visible(), false);
QCOMPARE(qApp->inputMethod()->isVisible(), false);
qApp->inputMethod()->setVisible(true);
QCOMPARE(qApp->inputMethod()->visible(), true);
QCOMPARE(qApp->inputMethod()->isVisible(), true);
qApp->inputMethod()->setVisible(false);
QCOMPARE(qApp->inputMethod()->visible(), false);
QCOMPARE(qApp->inputMethod()->isVisible(), false);
}
void tst_qinputmethod::animating()