summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authoraxis <qt-info@nokia.com>2009-04-20 14:06:27 (GMT)
committeraxis <qt-info@nokia.com>2009-05-04 13:24:40 (GMT)
commitce4faedea2b652c1d7fc5430bbd906972a3c93bf (patch)
tree9259c7222ef5601f2c6145f13b2df133a7593ebb /src
parent82840fcce074658bd39ad6425fd50022b9250dcf (diff)
downloadQt-ce4faedea2b652c1d7fc5430bbd906972a3c93bf.zip
Qt-ce4faedea2b652c1d7fc5430bbd906972a3c93bf.tar.gz
Qt-ce4faedea2b652c1d7fc5430bbd906972a3c93bf.tar.bz2
Added inputMethodHints API.
RevBy: denis
Diffstat (limited to 'src')
-rw-r--r--src/corelib/global/qnamespace.h16
-rw-r--r--src/gui/kernel/qwidget.cpp32
-rw-r--r--src/gui/kernel/qwidget.h5
-rw-r--r--src/gui/kernel/qwidget_p.h2
4 files changed, 54 insertions, 1 deletions
diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h
index 7d8b321..1475b2e 100644
--- a/src/corelib/global/qnamespace.h
+++ b/src/corelib/global/qnamespace.h
@@ -1398,6 +1398,21 @@ public:
ImMaximumTextLength
};
+ enum InputMethodHint {
+ ImhNone = 0x0,
+ ImhHiddenText = 0x1,
+ ImhNumbersOnly = 0x2,
+ ImhUppercaseOnly = 0x4,
+ ImhLowercaseOnly = 0x8,
+ ImhNoAutoUppercase = 0x10,
+ ImhPreferNumbers = 0x20,
+ ImhPreferUppercase = 0x40,
+ ImhPreferLowercase = 0x80,
+ ImhNoPredictiveText = 0x100,
+ ImhDialableCharactersOnly = 0x200
+ };
+ Q_DECLARE_FLAGS(InputMethodHints, InputMethodHint)
+
enum ToolButtonStyle {
ToolButtonIconOnly,
ToolButtonTextOnly,
@@ -1559,6 +1574,7 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::DropActions)
Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::ItemFlags)
Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::MatchFlags)
Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::TextInteractionFlags)
+Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::InputMethodHints)
typedef bool (*qInternalCallback)(void **);
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());