diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2018-05-02 14:12:42 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2018-05-02 13:43:26 +0000 |
commit | 5ef9d74f8329786505c9db615c40e39d3942e935 (patch) | |
tree | f66507a2c339fb59768b848290006a0934b894c3 /src/quicktemplates2/qquicktextarea_p_p.h | |
parent | 6858d4e9873644c255b19d251e5522c7cf4b7160 (diff) |
TextArea: add support for background insets
Same as 5adce042 for QQuickControl.
[ChangeLog][Controls][TextArea] 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: I1e1b3a79a9f477ec7b64ec4c6cc8021bbf48adc0
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/quicktemplates2/qquicktextarea_p_p.h')
-rw-r--r-- | src/quicktemplates2/qquicktextarea_p_p.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/quicktemplates2/qquicktextarea_p_p.h b/src/quicktemplates2/qquicktextarea_p_p.h index 90e4db7b..408cc391 100644 --- a/src/quicktemplates2/qquicktextarea_p_p.h +++ b/src/quicktemplates2/qquicktextarea_p_p.h @@ -80,6 +80,17 @@ public: return static_cast<QQuickTextAreaPrivate *>(QObjectPrivate::get(item)); } + inline QMarginsF getInset() const { return QMarginsF(getLeftInset(), getTopInset(), getRightInset(), getBottomInset()); } + inline qreal getTopInset() const { return extra.isAllocated() ? extra->topInset : 0; } + inline qreal getLeftInset() const { return extra.isAllocated() ? extra->leftInset : 0; } + inline qreal getRightInset() const { return extra.isAllocated() ? extra->rightInset : 0; } + inline qreal getBottomInset() const { return extra.isAllocated() ? extra->bottomInset : 0; } + + void setTopInset(qreal value, bool reset = false); + void setLeftInset(qreal value, bool reset = false); + void setRightInset(qreal value, bool reset = false); + void setBottomInset(qreal value, bool reset = false); + void resizeBackground(); void resolveFont(); @@ -138,11 +149,22 @@ public: #endif struct ExtraData { + bool hasTopInset = false; + bool hasLeftInset = false; + bool hasRightInset = false; + bool hasBottomInset = false; + bool hasBackgroundWidth = false; + bool hasBackgroundHeight = false; + qreal topInset = 0; + qreal leftInset = 0; + qreal rightInset = 0; + qreal bottomInset = 0; QFont requestedFont; QPalette requestedPalette; }; QLazilyAllocated<ExtraData> extra; + bool resizingBackground = false; QPalette resolvedPalette; QQuickDeferredPointer<QQuickItem> background; QString placeholder; |