ubuntu-sdk-team team mailing list archive
-
ubuntu-sdk-team team
-
Mailing list archive
-
Message #00913
[Merge] lp:~ubuntu-sdk-team/ubuntu-ui-toolkit/realLayoutDirectionChange into lp:ubuntu-ui-toolkit/staging
Christian Dywan has proposed merging lp:~ubuntu-sdk-team/ubuntu-ui-toolkit/realLayoutDirectionChange into lp:ubuntu-ui-toolkit/staging.
Commit message:
Change layoutDirection from gallery (via UCApplication)
Requested reviews:
Ubuntu SDK team (ubuntu-sdk-team)
Related bugs:
Bug #1666869 in ubuntu-ui-toolkit (Ubuntu): "Toolkit gallery doesn't change QGuiApplication::layoutDirection"
https://bugs.launchpad.net/ubuntu/+source/ubuntu-ui-toolkit/+bug/1666869
For more details, see:
https://code.launchpad.net/~ubuntu-sdk-team/ubuntu-ui-toolkit/realLayoutDirectionChange/+merge/318359
--
Your team Ubuntu SDK team is requested to review the proposed merge of lp:~ubuntu-sdk-team/ubuntu-ui-toolkit/realLayoutDirectionChange into lp:ubuntu-ui-toolkit/staging.
=== modified file 'examples/ubuntu-ui-toolkit-gallery/MainPage.qml'
--- examples/ubuntu-ui-toolkit-gallery/MainPage.qml 2016-06-17 13:42:23 +0000
+++ examples/ubuntu-ui-toolkit-gallery/MainPage.qml 2017-02-27 14:06:54 +0000
@@ -30,14 +30,14 @@
Action {
text: i18n.tr('Right to Left')
iconName: 'flash-on'
- visible: !gallery.rtl
- onTriggered: gallery.rtl = !gallery.rtl
+ visible: UbuntuApplication.layoutDirection == Qt.LeftToRight
+ onTriggered: UbuntuApplication.layoutDirection = Qt.RightToLeft
},
Action {
text: i18n.tr('Left to Right')
iconName: 'flash-off'
- visible: gallery.rtl
- onTriggered: gallery.rtl = !gallery.rtl
+ visible: UbuntuApplication.layoutDirection == Qt.RightToLeft
+ onTriggered: UbuntuApplication.layoutDirection = Qt.LeftToRight
},
Action {
text: i18n.tr('Use dark theme')
=== modified file 'examples/ubuntu-ui-toolkit-gallery/ubuntu-ui-toolkit-gallery.qml'
--- examples/ubuntu-ui-toolkit-gallery/ubuntu-ui-toolkit-gallery.qml 2016-01-18 12:50:44 +0000
+++ examples/ubuntu-ui-toolkit-gallery/ubuntu-ui-toolkit-gallery.qml 2017-02-27 14:06:54 +0000
@@ -29,9 +29,8 @@
width: units.gu(120)
height: units.gu(75)
- LayoutMirroring.enabled: rtl
+ LayoutMirroring.enabled: Qt.application.layoutDirection == Qt.RightToLeft
LayoutMirroring.childrenInherit: true
- property bool rtl: Qt.application.layoutDirection == Qt.RightToLeft
AdaptivePageLayout {
id: layout
=== modified file 'src/UbuntuToolkit/ucapplication.cpp'
--- src/UbuntuToolkit/ucapplication.cpp 2017-02-09 11:00:07 +0000
+++ src/UbuntuToolkit/ucapplication.cpp 2017-02-27 14:06:54 +0000
@@ -42,6 +42,10 @@
// Make sure we receive application name changes from C++ modules
connect(QCoreApplication::instance(), &QCoreApplication::applicationNameChanged,
this, &UCApplication::applicationNameChanged);
+ // Changes to the default layout direction (RTL, LTR)
+ QGuiApplication* application = qobject_cast<QGuiApplication*>(QCoreApplication::instance());
+ connect(application, &QGuiApplication::layoutDirectionChanged,
+ this, &UCApplication::layoutDirectionChanged);
}
UCApplication::~UCApplication()
@@ -91,4 +95,18 @@
m_inputMethod = inputMethod;
}
+/*!
+ * \internal
+ * The (default) layout direction. Can be overridden for testing,
+ * unlike Qt.application.layoutDirection.
+ */
+Qt::LayoutDirection UCApplication::layoutDirection() {
+ return QGuiApplication::layoutDirection();
+}
+
+void UCApplication::setLayoutDirection(Qt::LayoutDirection layoutDirection) {
+ return QGuiApplication::setLayoutDirection(layoutDirection);
+}
+
+
UT_NAMESPACE_END
=== modified file 'src/UbuntuToolkit/ucapplication_p.h'
--- src/UbuntuToolkit/ucapplication_p.h 2016-09-09 17:49:07 +0000
+++ src/UbuntuToolkit/ucapplication_p.h 2017-02-27 14:06:54 +0000
@@ -33,6 +33,7 @@
Q_OBJECT
Q_PROPERTY(QString applicationName READ applicationName WRITE setApplicationName NOTIFY applicationNameChanged)
Q_PROPERTY(QObject* inputMethod READ inputMethod WRITE setInputMethod NOTIFY inputMethodChanged)
+ Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged)
private:
Q_DISABLE_COPY(UCApplication)
@@ -53,11 +54,13 @@
// getter
QString applicationName();
QObject* inputMethod();
+ Qt::LayoutDirection layoutDirection();
// setter
void setContext(QQmlContext* context);
void setApplicationName(const QString& applicationName);
void setInputMethod(QObject* inputMethod);
+ void setLayoutDirection(Qt::LayoutDirection layoutDirection);
private:
QQmlContext* m_context;
@@ -67,6 +70,7 @@
Q_SIGNALS:
void applicationNameChanged();
void inputMethodChanged();
+ void layoutDirectionChanged();
};
UT_NAMESPACE_END
Follow ups
-
[Merge] lp:~ubuntu-sdk-team/ubuntu-ui-toolkit/realLayoutDirectionChange into lp:ubuntu-ui-toolkit/staging
From: noreply, 2017-03-13
-
Re: [Merge] lp:~ubuntu-sdk-team/ubuntu-ui-toolkit/realLayoutDirectionChange into lp:ubuntu-ui-toolkit/staging
From: ubuntu-sdk-build-bot, 2017-03-13
-
Re: [Merge] lp:~ubuntu-sdk-team/ubuntu-ui-toolkit/realLayoutDirectionChange into lp:ubuntu-ui-toolkit/staging
From: ubuntu-sdk-build-bot, 2017-03-13
-
[Merge] lp:~ubuntu-sdk-team/ubuntu-ui-toolkit/realLayoutDirectionChange into lp:ubuntu-ui-toolkit/staging
From: Zsombor Egri, 2017-03-13
-
Re: [Merge] lp:~ubuntu-sdk-team/ubuntu-ui-toolkit/realLayoutDirectionChange into lp:ubuntu-ui-toolkit/staging
From: Zsombor Egri, 2017-03-13
-
Re: [Merge] lp:~ubuntu-sdk-team/ubuntu-ui-toolkit/realLayoutDirectionChange into lp:ubuntu-ui-toolkit/staging
From: Adnane Belmadiaf, 2017-03-02
-
Re: [Merge] lp:~ubuntu-sdk-team/ubuntu-ui-toolkit/realLayoutDirectionChange into lp:ubuntu-ui-toolkit/staging
From: ubuntu-sdk-build-bot, 2017-02-27
-
Re: [Merge] lp:~ubuntu-sdk-team/ubuntu-ui-toolkit/realLayoutDirectionChange into lp:ubuntu-ui-toolkit/staging
From: ubuntu-sdk-build-bot, 2017-02-27
-
Re: [Merge] lp:~ubuntu-sdk-team/ubuntu-ui-toolkit/realLayoutDirectionChange into lp:ubuntu-ui-toolkit/staging
From: ubuntu-sdk-build-bot, 2017-02-27
-
Re: [Merge] lp:~ubuntu-sdk-team/ubuntu-ui-toolkit/realLayoutDirectionChange into lp:ubuntu-ui-toolkit/staging
From: ubuntu-sdk-build-bot, 2017-02-27
-
Re: [Merge] lp:~ubuntu-sdk-team/ubuntu-ui-toolkit/realLayoutDirectionChange into lp:ubuntu-ui-toolkit/staging
From: ubuntu-sdk-build-bot, 2017-02-27
-
Re: [Merge] lp:~ubuntu-sdk-team/ubuntu-ui-toolkit/realLayoutDirectionChange into lp:ubuntu-ui-toolkit/staging
From: ubuntu-sdk-build-bot, 2017-02-27