Renamed some of the methods in the QInputPanel

Change-Id: Ida03ef170e664f79708149c11a00772ee78a984b
Reviewed-on: http://codereview.qt-project.org/4399
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Vesa Rantanen <vesa.rantanen@nokia.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
This commit is contained in:
Lars Knoll 2011-09-07 18:17:24 +02:00
parent 4beac1add9
commit 842c44cb07
5 changed files with 32 additions and 31 deletions

View File

@ -86,10 +86,11 @@ void QInputPanel::setInputItemTranform(const QTransform &transform)
{ {
Q_D(QInputPanel); Q_D(QInputPanel);
d->inputItemTransform = transform; d->inputItemTransform = transform;
emit cursorRectChanged(); emit cursorRectangleChanged();
emit keyboardRectangleChanged();
} }
QRectF QInputPanel::cursorRect() const QRectF QInputPanel::cursorRectangle() const
{ {
QInputMethodQueryEvent query(Qt::ImMicroFocus); QInputMethodQueryEvent query(Qt::ImMicroFocus);
QGuiApplication::sendEvent(inputItem(), &query); QGuiApplication::sendEvent(inputItem(), &query);
@ -101,7 +102,7 @@ QRectF QInputPanel::cursorRect() const
return d->inputItemTransform.mapRect(r); return d->inputItemTransform.mapRect(r);
} }
QRectF QInputPanel::keyboardRect() QRectF QInputPanel::keyboardRectangle()
{ {
QPlatformInputContext *ic = QGuiApplicationPrivate::platformIntegration()->inputContext(); QPlatformInputContext *ic = QGuiApplicationPrivate::platformIntegration()->inputContext();
if (ic) if (ic)
@ -109,31 +110,31 @@ QRectF QInputPanel::keyboardRect()
return QRectF(); return QRectF();
} }
void QInputPanel::open() void QInputPanel::show()
{ {
setOpen(true); setVisible(true);
} }
void QInputPanel::close() void QInputPanel::hide()
{ {
setOpen(false); setVisible(false);
} }
bool QInputPanel::isOpen() const bool QInputPanel::visible() const
{ {
Q_D(const QInputPanel); Q_D(const QInputPanel);
return d->open; return d->visible;
} }
void QInputPanel::setOpen(bool open) void QInputPanel::setVisible(bool visible)
{ {
Q_D(QInputPanel); Q_D(QInputPanel);
if (d->open == open) if (d->visible == visible)
return; return;
d->open = open; d->visible = visible;
emit openChanged(); emit visibleChanged();
} }
bool QInputPanel::isAnimating() const bool QInputPanel::isAnimating() const
@ -152,7 +153,7 @@ void QInputPanel::update(Qt::InputMethodQueries queries)
ic->update(queries); ic->update(queries);
if (queries & Qt::ImMicroFocus) if (queries & Qt::ImMicroFocus)
emit cursorRectChanged(); emit cursorRectangleChanged();
} }
void QInputPanel::reset() void QInputPanel::reset()

View File

@ -60,9 +60,9 @@ class Q_GUI_EXPORT QInputPanel : public QObject
Q_OBJECT Q_OBJECT
Q_DECLARE_PRIVATE(QInputPanel) Q_DECLARE_PRIVATE(QInputPanel)
Q_PROPERTY(QObject *inputItem READ inputItem WRITE setInputItem NOTIFY inputItemChanged) Q_PROPERTY(QObject *inputItem READ inputItem WRITE setInputItem NOTIFY inputItemChanged)
Q_PROPERTY(QRectF cursorRect READ cursorRect NOTIFY cursorRectChanged) Q_PROPERTY(QRectF cursorRectangle READ cursorRectangle NOTIFY cursorRectangleChanged)
Q_PROPERTY(QRectF keyboardRect READ keyboardRect NOTIFY keyboardRectChanged) Q_PROPERTY(QRectF keyboardRectangle READ keyboardRectangle NOTIFY keyboardRectangleChanged)
Q_PROPERTY(bool open READ isOpen WRITE setOpen NOTIFY openChanged) Q_PROPERTY(bool visible READ visible WRITE setVisible NOTIFY visibleChanged)
Q_PROPERTY(bool animating READ isAnimating NOTIFY animatingChanged) Q_PROPERTY(bool animating READ isAnimating NOTIFY animatingChanged)
public: public:
@ -76,24 +76,24 @@ public:
void setInputItemTranform(const QTransform &transform); void setInputItemTranform(const QTransform &transform);
// in window coordinates // in window coordinates
QRectF cursorRect() const; // ### what if we have rotations for the item? QRectF cursorRectangle() const; // ### what if we have rotations for the item?
// keyboard geometry in window coords // keyboard geometry in window coords
QRectF keyboardRect(); QRectF keyboardRectangle();
enum Action { enum Action {
Click, Click,
ContextMenu ContextMenu
}; };
bool isOpen() const; bool visible() const;
void setOpen(bool open); void setVisible(bool visible);
bool isAnimating() const; bool isAnimating() const;
public Q_SLOTS: public Q_SLOTS:
void open(); void show();
void close(); void hide();
void update(Qt::InputMethodQueries queries); void update(Qt::InputMethodQueries queries);
void reset(); void reset();
@ -102,9 +102,9 @@ public Q_SLOTS:
Q_SIGNALS: Q_SIGNALS:
void inputItemChanged(); void inputItemChanged();
void cursorRectChanged(); void cursorRectangleChanged();
void keyboardRectChanged(); void keyboardRectangleChanged();
void openChanged(); void visibleChanged();
void animatingChanged(); void animatingChanged();
private: private:

View File

@ -54,11 +54,11 @@ class QInputPanelPrivate : public QObjectPrivate
{ {
public: public:
inline QInputPanelPrivate() inline QInputPanelPrivate()
: open(false) : visible(false)
{} {}
QTransform inputItemTransform; QTransform inputItemTransform;
QWeakPointer<QObject> inputItem; QWeakPointer<QObject> inputItem;
bool open; bool visible;
}; };
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -75,7 +75,7 @@ QRectF QPlatformInputContext::keyboardRect() const
void QPlatformInputContext::emitKeyboardRectChanged() const void QPlatformInputContext::emitKeyboardRectChanged() const
{ {
emit qApp->inputPanel()->keyboardRectChanged(); emit qApp->inputPanel()->keyboardRectangleChanged();
} }
bool QPlatformInputContext::isAnimating() bool QPlatformInputContext::isAnimating()

View File

@ -4110,10 +4110,10 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
break; break;
} }
case QEvent::RequestSoftwareInputPanel: case QEvent::RequestSoftwareInputPanel:
inputPanel()->open(); inputPanel()->show();
break; break;
case QEvent::CloseSoftwareInputPanel: case QEvent::CloseSoftwareInputPanel:
inputPanel()->close(); inputPanel()->hide();
break; break;
#ifndef QT_NO_GESTURES #ifndef QT_NO_GESTURES