aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates2
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2017-07-11 00:01:50 +0200
committerJ-P Nurmi <jpnurmi@qt.io>2017-07-11 09:41:54 +0000
commit1642a45fedabd671a4d05fe9e6632e344857951b (patch)
tree600e22b907b1d93f72f6bb322f1838a7275fffb2 /src/quicktemplates2
parent2d75c5366ea82cc600d1578278f88d5a5e97488b (diff)
Add QQuickPopup::mirrored
This allows taking RTL into account e.g. when defining transitions and transform origins. [ChangeLog][Controls][Popup] Added a read-only "mirrored" property that is true when the popup's locale is right-to-left. Change-Id: I12fe09d8ed3af2836c92631ae43752929b08feb5 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/quicktemplates2')
-rw-r--r--src/quicktemplates2/qquickpopup.cpp21
-rw-r--r--src/quicktemplates2/qquickpopup_p.h4
-rw-r--r--src/quicktemplates2/qquickpopupitem.cpp6
-rw-r--r--src/quicktemplates2/qquickpopupitem_p_p.h1
4 files changed, 31 insertions, 1 deletions
diff --git a/src/quicktemplates2/qquickpopup.cpp b/src/quicktemplates2/qquickpopup.cpp
index 38ca6edf..143075e6 100644
--- a/src/quicktemplates2/qquickpopup.cpp
+++ b/src/quicktemplates2/qquickpopup.cpp
@@ -1396,7 +1396,7 @@ void QQuickPopup::resetBottomPadding()
This property holds the locale of the popup.
- \sa {LayoutMirroring}{LayoutMirroring}
+ \sa mirrored, {LayoutMirroring}{LayoutMirroring}
*/
QLocale QQuickPopup::locale() const
{
@@ -1417,6 +1417,25 @@ void QQuickPopup::resetLocale()
}
/*!
+ \since QtQuick.Controls 2.3 (Qt 5.10)
+ \qmlproperty bool QtQuick.Controls::Popup::mirrored
+ \readonly
+
+ This property holds whether the popup is mirrored.
+
+ This property is provided for convenience. A popup is considered mirrored
+ when its visual layout direction is right-to-left; that is, when using a
+ right-to-left locale.
+
+ \sa locale, {Right-to-left User Interfaces}
+*/
+bool QQuickPopup::isMirrored() const
+{
+ Q_D(const QQuickPopup);
+ return d->popupItem->isMirrored();
+}
+
+/*!
\qmlproperty font QtQuick.Controls::Popup::font
This property holds the font currently set for the popup.
diff --git a/src/quicktemplates2/qquickpopup_p.h b/src/quicktemplates2/qquickpopup_p.h
index 803be911..c22ed638 100644
--- a/src/quicktemplates2/qquickpopup_p.h
+++ b/src/quicktemplates2/qquickpopup_p.h
@@ -97,6 +97,7 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickPopup : public QObject, public QQml
Q_PROPERTY(qreal rightPadding READ rightPadding WRITE setRightPadding RESET resetRightPadding NOTIFY rightPaddingChanged FINAL)
Q_PROPERTY(qreal bottomPadding READ bottomPadding WRITE setBottomPadding RESET resetBottomPadding NOTIFY bottomPaddingChanged FINAL)
Q_PROPERTY(QLocale locale READ locale WRITE setLocale RESET resetLocale NOTIFY localeChanged FINAL)
+ Q_PROPERTY(bool mirrored READ isMirrored NOTIFY mirroredChanged FINAL REVISION 3)
Q_PROPERTY(QFont font READ font WRITE setFont RESET resetFont NOTIFY fontChanged FINAL)
Q_PROPERTY(QPalette palette READ palette WRITE setPalette RESET resetPalette NOTIFY paletteChanged FINAL REVISION 3)
Q_PROPERTY(QQuickItem *parent READ parentItem WRITE setParentItem NOTIFY parentChanged FINAL)
@@ -207,6 +208,8 @@ public:
void setLocale(const QLocale &locale);
void resetLocale();
+ bool isMirrored() const;
+
QFont font() const;
void setFont(const QFont &font);
void resetFont();
@@ -324,6 +327,7 @@ Q_SIGNALS:
void bottomPaddingChanged();
void fontChanged();
void localeChanged();
+ Q_REVISION(3) void mirroredChanged();
Q_REVISION(3) void paletteChanged();
void parentChanged();
void backgroundChanged();
diff --git a/src/quicktemplates2/qquickpopupitem.cpp b/src/quicktemplates2/qquickpopupitem.cpp
index 27b800f0..a8d35596 100644
--- a/src/quicktemplates2/qquickpopupitem.cpp
+++ b/src/quicktemplates2/qquickpopupitem.cpp
@@ -289,6 +289,12 @@ void QQuickPopupItem::localeChange(const QLocale &newLocale, const QLocale &oldL
d->popup->localeChange(newLocale, oldLocale);
}
+void QQuickPopupItem::mirrorChange()
+{
+ Q_D(QQuickPopupItem);
+ emit d->popup->mirroredChanged();
+}
+
void QQuickPopupItem::itemChange(ItemChange change, const ItemChangeData &data)
{
Q_D(QQuickPopupItem);
diff --git a/src/quicktemplates2/qquickpopupitem_p_p.h b/src/quicktemplates2/qquickpopupitem_p_p.h
index 97f6415f..0187b77a 100644
--- a/src/quicktemplates2/qquickpopupitem_p_p.h
+++ b/src/quicktemplates2/qquickpopupitem_p_p.h
@@ -91,6 +91,7 @@ protected:
void fontChange(const QFont &newFont, const QFont &oldFont) override;
void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override;
void localeChange(const QLocale &newLocale, const QLocale &oldLocale) override;
+ void mirrorChange() override;
void itemChange(ItemChange change, const ItemChangeData &data) override;
void paddingChange(const QMarginsF &newPadding, const QMarginsF &oldPadding) override;
void paletteChange(const QPalette &newPalette, const QPalette &oldPalette) override;