问题标签 [qwebengineview]

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.

0 投票
1 回答
684 浏览

python - 通过 QWebEngineHttpRequest (PyQt5) 发布请求

我有一个关于在 PyQt5 中发出 POST 请求的问题。不幸的是,这个 Python 框架的官方文档不存在。我必须将文档从 C++ 翻译成 Python。

我有处理它的问题。要发出 POST 请求,我必须创建类的实例QWebEngineHttpRequestdocs),然后添加 POST 数据setPostData(),这看起来很容易,但是该方法需要类型中的参数QByteArraydocs),这是一个问题,因为我没有知道如何将数据插入其中。

0 投票
1 回答
1127 浏览

python - Python PyQT - Web Browser | Bookmarks

This is a repost of my previous post which I deleted. In the first post I asked if someone knows a way of creating bookmarks with PyQT5, however, originally, I did not post what issues I am having now, with my way. I have 3 toolbars, in my web browser.

  1. For additional buttons as - exit, minimize, maximize and etc.
  2. For navigation in the web.
  3. Bookmarks all are created with the instance of QToolBar().

Bookmarks toolbar code

After the tool bars are created the buttons are added, as there is a lot of code there I will show just the final result as a screenshot and the last few lines of code in init function.

How the Web Browser looks

The last few lines of code:

Everything is fine with the Web Browser itself, as everything is working except the bookmarks. The line of code 'bookmarks_load()' load the bookmarks from a .txt file. As for now in the .txt document the bookmark is youtube.com (does not matter which link is used). The bookmarks functioncs:

Add a website to a bookmark.txt

Load bookmarks from the document file.

Create the bookmarks 'button', when pressed open a new tab with that website.

Now this is the part which I start having issues. If I remove the - triggered.connect line and I do not add any functionality to that 'button' everything launches and works, without any errors. It stores and can load the bookmarks. However, when that line is added, it crashes and the button is not created(The app does not exit as there is an except statement which catches the error - which pyqt does not show what error it is.). This is the add_new_tab() function:

Originally I open tabs by 'double clicking' on the tab bar with this function:

As you can see on the trigger - I do pass the link as QUrl and I do add a test label. The problem I have it somehow does not want to work and I can not find why, because Python PyQT5 does not show an error, it just closes with the return code.

Screenshots as explanation:


Link not added to a bookmarks.txt

Link not added to a bookmarks.txt

Link added to bookmarks.txt

Link added to bookmarks.txt

Pickle does dump the link in .txt

Pickle does dump the link in .txt

The "except" statement is run, while the triggered.connect line is not commented out.

The

The app continues to run, but the loaded bookmarks buttons are not there. Empty bookmarks bar

0 投票
1 回答
120 浏览

qt - Qt5.11.1中,`QWebEngineView`可以调用ActiveX插件吗?

Qt5.11.1,可以QWebEngineView调用ActiveX插件吗?

如果是这样,我该如何称呼它?

我正在使用浏览器并想使用 QWebEngineView 调用 ActiveX 插件。我在网上搜索并没有找到任何信息。

0 投票
1 回答
7075 浏览

javascript - 从 pyqt QWebEngineView 启动 javascript 函数

我打算从 pyqt QWebEngine 执行一个 javascript 函数。我遵循了一个使用地图的示例,并且在按下 Qt 应用程序按钮时检索了地图绑定,并编写了一个小示例。

html:

Python:

不过,我收到以下错误:

我错过了什么?

0 投票
1 回答
1420 浏览

python - 如何在pyside2中检测Qwebengine内的按钮点击

我在 pyside2 中编写了一个应用程序,它在 QWebEngine 中打开了一个网页。

该网页有 2 个按钮,我不明白如何检测 pyside2 应用程序模块中的按钮单击,我需要对该按钮单击执行其他操作。

例子

下面是我的代码

下面是输出:

在此处输入图像描述

现在我只想在用户单击“开始”按钮时关闭我的应用程序。

0 投票
1 回答
532 浏览

c++ - 如何在 QWebEngineView 周围显示边框?

我有一个 QGraphicsWidget,我用它来绘制和显示许多项目,包括使用 QGraphicsProxyWidget 的 QWebEngineView。我能够将网页内容加载到 QWebEngineView 中,但我想让视图包含边框。我使用“setStyleSheet”尝试添加边框,但这似乎不起作用。以下代码在我的 QGraphicsWidget 类的构造函数中添加 QWebEngineView:

这就是它目前的样子: 在此处输入图像描述 我希望它是什么样子: 在此处输入图像描述

0 投票
1 回答
696 浏览

javascript - QML WebEngineView 和 DOM 元素更新

我正在尝试使用 javascript 使用更新的输入凭据打开 Netflix url。输入似乎在 HTML 表单中更新,但是当我触发登录按钮时,输入字段为空。非常感谢任何输入

0 投票
1 回答
6917 浏览

python - 如何在 Python QT Designer 中插入 Web 浏览器

我在 QT Designer 5 中创建了一个简单的用户界面,并希望包含一个显示网页的小部件。我使用以下代码将 ui 文件与 python 一起使用:

似乎没有小部件可以用来在 QT Designer 中插入 Web 浏览器小部件,因此我正在寻找一个小部件来通过使用类或其他东西并将小部件添加到已经在 Designer 中创建的界面来实现这一点。

0 投票
1 回答
906 浏览

python - 在 QWebEngineView 中获取 sslerrors 信号

我正在开发一个用户必须先登录的应用程序。我正在使用 QWebEngineView 来显示登录页面。但是在其中一台机器中,该页面没有显示。我想知道是否有任何 SSL 错误。如何获取 sslerrors 信号并将其连接到插槽。下面的示例代码

注意:在 Qt4 中这很容易,因为我们可以将 page().networkAccessManager().sslerrors 信号连接到插槽,而在 Qt5 中,由于请求不是通过 NetworkAccessManager 发出的,因此调试起来有点困难。

0 投票
1 回答
423 浏览

qt - 使用 QWebEngineView 显示 QCH 文件的内容

我们在项目中使用 Qt-Help,但我对 Qt-assistant 中 Qt-Help 的格式真的不满意。与我的 Firefox 中 HTML 文件的格式相比,它看起来真的很难看。

原因之一可能是 Qt 助手在其呈现中忽略了 javascript。

因此,我尝试实现一个非常简单的测试运行程序,它应该显示 QHC 文件的内容。

不幸的是,QWebEngineView找不到QUrlQHC 文件的链接。

如何配置QWebEngineView,以便它在 QHC 文件中查找资源?还必须找到 HTML 帮助文件中的所有图像和其他外部资源。

也许这门课QWebEngineUrlSchemeHandler可能会有所帮助。