aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates2/qquicktextarea.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/quicktemplates2/qquicktextarea.cpp')
-rw-r--r--src/quicktemplates2/qquicktextarea.cpp33
1 files changed, 24 insertions, 9 deletions
diff --git a/src/quicktemplates2/qquicktextarea.cpp b/src/quicktemplates2/qquicktextarea.cpp
index 95dd9f93..ef59bd93 100644
--- a/src/quicktemplates2/qquicktextarea.cpp
+++ b/src/quicktemplates2/qquicktextarea.cpp
@@ -253,7 +253,10 @@ void QQuickTextAreaPrivate::inheritFont(const QFont &font)
parentFont.resolve(extra.isAllocated() ? extra->requestedFont.resolve() | font.resolve() : font.resolve());
const QFont defaultFont = QQuickTheme::font(QQuickTheme::TextArea);
- const QFont resolvedFont = parentFont.resolve(defaultFont);
+ QFont resolvedFont = parentFont.resolve(defaultFont);
+ // See comment in QQuickControlPrivate::inheritFont
+ if (defaultFont.families().isEmpty())
+ resolvedFont.setFamilies(QStringList());
setFont_helper(resolvedFont);
}
@@ -369,6 +372,8 @@ void QQuickTextAreaPrivate::detachFlickable()
QObjectPrivate::disconnect(flickable, &QQuickFlickable::contentHeightChanged, this, &QQuickTextAreaPrivate::resizeFlickableControl);
flickable = nullptr;
+
+ resizeBackground();
}
void QQuickTextAreaPrivate::ensureCursorVisible()
@@ -433,11 +438,21 @@ void QQuickTextAreaPrivate::resizeFlickableContent()
void QQuickTextAreaPrivate::itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, const QRectF &diff)
{
- Q_UNUSED(item);
- Q_UNUSED(change);
Q_UNUSED(diff);
+ if (!resizingBackground && item == background) {
+ QQuickItemPrivate *p = QQuickItemPrivate::get(item);
+ // Only set hasBackgroundWidth/Height if it was a width/height change,
+ // otherwise we're prevented from setting a width/height in the future.
+ if (change.widthChange())
+ extra.value().hasBackgroundWidth = p->widthValid;
+ if (change.heightChange())
+ extra.value().hasBackgroundHeight = p->heightValid;
+ }
- resizeFlickableControl();
+ if (flickable)
+ resizeFlickableControl();
+ else
+ resizeBackground();
}
qreal QQuickTextAreaPrivate::getImplicitWidth() const
@@ -622,17 +637,17 @@ void QQuickTextArea::setBackground(QQuickItem *background)
d->background = background;
if (background) {
+ QQuickItemPrivate *p = QQuickItemPrivate::get(background);
+ if (p->widthValid || p->heightValid) {
+ d->extra.value().hasBackgroundWidth = p->widthValid;
+ d->extra.value().hasBackgroundHeight = p->heightValid;
+ }
if (d->flickable)
background->setParentItem(d->flickable);
else
background->setParentItem(this);
if (qFuzzyIsNull(background->z()))
background->setZ(-1);
- QQuickItemPrivate *p = QQuickItemPrivate::get(background);
- if (p->widthValid || p->heightValid) {
- d->extra.value().hasBackgroundWidth = p->widthValid;
- d->extra.value().hasBackgroundHeight = p->heightValid;
- }
if (isComponentComplete())
d->resizeBackground();
QQuickControlPrivate::addImplicitSizeListener(background, d, QQuickControlPrivate::ImplicitSizeChanges | QQuickItemPrivate::Geometry);