![TypeError:创建 QMLscene 窗口时,无法调用 null 的方法“hasOwnProperty”](https://linux22.com/image/1100427/TypeError%EF%BC%9A%E5%88%9B%E5%BB%BA%20QMLscene%20%E7%AA%97%E5%8F%A3%E6%97%B6%EF%BC%8C%E6%97%A0%E6%B3%95%E8%B0%83%E7%94%A8%20null%20%E7%9A%84%E6%96%B9%E6%B3%95%E2%80%9ChasOwnProperty%E2%80%9D.png)
我正在尝试使用 Qt Creator 制作一个简单的 Ubuntu Touch Web 应用程序。我已根据教程设置了一个新项目,并将文件提交给 Bazaar。我在项目的 qml 文件中设置了一个 url,而不是默认的 index.htm。使用 build->run 会加载一个带有所需网页的 QML Scene 窗口,但 Qt Creator 会产生以下输出:
Starting /usr/lib/i386-linux-gnu/qt5/bin/qmlscene -I /home/tomas/ubuntu-sdk/SL-planner -I /usr/bin -I /usr/lib/i386-linux-gnu/qt5/qml /home/tomas/ubuntu-sdk/SL-planner/SL-planner.qml
unity::action::ActionManager::ActionManager(QObject*):
Could not determine application identifier. HUD will not work properly.
Provide your application identifier in $APP_ID environment variable.
file:///usr/lib/i386-linux-gnu/qt5/qml/Ubuntu/Components/MainView.qml:257: TypeError: Cannot call method 'hasOwnProperty' of null
我的 SL-planner.qml 如下所示:
import QtQuick 2.0
import Ubuntu.Components 0.1
import QtWebKit 3.0
/*!
\brief MainView with a Flickable WebView.
*/
MainView {
// objectName for functional testing purposes (autopilot-qt5)
objectName: "mainView"
// Note! applicationName needs to match the "name" field of the click manifest
applicationName: "com.ubuntu.developer.tomoqv.SL-planner"
/*
This property enables the application to change orientation
when the device is rotated. The default is false.
*/
automaticOrientation: true
width: units.gu(100)
height: units.gu(75)
Flickable {
id: webViewFlickable
anchors.fill: parent
WebView {
id: webView
anchors.fill: parent
url: "http://mobil.sl.se"
}
}
}
我错过了什么?