gpt4 book ai didi

webview - QML + Meego + webview 无法点击任何网站上的任何内容

转载 作者:行者123 更新时间:2023-12-02 12:15:28 41 4
gpt4 key购买 nike

过去 5 天我一直在尝试许多“解决方案”来尝试“打开”QML webview 对象中的单击,但我似乎仍然无法单击任何页面上的任何链接。

我正在嵌入 Paypal 结帐页面,可能这是我错过的非常简单的东西。我尝试了一个只有 webview 的空页面,除了宽度 + 高度 + javascript(并且没有 js)之外根本没有任何选项,并且我尝试了下面的代码(以及大量其他内容),仍然没有点击。尝试在 IRC 上询问并得到回复“即使使用最基本的 webview 设置,也应该始终可以单击”。我在下面的代码中将 url 从包含真实 ap-key 的 URL 更改为仅包含开发登录页面的 URL,但问题是相同的,无论其是 google.com、paypal 还是任何其他网站。

请问有人知道我如何点击任何东西吗?我也无法单击表单、弹出键盘来填写表单或任何单击。

我在 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;
}
}
}
}
}
}
}

最佳答案

在 QML 标记中,PinchArea 元素是 WebView 的子元素,因此在 WebView 之前获取鼠标/触摸按下事件。如果您将 PinchArea 移至元素层次结构中 WebView 的“后面”,则链接将变得可点击(登录框下方的三个链接除外,因为它们会尝试打开新的浏览器窗口)。

关于webview - QML + Meego + webview 无法点击任何网站上的任何内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12781712/

41 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com