在过去的 5 天里,我一直在尝试许多“解决方案”来尝试“打开”点击 QML webview 对象,但我似乎仍然无法点击任何页面上的任何链接。
我正在嵌入贝宝结帐页面,这可能是我错过的非常简单的事情。我尝试了一个只有 webview 的空页面,除了宽度 + 高度 + javascripts(并且没有 js)之外没有任何选项,我尝试了下面的代码(以及许多其他东西),仍然没有点击。尝试在 IRC 上询问并得到回复“它应该总是可以点击,即使是最基本的 webview 设置”。我在下面的代码中将 url 从包含真正 ap-key 的 url 更改为仅 dev 登录页面,但问题是相同的,无论它是 paypal 的 google.com 还是任何其他站点。
拜托,有人知道我如何点击任何东西吗?我也不能点击表格,弹出一个键盘来填写表格,或者任何点击。
我在 Meego 平台上运行 QML + PySide。我从 main.qml 将以下页面/矩形加载到 Loader 对象中。
任何帮助将不胜感激。
注意:我确实在 qt-developer 网络上问过同样的问题,但还没有得到回应。在这里尝试,这个论坛的人数更多,所以希望有这个问题经验的人会阅读(我注意到我不是唯一一个遇到这些问题的人“应该工作”)。
import QtQuick 1.1
import QtWebKit 1.1
import com.nokia.meego 1.1
Rectangle {
Image {
id: background
source: "./images/bg.png"
anchors.fill: parent
Text {
id: logo
text: "My Fancy Logo"
x: 2
y: 2
font.pixelSize: 24
font.bold: true
font.italic: true
color: "white"
style: Text.Raised
styleColor: "black"
smooth: true
}
Rectangle {
id: rect
x: 0
y: 60
width: background.width
height: background.height - 70
Flickable {
id: flickable
width: parent.width
height: parent.height
contentWidth: Math.max(parent.width,webView.width)
contentHeight: Math.max(parent.height,webView.height)
flickableDirection: Flickable.HorizontalAndVerticalFlick
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.right
boundsBehavior: Flickable.DragOverBounds
clip:true
pressDelay: 200
WebView {
id: webView
settings.javascriptEnabled: true
settings.pluginsEnabled: true
url: "https://developer.paypal.com/"
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.right
transformOrigin: Item.Top
smooth: false
focus: true
preferredWidth: flickable.width
preferredHeight: flickable.height
PinchArea {
id: pinchArea
property real minScale: 1.0
anchors.fill: parent
property real lastScale: 1.0
pinch.target: webView
pinch.minimumScale: minScale
pinch.maximumScale: 3.0
onPinchFinished: {
flickable.returnToBounds();
flickable.contentWidth = (flickable.width + flickable.width) * webView.scale;
flickable.contentHeight = (flickable.height + flickable.height) * webView.scale;
}
}
}
}
}
}
}