diff options
author | J-P Nurmi <jpnurmi@theqtcompany.com> | 2015-06-27 00:57:26 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@theqtcompany.com> | 2015-06-30 08:24:42 +0000 |
commit | 2ba8261fee95cca0d119879a95f871133f0b51d5 (patch) | |
tree | 0dc1471967a3ba3daca026aaace737a8b67b0585 /src/controls | |
parent | e7869a71faf9d3b2c120e734c7323df0bf41dff6 (diff) |
Control::spacing
Change-Id: I67d81db16e95813b1ed9903017ce4d272093f7bb
Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
Diffstat (limited to 'src/controls')
-rw-r--r-- | src/controls/qquickcontrol.cpp | 27 | ||||
-rw-r--r-- | src/controls/qquickcontrol_p.h | 6 | ||||
-rw-r--r-- | src/controls/qquickcontrol_p_p.h | 1 | ||||
-rw-r--r-- | src/controls/qquicktabbar.cpp | 1 |
4 files changed, 33 insertions, 2 deletions
diff --git a/src/controls/qquickcontrol.cpp b/src/controls/qquickcontrol.cpp index 5415ff8e..1b41c352 100644 --- a/src/controls/qquickcontrol.cpp +++ b/src/controls/qquickcontrol.cpp @@ -51,7 +51,7 @@ QT_BEGIN_NAMESPACE QQuickControlPrivate::QQuickControlPrivate() : hasTopPadding(false), hasLeftPadding(false), hasRightPadding(false), hasBottomPadding(false), - padding(0), topPadding(0), leftPadding(0), rightPadding(0), bottomPadding(0), + padding(0), topPadding(0), leftPadding(0), rightPadding(0), bottomPadding(0), spacing(0), layoutDirection(Qt::LeftToRight), background(Q_NULLPTR), contentItem(Q_NULLPTR) { } @@ -328,6 +328,31 @@ void QQuickControl::resetBottomPadding() } /*! + \qmlproperty real QtQuickControls2::Control::spacing + + This property holds the spacing. +*/ +qreal QQuickControl::spacing() const +{ + Q_D(const QQuickControl); + return d->spacing; +} + +void QQuickControl::setSpacing(qreal spacing) +{ + Q_D(QQuickControl); + if (!qFuzzyCompare(d->spacing, spacing)) { + d->spacing = spacing; + emit spacingChanged(); + } +} + +void QQuickControl::resetSpacing() +{ + setSpacing(0); +} + +/*! \qmlproperty enumeration QtQuickControls2::Control::layoutDirection This property holds the layout direction of the control. diff --git a/src/controls/qquickcontrol_p.h b/src/controls/qquickcontrol_p.h index 77d33f05..1c9bee3c 100644 --- a/src/controls/qquickcontrol_p.h +++ b/src/controls/qquickcontrol_p.h @@ -65,6 +65,7 @@ class Q_QUICKCONTROLS_EXPORT QQuickControl : public QQuickItem Q_PROPERTY(qreal leftPadding READ leftPadding WRITE setLeftPadding RESET resetLeftPadding NOTIFY leftPaddingChanged FINAL) 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(qreal spacing READ spacing WRITE setSpacing RESET resetSpacing NOTIFY spacingChanged FINAL) Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged FINAL) Q_PROPERTY(Qt::LayoutDirection effectiveLayoutDirection READ effectiveLayoutDirection NOTIFY effectiveLayoutDirectionChanged FINAL) Q_PROPERTY(bool mirrored READ isMirrored NOTIFY mirroredChanged FINAL) @@ -97,6 +98,10 @@ public: void setBottomPadding(qreal padding); void resetBottomPadding(); + qreal spacing() const; + void setSpacing(qreal spacing); + void resetSpacing(); + Qt::LayoutDirection layoutDirection() const; Qt::LayoutDirection effectiveLayoutDirection() const; void setLayoutDirection(Qt::LayoutDirection direction); @@ -117,6 +122,7 @@ Q_SIGNALS: void leftPaddingChanged(); void rightPaddingChanged(); void bottomPaddingChanged(); + void spacingChanged(); void layoutDirectionChanged(); void effectiveLayoutDirectionChanged(); void mirroredChanged(); diff --git a/src/controls/qquickcontrol_p_p.h b/src/controls/qquickcontrol_p_p.h index e5beb905..93bfe22f 100644 --- a/src/controls/qquickcontrol_p_p.h +++ b/src/controls/qquickcontrol_p_p.h @@ -78,6 +78,7 @@ public: qreal leftPadding; qreal rightPadding; qreal bottomPadding; + qreal spacing; Qt::LayoutDirection layoutDirection; QQuickItem *background; QQuickItem *contentItem; diff --git a/src/controls/qquicktabbar.cpp b/src/controls/qquicktabbar.cpp index 7714ddbe..ff28f620 100644 --- a/src/controls/qquicktabbar.cpp +++ b/src/controls/qquicktabbar.cpp @@ -114,7 +114,6 @@ void QQuickTabBarPrivate::updateLayout() Q_Q(QQuickTabBar); const int count = contentModel->count(); if (count > 0 && contentItem) { - const qreal spacing = contentItem->property("spacing").toReal(); const qreal itemWidth = (contentItem->width() - qMax(0, count - 1) * spacing) / count; for (int i = 0; i < count; ++i) { |