diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2018-05-02 13:54:08 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2018-05-02 12:57:53 +0000 |
commit | 89495f409fcb04f5eeb1c1e06096fcb54065c969 (patch) | |
tree | 05d151a324761c183830c23322261ee5b6d32a91 /src/quicktemplates2/qquicklabel_p.h | |
parent | fac7e9e87caf78554bc33b80fe72dc40518fcc76 (diff) |
Label: add support for background insets
Same as 5adce042 for QQuickControl.
[ChangeLog][Controls][Label] Added topInset, bottomInset, leftInset,
and rightInset properties to control the geometry of the background
similarly to how paddings control the geometry of the contentItem.
Change-Id: I853efcdd6be1d3acfb067128b6195c253350de8d
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/quicktemplates2/qquicklabel_p.h')
-rw-r--r-- | src/quicktemplates2/qquicklabel_p.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/quicktemplates2/qquicklabel_p.h b/src/quicktemplates2/qquicklabel_p.h index ad7f3272..89c9c77b 100644 --- a/src/quicktemplates2/qquicklabel_p.h +++ b/src/quicktemplates2/qquicklabel_p.h @@ -66,6 +66,10 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickLabel : public QQuickText // 2.5 (Qt 5.12) Q_PROPERTY(qreal implicitBackgroundWidth READ implicitBackgroundWidth NOTIFY implicitBackgroundWidthChanged FINAL REVISION 5) Q_PROPERTY(qreal implicitBackgroundHeight READ implicitBackgroundHeight NOTIFY implicitBackgroundHeightChanged FINAL REVISION 5) + Q_PROPERTY(qreal topInset READ topInset WRITE setTopInset RESET resetTopInset NOTIFY topInsetChanged FINAL REVISION 5) + Q_PROPERTY(qreal leftInset READ leftInset WRITE setLeftInset RESET resetLeftInset NOTIFY leftInsetChanged FINAL REVISION 5) + Q_PROPERTY(qreal rightInset READ rightInset WRITE setRightInset RESET resetRightInset NOTIFY rightInsetChanged FINAL REVISION 5) + Q_PROPERTY(qreal bottomInset READ bottomInset WRITE setBottomInset RESET resetBottomInset NOTIFY bottomInsetChanged FINAL REVISION 5) Q_CLASSINFO("DeferredPropertyNames", "background") public: @@ -87,6 +91,22 @@ public: qreal implicitBackgroundWidth() const; qreal implicitBackgroundHeight() const; + qreal topInset() const; + void setTopInset(qreal inset); + void resetTopInset(); + + qreal leftInset() const; + void setLeftInset(qreal inset); + void resetLeftInset(); + + qreal rightInset() const; + void setRightInset(qreal inset); + void resetRightInset(); + + qreal bottomInset() const; + void setBottomInset(qreal inset); + void resetBottomInset(); + Q_SIGNALS: void fontChanged(); void backgroundChanged(); @@ -95,6 +115,10 @@ Q_SIGNALS: // 2.5 (Qt 5.12) Q_REVISION(5) void implicitBackgroundWidthChanged(); Q_REVISION(5) void implicitBackgroundHeightChanged(); + Q_REVISION(5) void topInsetChanged(); + Q_REVISION(5) void leftInsetChanged(); + Q_REVISION(5) void rightInsetChanged(); + Q_REVISION(5) void bottomInsetChanged(); protected: void classBegin() override; @@ -102,6 +126,7 @@ protected: void itemChange(ItemChange change, const ItemChangeData &value) override; void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override; + virtual void insetChange(const QMarginsF &newInset, const QMarginsF &oldInset); private: Q_DISABLE_COPY(QQuickLabel) |