QT_BEGIN_NAMESPACE
-class QQuickApplicationPrivate : public QQmlApplicationPrivate
-{
- Q_DECLARE_PUBLIC(QQuickApplication)
-public:
- QQuickApplicationPrivate()
- : direction(QGuiApplication::layoutDirection())
- {
- }
-
-private:
- Qt::LayoutDirection direction;
-};
-
/*
This object and its properties are documented as part of the Qt object,
in qqmlengine.cpp
*/
QQuickApplication::QQuickApplication(QObject *parent)
- : QQmlApplication(*new QQuickApplicationPrivate(), parent)
+ : QQmlApplication(parent)
{
if (qApp) {
- qApp->installEventFilter(this);
-
+ connect(qApp, SIGNAL(layoutDirectionChanged(Qt::LayoutDirection)),
+ this, SIGNAL(layoutDirectionChanged()));
connect(qApp, SIGNAL(applicationStateChanged(Qt::ApplicationState)),
this, SIGNAL(stateChanged(Qt::ApplicationState)));
connect(qApp, SIGNAL(applicationStateChanged(Qt::ApplicationState)),
Qt::LayoutDirection QQuickApplication::layoutDirection() const
{
- Q_D(const QQuickApplication);
- return d->direction;
+ return QGuiApplication::layoutDirection();
}
bool QQuickApplication::supportsMultipleWindows() const
return QGuiApplication::applicationState();
}
-bool QQuickApplication::eventFilter(QObject *, QEvent *event)
-{
- Q_D(QQuickApplication);
- if (event->type() == QEvent::ApplicationLayoutDirectionChange) {
- Qt::LayoutDirection newDirection = QGuiApplication::layoutDirection();
- if (d->direction != newDirection) {
- d->direction = newDirection;
- emit layoutDirectionChanged();
- }
- }
- return false;
-}
-
QT_END_NAMESPACE
QT_BEGIN_NAMESPACE
-class QQuickApplicationPrivate;
class Q_AUTOTEST_EXPORT QQuickApplication : public QQmlApplication
{
Q_OBJECT
void stateChanged(Qt::ApplicationState state);
private:
- bool eventFilter(QObject *, QEvent *event);
-
Q_DISABLE_COPY(QQuickApplication)
- Q_DECLARE_PRIVATE(QQuickApplication)
};
QT_END_NAMESPACE