summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2009-08-24 01:55:20 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2009-08-24 01:55:20 (GMT)
commitc9ed65f66a61c4149995dcc4c986a28ab2b4f124 (patch)
treeba6d6d71385707143f72c5dafb81f35302592d2d /src
parenta750ae1a0b568cdd7e52a0c8aea456b0bae16f0d (diff)
parent23c9370fb8e25fc814fe057c7ad92f70f34a937b (diff)
downloadQt-c9ed65f66a61c4149995dcc4c986a28ab2b4f124.zip
Qt-c9ed65f66a61c4149995dcc4c986a28ab2b4f124.tar.gz
Qt-c9ed65f66a61c4149995dcc4c986a28ab2b4f124.tar.bz2
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'src')
-rw-r--r--src/declarative/fx/qfxwebview.cpp23
-rw-r--r--src/declarative/fx/qfxwebview.h6
-rw-r--r--src/declarative/util/qmllistmodel.cpp6
3 files changed, 26 insertions, 9 deletions
diff --git a/src/declarative/fx/qfxwebview.cpp b/src/declarative/fx/qfxwebview.cpp
index a7d233f..9fc469a 100644
--- a/src/declarative/fx/qfxwebview.cpp
+++ b/src/declarative/fx/qfxwebview.cpp
@@ -131,6 +131,8 @@ public:
QWebSettings *s;
};
+QML_DECLARE_TYPE(QFxWebSettings)
+QML_DEFINE_NOCREATE_TYPE(QFxWebSettings)
class QFxWebViewPrivate : public QFxPaintedItemPrivate
{
@@ -951,7 +953,7 @@ QWebPage *QFxWebView::page() const
}
\endqml
*/
-QObject *QFxWebView::settingsObject() const
+QFxWebSettings *QFxWebView::settingsObject() const
{
Q_D(const QFxWebView);
d->settings.s = page()->settings();
@@ -1101,22 +1103,35 @@ public:
QmlEngine *engine = qmlEngine(webview);
component = new QmlComponent(engine, url, this);
item = 0;
- if (component->isReady())
- qmlLoaded();
- else
+ if (component->isLoading())
connect(component, SIGNAL(statusChanged(QmlComponent::Status)), this, SLOT(qmlLoaded()));
+ else
+ qmlLoaded();
}
public Q_SLOTS:
void qmlLoaded()
{
+ if (component->isError()) {
+ // XXX Could instead give these errors to the WebView to handle.
+ foreach (QmlError err, component->errors())
+ qWarning(err.toString().toLatin1());
+ return;
+ }
item = qobject_cast<QFxItem*>(component->create(qmlContext(webview)));
item->setParent(webview);
+ QString jsObjName;
for (int i=0; i<propertyNames.count(); ++i) {
if (propertyNames[i] != QLatin1String("type") && propertyNames[i] != QLatin1String("data")) {
item->setProperty(propertyNames[i].toLatin1(),propertyValues[i]);
+ if (propertyNames[i] == QLatin1String("objectname"))
+ jsObjName = propertyValues[i];
}
}
+ if (!jsObjName.isNull()) {
+ QWebFrame *f = webview->page()->mainFrame();
+ f->addToJavaScriptWindowObject(jsObjName, item);
+ }
resizeEvent(0);
delete component;
component = 0;
diff --git a/src/declarative/fx/qfxwebview.h b/src/declarative/fx/qfxwebview.h
index d619e94..d84a01c 100644
--- a/src/declarative/fx/qfxwebview.h
+++ b/src/declarative/fx/qfxwebview.h
@@ -75,6 +75,8 @@ private:
class QFxWebViewAttached;
+class QFxWebSettings;
+
class Q_DECLARATIVE_EXPORT QFxWebView : public QFxPaintedItem
{
Q_OBJECT
@@ -103,7 +105,7 @@ class Q_DECLARATIVE_EXPORT QFxWebView : public QFxPaintedItem
Q_PROPERTY(QObject* forward READ forwardAction CONSTANT)
Q_PROPERTY(QObject* stop READ stopAction CONSTANT)
- Q_PROPERTY(QObject* settings READ settingsObject CONSTANT)
+ Q_PROPERTY(QFxWebSettings* settings READ settingsObject CONSTANT)
Q_PROPERTY(QmlList<QObject *>* javaScriptWindowObjects READ javaScriptWindowObjects CONSTANT)
@@ -157,7 +159,7 @@ public:
QWebHistory *history() const;
QWebSettings *settings() const;
- QObject *settingsObject() const;
+ QFxWebSettings *settingsObject() const;
QString status() const;
diff --git a/src/declarative/util/qmllistmodel.cpp b/src/declarative/util/qmllistmodel.cpp
index e2575ab..51b0dae 100644
--- a/src/declarative/util/qmllistmodel.cpp
+++ b/src/declarative/util/qmllistmodel.cpp
@@ -72,7 +72,7 @@ struct ListModelData
\qmlclass ListModel
\brief The ListModel element defines a free-form list data source.
- The ListModel is a simple hierarchy of items containing data roles.
+ The ListModel is a simple hierarchy of elements containing data roles.
For example:
\code
@@ -93,8 +93,8 @@ struct ListModelData
}
\endcode
- Item roles (properties) must begin with a lower-case letter. The above example defines a
- ListModel containing three items, with the roles "name" and "cost".
+ Roles (properties) must begin with a lower-case letter. The above example defines a
+ ListModel containing three elements, with the roles "name" and "cost".
The defined model can be used in views such as ListView:
\code