summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2010-04-15 02:51:24 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2010-04-15 02:51:24 (GMT)
commit087e90f089918b939c19133909edb3528fc3e103 (patch)
tree76351d96f1df2fe273b5ccdacc4e53fa3e074df9
parent605f23756969110e19208466674f3c47a7f372dc (diff)
parent5645cd7d7a97edb248a67d094993900f1dba4be8 (diff)
downloadQt-087e90f089918b939c19133909edb3528fc3e103.zip
Qt-087e90f089918b939c19133909edb3528fc3e103.tar.gz
Qt-087e90f089918b939c19133909edb3528fc3e103.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
-rw-r--r--examples/declarative/fonts/fonts.qml4
-rw-r--r--src/declarative/graphicsitems/qdeclarativetext.cpp2
-rw-r--r--src/declarative/util/qdeclarativeanimation.cpp7
-rw-r--r--src/declarative/util/qdeclarativestateoperations.cpp6
-rw-r--r--tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp20
5 files changed, 36 insertions, 3 deletions
diff --git a/examples/declarative/fonts/fonts.qml b/examples/declarative/fonts/fonts.qml
index 97dd645..ae31b03 100644
--- a/examples/declarative/fonts/fonts.qml
+++ b/examples/declarative/fonts/fonts.qml
@@ -7,7 +7,7 @@ Rectangle {
color: "steelblue"
FontLoader { id: fixedFont; name: "Courier" }
- FontLoader { id: localFont; source: "fonts/tarzenau-ocr-a.ttf" }
+ FontLoader { id: localFont; source: "fonts/tarzeau_ocr_a.ttf" }
FontLoader { id: webFont; source: "http://www.princexml.com/fonts/steffmann/Starburst.ttf" }
Column {
@@ -19,7 +19,7 @@ Rectangle {
color: "lightsteelblue"
width: parent.width
elide: Text.ElideRight
- font.family: "Times"; font.pointSize: 42
+ font.family: "Times"; font.pointSize: 42
}
Text {
text: myText
diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp
index b65212b..3a35dd5 100644
--- a/src/declarative/graphicsitems/qdeclarativetext.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetext.cpp
@@ -677,7 +677,7 @@ void QDeclarativeTextPrivate::updateSize()
QTextOption option((Qt::Alignment)int(hAlign | vAlign));
option.setWrapMode(QTextOption::WrapMode(wrapMode));
doc->setDefaultTextOption(option);
- if (wrapMode != QDeclarativeText::NoWrap && !q->heightValid() && q->widthValid())
+ if (wrapMode != QDeclarativeText::NoWrap && q->widthValid())
doc->setTextWidth(q->width());
else
doc->setTextWidth(doc->idealWidth()); // ### Text does not align if width is not set (QTextDoc bug)
diff --git a/src/declarative/util/qdeclarativeanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp
index 33ddb46..fac38d7 100644
--- a/src/declarative/util/qdeclarativeanimation.cpp
+++ b/src/declarative/util/qdeclarativeanimation.cpp
@@ -44,6 +44,7 @@
#include "private/qdeclarativebehavior_p.h"
#include "private/qdeclarativestateoperations_p.h"
+#include "private/qdeclarativecontext_p.h"
#include <qdeclarativepropertyvaluesource.h>
#include <qdeclarative.h>
@@ -767,6 +768,7 @@ void QDeclarativeScriptAction::setStateChangeScriptName(const QString &name)
void QDeclarativeScriptActionPrivate::execute()
{
+ Q_Q(QDeclarativeScriptAction);
if (hasRunScriptScript && reversing)
return;
@@ -775,7 +777,12 @@ void QDeclarativeScriptActionPrivate::execute()
const QString &str = scriptStr.script();
if (!str.isEmpty()) {
QDeclarativeExpression expr(scriptStr.context(), str, scriptStr.scopeObject());
+ QDeclarativeDeclarativeData *ddata = QDeclarativeDeclarativeData::get(q);
+ if (ddata && ddata->outerContext && !ddata->outerContext->url.isEmpty())
+ expr.setSourceLocation(ddata->outerContext->url.toString(), ddata->lineNumber);
expr.value();
+ if (expr.hasError())
+ qWarning() << expr.error();
}
}
diff --git a/src/declarative/util/qdeclarativestateoperations.cpp b/src/declarative/util/qdeclarativestateoperations.cpp
index 410a269..0521d27 100644
--- a/src/declarative/util/qdeclarativestateoperations.cpp
+++ b/src/declarative/util/qdeclarativestateoperations.cpp
@@ -49,6 +49,7 @@
#include <qdeclarativeitem_p.h>
#include <qdeclarativeguard_p.h>
#include <qdeclarativenullablevalue_p_p.h>
+#include "private/qdeclarativecontext_p.h"
#include <QtCore/qdebug.h>
#include <QtGui/qgraphicsitem.h>
@@ -571,7 +572,12 @@ void QDeclarativeStateChangeScript::execute()
const QString &script = d->script.script();
if (!script.isEmpty()) {
QDeclarativeExpression expr(d->script.context(), script, d->script.scopeObject());
+ QDeclarativeDeclarativeData *ddata = QDeclarativeDeclarativeData::get(this);
+ if (ddata && ddata->outerContext && !ddata->outerContext->url.isEmpty())
+ expr.setSourceLocation(ddata->outerContext->url.toString(), ddata->lineNumber);
expr.value();
+ if (expr.hasError())
+ qWarning() << expr.error();
}
}
diff --git a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
index 2d10756..6637415 100644
--- a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
+++ b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
@@ -286,8 +286,28 @@ void tst_qdeclarativetext::wrap()
QVERIFY(textObject != 0);
QCOMPARE(textObject->width(), 30.);
QVERIFY(textObject->height() > textHeight);
+
+ qreal oldHeight = textObject->height();
+ textObject->setWidth(100);
+ QVERIFY(textObject->height() < oldHeight);
}
+ // richtext again with a fixed height
+ for (int i = 0; i < richText.size(); i++)
+ {
+ QString componentStr = "import Qt 4.7\nText { wrapMode: Text.WordWrap; width: 30; height: 50; text: \"" + richText.at(i) + "\" }";
+ QDeclarativeComponent textComponent(&engine);
+ textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QCOMPARE(textObject->width(), 30.);
+ QVERIFY(textObject->implicitHeight() > textHeight);
+
+ qreal oldHeight = textObject->implicitHeight();
+ textObject->setWidth(100);
+ QVERIFY(textObject->implicitHeight() < oldHeight);
+ }
}
void tst_qdeclarativetext::elide()