From f0dd62430684e1d52803ea00da49b93f019761b8 Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Wed, 3 Feb 2021 13:20:23 +0100 Subject: [PATCH] parameter name aligned with the QML property --- src/controls/QskQuickItem.cpp | 17 +++++++++++++---- src/controls/QskQuickItem.h | 2 +- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/controls/QskQuickItem.cpp b/src/controls/QskQuickItem.cpp index 8d6fb556..3004b5b8 100644 --- a/src/controls/QskQuickItem.cpp +++ b/src/controls/QskQuickItem.cpp @@ -364,10 +364,19 @@ bool QskQuickItem::polishOnResize() const bool QskQuickItem::layoutMirroring() const { +#if 1 + /* + What about using Qt::LayoutDirection instead. It sounds + like a more expressive API and we do not run into conflicts + with the layoutMirroring() attached property for QML. + But what is the situation with locales, where the default direction + is RightToLeft ? + */ return d_func()->effectiveLayoutMirror; +#endif } -void QskQuickItem::setLayoutMirroring( bool on, bool recursive ) +void QskQuickItem::setLayoutMirroring( bool on, bool childrenInherit ) { // Again we have to deal with an existing API made for QML, // that is weired for C++: LayoutMirroring/QQuickLayoutMirroringAttached @@ -379,9 +388,9 @@ void QskQuickItem::setLayoutMirroring( bool on, bool recursive ) Q_D( QQuickItem ); - if ( recursive != d->inheritMirrorFromItem ) + if ( childrenInherit != d->inheritMirrorFromItem ) { - d->inheritMirrorFromItem = recursive; + d->inheritMirrorFromItem = childrenInherit; d->resolveLayoutMirror(); } @@ -390,7 +399,7 @@ void QskQuickItem::setLayoutMirroring( bool on, bool recursive ) if ( on != d->effectiveLayoutMirror ) { d->setLayoutMirror( on ); - if ( recursive ) + if ( childrenInherit ) d->resolveLayoutMirror(); } } diff --git a/src/controls/QskQuickItem.h b/src/controls/QskQuickItem.h index 33c3efa1..7f7b3e5b 100644 --- a/src/controls/QskQuickItem.h +++ b/src/controls/QskQuickItem.h @@ -78,7 +78,7 @@ class QSK_EXPORT QskQuickItem : public QQuickItem void setTabFence( bool ); bool isTabFence() const; - void setLayoutMirroring( bool on, bool recursive = false ); + void setLayoutMirroring( bool on, bool childrenInherit = false ); void resetLayoutMirroring(); bool layoutMirroring() const;