summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gui/kernel/qguiapplication.cpp18
-rw-r--r--src/gui/kernel/qguiapplication.h2
2 files changed, 14 insertions, 6 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index 9ffc35a608..8cbf55de05 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -2166,12 +2166,20 @@ bool QGuiApplication::desktopSettingsAware()
return QGuiApplicationPrivate::obey_desktop_settings;
}
-QInputMethod *QGuiApplication::inputMethod() const
+/*!
+ returns the input method.
+
+ The input method returns properties about the state and position of
+ the virtual keyboard. It also provides information about the position of the
+ current focused input element.
+
+ \sa QInputPanel
+ */
+QInputMethod *QGuiApplication::inputMethod()
{
- Q_D(const QGuiApplication);
- if (!d->inputMethod)
- const_cast<QGuiApplicationPrivate *>(d)->inputMethod = new QInputMethod();
- return d->inputMethod;
+ if (!qGuiApp->d_func()->inputMethod)
+ qGuiApp->d_func()->inputMethod = new QInputMethod();
+ return qGuiApp->d_func()->inputMethod;
}
/*!
diff --git a/src/gui/kernel/qguiapplication.h b/src/gui/kernel/qguiapplication.h
index 75a0f6cd4b..2a1ea3d9de 100644
--- a/src/gui/kernel/qguiapplication.h
+++ b/src/gui/kernel/qguiapplication.h
@@ -131,7 +131,7 @@ public:
static bool desktopSettingsAware();
QT_DEPRECATED QInputPanel *inputPanel() const;
- QInputMethod *inputMethod() const;
+ static QInputMethod *inputMethod();
static QPlatformNativeInterface *platformNativeInterface();