diff options
author | axis <qt-info@nokia.com> | 2009-04-20 14:06:27 (GMT) |
---|---|---|
committer | axis <qt-info@nokia.com> | 2009-05-04 13:24:40 (GMT) |
commit | ce4faedea2b652c1d7fc5430bbd906972a3c93bf (patch) | |
tree | 9259c7222ef5601f2c6145f13b2df133a7593ebb /src/gui/kernel | |
parent | 82840fcce074658bd39ad6425fd50022b9250dcf (diff) | |
download | Qt-ce4faedea2b652c1d7fc5430bbd906972a3c93bf.zip Qt-ce4faedea2b652c1d7fc5430bbd906972a3c93bf.tar.gz Qt-ce4faedea2b652c1d7fc5430bbd906972a3c93bf.tar.bz2 |
Added inputMethodHints API.
RevBy: denis
Diffstat (limited to 'src/gui/kernel')
-rw-r--r-- | src/gui/kernel/qwidget.cpp | 32 | ||||
-rw-r--r-- | src/gui/kernel/qwidget.h | 5 | ||||
-rw-r--r-- | src/gui/kernel/qwidget_p.h | 2 |
3 files changed, 38 insertions, 1 deletions
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 7eaebbb..64aeab5 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -199,6 +199,7 @@ QWidgetPrivate::QWidgetPrivate(int version) : ,needWindowChange(0) ,isGLWidget(0) #endif + ,imHints(Qt::ImhNone) ,polished(0) , size_policy(QSizePolicy::Preferred, QSizePolicy::Preferred) @@ -8457,7 +8458,7 @@ void QWidget::inputMethodEvent(QInputMethodEvent *event) \a query specifies which property is queried. - \sa inputMethodEvent(), QInputMethodEvent, QInputContext + \sa inputMethodEvent(), QInputMethodEvent, QInputContext, inputMethodHints */ QVariant QWidget::inputMethodQuery(Qt::InputMethodQuery query) const { @@ -8471,6 +8472,35 @@ QVariant QWidget::inputMethodQuery(Qt::InputMethodQuery query) const } } +/*! + \property QWidget::inputMethodHints + \brief What input method specific hints the widget has. + + This is only relevant for input widgets. It is used by + the input method to retrieve hints as to how the input method + should operate. For example, if the Qt::ImhNumbersOnly flag is + set, the input method may change its visual components to reflect + that only numbers can be entered. + + The effect may vary between input method implementations. + + \since 4.6 + + \sa inputMethodQuery(), QInputContext +*/ +Qt::InputMethodHints QWidget::inputMethodHints() const +{ + Q_D(const QWidget); + return d->imHints; +} + +void QWidget::setInputMethodHints(Qt::InputMethodHints hints) +{ + Q_D(QWidget); + d->imHints = hints; +} + + #ifndef QT_NO_DRAGANDDROP /*! diff --git a/src/gui/kernel/qwidget.h b/src/gui/kernel/qwidget.h index 8ecf758..b92794f 100644 --- a/src/gui/kernel/qwidget.h +++ b/src/gui/kernel/qwidget.h @@ -212,6 +212,7 @@ class Q_GUI_EXPORT QWidget : public QObject, public QPaintDevice #endif Q_PROPERTY(QLocale locale READ locale WRITE setLocale RESET unsetLocale) Q_PROPERTY(QString windowFilePath READ windowFilePath WRITE setWindowFilePath DESIGNABLE isWindow) + Q_PROPERTY(Qt::InputMethodHints inputMethodHints READ inputMethodHints WRITE setInputMethodHints) public: enum RenderFlag { @@ -673,6 +674,10 @@ protected: virtual void inputMethodEvent(QInputMethodEvent *); public: virtual QVariant inputMethodQuery(Qt::InputMethodQuery) const; + + Qt::InputMethodHints inputMethodHints() const; + void setInputMethodHints(Qt::InputMethodHints hints); + protected: void resetInputContext(); protected Q_SLOTS: diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index ec64b6e..2c68338 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -604,6 +604,8 @@ public: uint isGLWidget : 1; #endif + Qt::InputMethodHints imHints; + #if defined(Q_WS_X11) || defined (Q_WS_WIN) || defined(Q_WS_MAC) || defined(Q_WS_S60) #ifdef Q_WS_MAC void setWSGeometry(bool dontShow=false, const QRect &oldRect = QRect()); |