From 67d3e3d6d53bb1762ce91912eff0471fa55d4676 Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Sat, 7 Feb 2015 22:44:19 +0100 Subject: QQuickText: Move baseUrl to ExtraData. It's only used for external resource loading, which is not the common case. Note that the case of an unset baseUrl may become a little more pessimised now, as it has to be looked up from the context which involves a loop to find the outermost parent context, but again, this is not a common case, so I'd consider that acceptable. QQuickTextPrivate now goes from 496 bytes to 488 bytes. ExtraData increases from 72 bytes to 80 on x86_64. Change-Id: I7e346eeb3b3cefe81912aac2b115e106ec519d1e Reviewed-by: Gunnar Sletta --- src/quick/items/qquicktext.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/quick/items/qquicktext.cpp') diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp index f64b0cdb19..4cd055594c 100644 --- a/src/quick/items/qquicktext.cpp +++ b/src/quick/items/qquicktext.cpp @@ -2070,18 +2070,21 @@ void QQuickText::setElideMode(QQuickText::TextElideMode mode) QUrl QQuickText::baseUrl() const { Q_D(const QQuickText); - if (d->baseUrl.isEmpty()) { + if (!d->extra.isAllocated() || d->extra->baseUrl.isEmpty()) { if (QQmlContext *context = qmlContext(this)) - const_cast(d)->baseUrl = context->baseUrl(); + return context->baseUrl(); + else + return QUrl(); + } else { + return d->extra->baseUrl; } - return d->baseUrl; } void QQuickText::setBaseUrl(const QUrl &url) { Q_D(QQuickText); if (baseUrl() != url) { - d->baseUrl = url; + d->extra.value().baseUrl = url; if (d->richText) { d->ensureDoc(); -- cgit v1.2.3