diff options
author | J-P Nurmi <jpnurmi@digia.com> | 2014-06-20 10:28:01 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@digia.com> | 2014-06-25 12:37:13 +0200 |
commit | b69d537d7ffe385d374388a0754dd03ba25684c8 (patch) | |
tree | f07866012d727eafc8e9bf640eaefce4d0099b37 /src | |
parent | 61c3ab99672a5dea10c1a10630b611a4a675c6da (diff) |
QGuiApplication::layoutDirectionChanged(Qt::LayoutDirection) [signal]
This allows QQuickApplication to listen to layout direction changes
without installing an expensive event filter on the application object.
Change-Id: I2d7d8906acecbc092657c4bd918bbdc9aad9744c
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/kernel/qguiapplication.cpp | 7 | ||||
-rw-r--r-- | src/gui/kernel/qguiapplication.h | 3 |
2 files changed, 8 insertions, 2 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 5bbd5e709c..29ab7daca0 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -3077,6 +3077,8 @@ void QGuiApplicationPrivate::saveState() On system start-up, the default layout direction depends on the application's language. + The notifier signal was introduced in Qt 5.4. + \sa QWidget::layoutDirection, isLeftToRight(), isRightToLeft() */ @@ -3087,7 +3089,10 @@ void QGuiApplication::setLayoutDirection(Qt::LayoutDirection direction) layout_direction = direction; - QGuiApplicationPrivate::self->notifyLayoutDirectionChange(); + if (qGuiApp) { + emit qGuiApp->layoutDirectionChanged(direction); + QGuiApplicationPrivate::self->notifyLayoutDirectionChange(); + } } Qt::LayoutDirection QGuiApplication::layoutDirection() diff --git a/src/gui/kernel/qguiapplication.h b/src/gui/kernel/qguiapplication.h index 50aefaadb5..560b2c827d 100644 --- a/src/gui/kernel/qguiapplication.h +++ b/src/gui/kernel/qguiapplication.h @@ -75,7 +75,7 @@ class Q_GUI_EXPORT QGuiApplication : public QCoreApplication Q_OBJECT Q_PROPERTY(QIcon windowIcon READ windowIcon WRITE setWindowIcon) Q_PROPERTY(QString applicationDisplayName READ applicationDisplayName WRITE setApplicationDisplayName) - Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection) + Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged) Q_PROPERTY(QString platformName READ platformName STORED false) Q_PROPERTY(bool quitOnLastWindowClosed READ quitOnLastWindowClosed WRITE setQuitOnLastWindowClosed) @@ -169,6 +169,7 @@ Q_SIGNALS: void focusObjectChanged(QObject *focusObject); void focusWindowChanged(QWindow *focusWindow); void applicationStateChanged(Qt::ApplicationState state); + void layoutDirectionChanged(Qt::LayoutDirection direction); #ifndef QT_NO_SESSIONMANAGER void commitDataRequest(QSessionManager &sessionManager); void saveStateRequest(QSessionManager &sessionManager); |