diff options
author | Pekka Vuorela <pekka.ta.vuorela@nokia.com> | 2012-02-03 10:07:51 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-02-10 09:54:58 +0100 |
commit | e761f5b906c427433325debb9f08c4f2d0ba902d (patch) | |
tree | fa8fbc933b6ed9ea2cdbc918d4317c95992c26e7 /src/declarative | |
parent | 9634dc440269fc03f825a6d18b371d8e612ba9ec (diff) |
Use QInputMethod instead of deprecated QInputPanel
Similarly deprecate Qt.application.inputPanel and
introduce replacement Qt.inputMethod.
Change-Id: Ie4fd467f93f75023c86b0a2d038d858fe5001146
Reviewed-by: Joona Petrell <joona.t.petrell@nokia.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Reviewed-by: Sami Kananoja <sami.kananoja@nokia.com>
Diffstat (limited to 'src/declarative')
-rw-r--r-- | src/declarative/qml/qdeclarativeapplication.cpp | 6 | ||||
-rw-r--r-- | src/declarative/qml/qdeclarativeapplication_p.h | 2 | ||||
-rw-r--r-- | src/declarative/qml/qdeclarativeengine.cpp | 8 | ||||
-rw-r--r-- | src/declarative/qml/v8/qv8engine.cpp | 3 | ||||
-rw-r--r-- | src/declarative/qml/v8/qv8engine_p.h | 1 |
5 files changed, 15 insertions, 5 deletions
diff --git a/src/declarative/qml/qdeclarativeapplication.cpp b/src/declarative/qml/qdeclarativeapplication.cpp index d0cd524dca..6964c8fba7 100644 --- a/src/declarative/qml/qdeclarativeapplication.cpp +++ b/src/declarative/qml/qdeclarativeapplication.cpp @@ -42,7 +42,8 @@ #include "qdeclarativeapplication_p.h" #include <private/qobject_p.h> #include <QtGui/QGuiApplication> -#include <QtGui/QInputPanel> +#include <QtGui/QInputMethod> +#include <QtCore/QDebug> QT_BEGIN_NAMESPACE @@ -85,7 +86,8 @@ Qt::LayoutDirection QDeclarativeApplication::layoutDirection() const QObject *QDeclarativeApplication::inputPanel() const { - return qApp ? qApp->inputPanel() : 0; + qWarning() << "Qt.application.inputPanel is deprecated, use Qt.inputMethod instead"; + return qApp ? qApp->inputMethod() : 0; } bool QDeclarativeApplication::eventFilter(QObject *obj, QEvent *event) diff --git a/src/declarative/qml/qdeclarativeapplication_p.h b/src/declarative/qml/qdeclarativeapplication_p.h index c9139adb19..4a0ff52d3e 100644 --- a/src/declarative/qml/qdeclarativeapplication_p.h +++ b/src/declarative/qml/qdeclarativeapplication_p.h @@ -64,7 +64,7 @@ public: virtual ~QDeclarativeApplication(); bool active() const; Qt::LayoutDirection layoutDirection() const; - QObject *inputPanel() const; + QT_DEPRECATED QObject *inputPanel() const; protected: bool eventFilter(QObject *obj, QEvent *event); diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index 9118ef4f14..73385fed59 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -297,7 +297,7 @@ of their use. \o This read-only property allows access to application's QInputPanel object and all its properties and slots. See the QInputPanel documentation for - further details. + further details. Deprecated in favor of Qt.InputMethod \endtable The following example uses the \c application object to indicate @@ -305,6 +305,12 @@ of their use. \snippet doc/src/snippets/declarative/application.qml document + \qmlproperty object Qt::inputMethod + \since QtQuick 2.0 + + The \c inputMethod object allows access to application's QInputMethod object + and all its properties and slots. See the QInputMethod documentation for + further details. */ diff --git a/src/declarative/qml/v8/qv8engine.cpp b/src/declarative/qml/v8/qv8engine.cpp index 405e406c88..90137330b5 100644 --- a/src/declarative/qml/v8/qv8engine.cpp +++ b/src/declarative/qml/v8/qv8engine.cpp @@ -41,6 +41,8 @@ #include "qv8engine_p.h" +#include <QtGui/QGuiApplication> + #include "qv8contextwrapper_p.h" #include "qv8valuetypewrapper_p.h" #include "qv8sequencewrapper_p.h" @@ -575,6 +577,7 @@ void QV8Engine::initializeGlobal(v8::Handle<v8::Object> global) if (m_engine) { qt->Set(v8::String::New("application"), newQObject(new QDeclarativeApplication(m_engine))); + qt->Set(v8::String::New("inputMethod"), newQObject(qGuiApp->inputMethod(), CppOwnership)); qt->Set(v8::String::New("lighter"), V8FUNCTION(lighter, this)); qt->Set(v8::String::New("darker"), V8FUNCTION(darker, this)); qt->Set(v8::String::New("tint"), V8FUNCTION(tint, this)); diff --git a/src/declarative/qml/v8/qv8engine_p.h b/src/declarative/qml/v8/qv8engine_p.h index 7dcbba29d2..ca701090d8 100644 --- a/src/declarative/qml/v8/qv8engine_p.h +++ b/src/declarative/qml/v8/qv8engine_p.h @@ -253,7 +253,6 @@ public: QV8Engine(QJSEngine* qq,QJSEngine::ContextOwnership ownership = QJSEngine::CreateNewContext); virtual ~QV8Engine(); - // ### TODO get rid of it, do we really need CppOwnership? // This enum should be in sync with QDeclarativeEngine::ObjectOwnership enum ObjectOwnership { CppOwnership, JavaScriptOwnership }; |