问题标签 [qwebpage]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
post - QtWebKit QWebPage::acceptNavigationRequest 和 POST 数据
是否可以在这个(QWebPage::acceptNavigationRequest)时刻访问 POST 数据?我希望在那里查看请求的 POST 数据,因为我锁定了导航并且我没有机会在 NetworkAccessManager::createRequest 因为它没有到达。
谢谢!
qt - 如何在 QWebView 中启用弹出窗口?[Qt]
我有一个非常简单的 Qt 应用程序,它使用 QtWebkit 和 QWebPage 来呈现网页。问题是它似乎不支持弹出窗口。例如,在 google.com 中,当我单击“Gmail”时,Javascript 警报说我的浏览器已禁用弹出窗口...
还有一个带有以下“a”标签的html文件:<a href = "index.html" target = "_blank">Link</a>
两者都不起作用。
有谁能够帮我?
谢谢。
qt4 - 我如何知道 QWebPage 是否已完成加载?
除了用 QWebPage::loadFinished() 连接一个槽外,有没有办法轮询它的状态?我没有找到直接返回百分比的函数。
c++ - QWebView,如何判断此链接是否为新窗口?
代码
如何判断不是新窗口链接函数openUrl?我将如何编写这段代码、?谢谢!!!
multithreading - QWebFrame 在单独的线程中打印
在我的 qt 应用程序中,我正在从 QWebFrame(来自 QWebPage 的 mainFrame)打印一些大型 html 代码。html 代码包含一些内联图像,需要一段时间才能打印出来。因此,我尝试将打印调用放入单独的线程中以保持 gui 响应。正如文档中提到的,我认为这应该是可能的(在线程中绘画)。
但我还是得到了著名的“QPixmap:在 GUI 线程之外使用 pixmaps 是不安全的”
我的打印代码如下:
为了澄清所有对象都驻留在 gui 线程中,并且之前生成了 html。图像被内联如下:
那么我在这里做错了什么?是不是 QWebFrame 内部使用了一些 QPixmaps?有没有在另一个线程中使用 QWebFrame::print 调用的解决方案?
c++ - QtWebView -- C++ -- 如何获取从 linkClicked 事件返回的 javascript 字符串
我一直无法为我的问题找到明确的答案。
我目前有一个 QWebView 控件加载我硬盘驱动器上的 html 文件,该文件使用 javascript 操作实现矢量地图。html 文件加载 jvectormap 美国各州地图。任何状态的点击动作都会触发与 showCities 函数相关联的 onRegionClick 动作,该函数的事件和代码参数由 jquery-jvectormap.js 文件中实现的 onRegionClick 方法处理。html文件如下:
以及Qt中的mainwindow.h头文件信息:
然后是 MainWindow.cpp 文件:
当我单击任何特定区域时,不会触发/触发 on_webView_linkClicked 函数。单击的任何区域都旨在返回一个字符串。当我在网页上尝试此操作时,例如http://www.google.com, on_WebView_linkClicked 函数中的 QMessageBox 实际上会触发/触发一个显示 QMessageBox 的事件。
这里的目标是让函数 showCities 的 html 文件中返回的 javascript 字符串显示在 on_webView_linkClicked 事件中。显然,linkClicked 操作没有将 javascript 返回识别为链接,因此在使用 jquery 矢量地图时它保持沉默。
我已经到处搜索了这个,我能得到的唯一答案是,如果矢量图中的这些区域附加了 url 链接,它可能会起作用,但是我在这些区域中嵌入的虚拟链接不会导致 on_webView_linkClicked 事件触发。
谢谢你的帮助 :)
qt - 选中 Qt WebKit 句柄复选框
我需要处理 QWebView (QWebPage) 中复选框的选中状态。
更多细节:
HTML中有一些复选框。我们希望在检查其中一些时对应用程序进行更改。为此,我们需要知道它何时发生了变化。
怎么做?
qt - 处理 QWebView / QWebPage 中的错误
success = false
我希望获得更多信息,而不仅仅是loadFinished
(这通常只是取消加载)。从该站点上的文档和其他帖子中,我收集到我应该继承 QWebPage 并覆盖extension()
处理 ErrorPageExtension 的方法。
但是,我没有让它工作,即,无论我尝试什么,我的扩展方法都不会被调用。我可能正在做一些非常愚蠢的事情,但没有看到它。基本上我的课是这样的:
方法的实现不是问题,我在那里有一个断点,它永远不会被调用。我创建了一个实例
我对 QWebView 中 QWebPage 对象的生命周期有点不确定,但从我的测试来看,QWebPage 似乎总是保持相同的实例并且只是加载新内容。所以我认为我应该简单地将我的页面提供给 QWebView,我没有看到另一种让它使用我的派生类的方法。但是,当通过 WebView 或直接通过页面的大型机加载虚假 URL、不存在的本地文件或不受支持的内容时,我从未收到带有 ErrorPageExtension 信息的调用。
任何帮助表示赞赏。这是使用 Qt 4.8.2。
c++ - Receiving multiple loadFinished signals for a requested web page
I'm receiving multiple loadFinished
signals when I attempt to load a QWebPage
and I'm not sure what's causing the issue. There were a couple of other questions that seemed to allude to the same problem, but the solutions didn't work for me:
In the first question, the answer was to connect signals to slots only once," but I already do that. The answer to the second question suggests that I should connect to the frame's loadFinished
signal, but I simply don't get the necessary data when that is done.
I attempt to load multiple pages:
The class that processes the signals looks like this:
Here is the result of only connecting to the frame's loadFinished
signal:
Here are the results when I connect to the page's loadFinished
signal:
I don't understand the behavior, why sometimes I get relevant content and other times I don't. If I connect to the page's loadFinished
signal, then I will eventually get the content but I don't know when it will actually happen. How do I know when my page has actually finished loading?
Update
I'm assuming that most of my content will arrive in less than 3 seconds, so I've come up with a workaround: I set a timer event to signal the UA::loadFinished
3 seconds after the first loadFinished
signal is received from the QWebPage
. That's not very pretty, nor is it efficient, but it works for this situation.
qt - Qt/PyQt:如何操作 QWebView/QWebPage 的“在新窗口中打开”操作?
如果我有一个打开的 QWebView,我喜欢它的默认上下文菜单,其中“在新窗口中打开”作为链接选项。但是,当用户请求在新窗口中打开链接时,我似乎找不到采取行动的方法。覆盖 QWebPage.createWindow 方法似乎不起作用,因为当用户选择在新窗口中打开链接时,不会调用该方法。
有什么建议吗?我正在使用 PyQt。
示例代码:
我在那里有调试打印来验证 createWindow 没有被调用。