summaryrefslogtreecommitdiffstats
path: root/src/declarative/util
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2009-07-16 21:55:23 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2009-07-16 21:55:23 (GMT)
commit1f5e32a11114370e4364fcfa77b9c4ab4bf192a3 (patch)
tree5761a1e1d6dfac01c50d1c91187c20378383fe6f /src/declarative/util
parentf60dea8315fef502f6f4c6941455a51bee66efd9 (diff)
parent6470f646d0815f67bab507c1362cdda775c42a6e (diff)
downloadQt-1f5e32a11114370e4364fcfa77b9c4ab4bf192a3.zip
Qt-1f5e32a11114370e4364fcfa77b9c4ab4bf192a3.tar.gz
Qt-1f5e32a11114370e4364fcfa77b9c4ab4bf192a3.tar.bz2
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui-gv
Conflicts: src/declarative/fx/qfxitem.h src/declarative/util/qfxview.h src/gui/graphicsview/qgraphicsitem_p.h
Diffstat (limited to 'src/declarative/util')
-rw-r--r--src/declarative/util/qfxview.cpp64
-rw-r--r--src/declarative/util/qfxview.h2
2 files changed, 18 insertions, 48 deletions
diff --git a/src/declarative/util/qfxview.cpp b/src/declarative/util/qfxview.cpp
index d3bc463..d83de28 100644
--- a/src/declarative/util/qfxview.cpp
+++ b/src/declarative/util/qfxview.cpp
@@ -246,44 +246,6 @@ void QFxView::execute()
}
}
-/*!
- \internal
-*/
-void QFxView::printErrorLine(const QmlError &error)
-{
- QUrl url = error.url();
- if (error.line() > 0 && error.column() > 0 &&
- url.scheme() == QLatin1String("file")) {
- QString file = url.toLocalFile();
- QFile f(file);
- if (f.open(QIODevice::ReadOnly)) {
- QByteArray data = f.readAll();
- QTextStream stream(data, QIODevice::ReadOnly);
- const QString code = stream.readAll();
- const QStringList lines = code.split(QLatin1Char('\n'));
-
- if (lines.count() >= error.line()) {
- const QString &line = lines.at(error.line() - 1);
- qWarning() << qPrintable(line);
-
- int column = qMax(0, error.column() - 1);
- column = qMin(column, line.length());
-
- QByteArray ind;
- ind.reserve(column);
- for (int i = 0; i < column; ++i) {
- const QChar ch = line.at(i);
- if (ch.isSpace())
- ind.append(ch.unicode());
- else
- ind.append(' ');
- }
- ind.append('^');
- qWarning() << ind.constData();
- }
- }
- }
-}
/*!
\internal
@@ -292,14 +254,15 @@ void QFxView::continueExecute()
{
disconnect(d->component, SIGNAL(statusChanged(QmlComponent::Status)), this, SLOT(continueExecute()));
- if (!d->component){
+ if (!d->component) {
qWarning() << "Error in loading" << d->source;
return;
}
if(d->component->isError()) {
- QList<QmlError> errors = d->component->errors();
- foreach (const QmlError &error, errors) {
+ QList<QmlError> errorList = d->component->errors();
+ emit errors(errorList);
+ foreach (const QmlError &error, errorList) {
qWarning() << error;
}
@@ -309,8 +272,9 @@ void QFxView::continueExecute()
QObject *obj = d->component->create();
if(d->component->isError()) {
- QList<QmlError> errors = d->component->errors();
- foreach (const QmlError &error, errors) {
+ QList<QmlError> errorList = d->component->errors();
+ emit errors(errorList);
+ foreach (const QmlError &error, errorList) {
qWarning() << error;
}
@@ -360,6 +324,10 @@ void QFxView::continueExecute()
This signal is emitted when the view is resized to \a size.
*/
+/*! \fn void QFxView::error(const QList<QmlError> &errors)
+ This signal is emitted when the qml loaded contains errors.
+ */
+
/*!
\internal
*/
@@ -451,8 +419,9 @@ QFxItem* QFxView::addItem(const QString &qml, QFxItem* parent)
QmlComponent component(&d->engine, qml.toUtf8(), QUrl());
if(d->component->isError()) {
- QList<QmlError> errors = d->component->errors();
- foreach (const QmlError &error, errors) {
+ QList<QmlError> errorList = d->component->errors();
+ emit errors(errorList);
+ foreach (const QmlError &error, errorList) {
qWarning() << error;
}
@@ -461,8 +430,9 @@ QFxItem* QFxView::addItem(const QString &qml, QFxItem* parent)
QObject *obj = component.create();
if(d->component->isError()) {
- QList<QmlError> errors = d->component->errors();
- foreach (const QmlError &error, errors) {
+ QList<QmlError> errorList = d->component->errors();
+ emit errors(errorList);
+ foreach (const QmlError &error, errorList) {
qWarning() << error;
}
diff --git a/src/declarative/util/qfxview.h b/src/declarative/util/qfxview.h
index b1386a2..b423749 100644
--- a/src/declarative/util/qfxview.h
+++ b/src/declarative/util/qfxview.h
@@ -85,9 +85,9 @@ public:
bool contentResizable() const;
QSize sizeHint() const;
- static void printErrorLine(const QmlError &);
Q_SIGNALS:
void sceneResized(QSize size);
+ void errors(const QList<QmlError> &error);
private Q_SLOTS:
void continueExecute();