from right to left.
\endlist
- \row
- \li \c application.inputPanel
- \li
- This read-only property allows access to application's QInputPanel object
- and all its properties and slots. See the QInputPanel documentation for
- further details. Deprecated in favor of Qt.InputMethod
- \endtable
-
The following example uses the \c application object to indicate
whether the application is currently active:
return d->direction;
}
-QObject *QQuickApplication::inputPanel() const
-{
- static bool warned = false;
- if (!warned) {
- qWarning() << "Qt.application.inputPanel is deprecated, use Qt.inputMethod instead";
- warned = true;
- }
- return qGuiApp->inputMethod();
-}
-
bool QQuickApplication::eventFilter(QObject *, QEvent *event)
{
Q_D(QQuickApplication);
Q_OBJECT
Q_PROPERTY(bool active READ active NOTIFY activeChanged)
Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection NOTIFY layoutDirectionChanged)
- Q_PROPERTY(QObject *inputPanel READ inputPanel CONSTANT)
public:
explicit QQuickApplication(QObject *parent = 0);
virtual ~QQuickApplication();
bool active() const;
Qt::LayoutDirection layoutDirection() const;
- QT_DEPRECATED QObject *inputPanel() const;
Q_SIGNALS:
void activeChanged();
void QQuickUtilModule::defineModule()
{
- qmlRegisterUncreatableType<QInputMethod>("QtQuick",2,0,"InputPanel",
- QInputMethod::tr("InputPanel is an abstract class")); // deprecated
qmlRegisterUncreatableType<QInputMethod>("QtQuick",2,0,"InputMethod",
QInputMethod::tr("InputMethod is an abstract class"));
qmlRegisterUncreatableType<QQuickAbstractAnimation>("QtQuick",2,0,"Animation",QQuickAbstractAnimation::tr("Animation is an abstract class"));
private slots:
void active();
void layoutDirection();
- void inputPanel();
void inputMethod();
private:
QCOMPARE(Qt::LayoutDirection(item->property("layoutDirection").toInt()), Qt::LeftToRight);
}
-void tst_qquickapplication::inputPanel()
-{
- const QLatin1String expected("Qt.application.inputPanel is deprecated, use Qt.inputMethod instead ");
- QTest::ignoreMessage(QtWarningMsg, expected.data());
-
- QQmlComponent component(&engine);
- component.setData("import QtQuick 2.0; Item { property variant inputPanel: Qt.application.inputPanel }", QUrl::fromLocalFile(""));
- QQuickItem *item = qobject_cast<QQuickItem *>(component.create());
- QVERIFY(item);
- QQuickView view;
- item->setParentItem(view.rootObject());
-
- // check that the inputPanel property maches with application's input panel
- QCOMPARE(qvariant_cast<QObject*>(item->property("inputPanel")), qApp->inputMethod());
-}
-
void tst_qquickapplication::inputMethod()
{
// technically not in QQuickApplication, but testing anyway here