关于无法在PyQt5中导入QtWebKitWidgets和pyqt5安装后导入包找不到的问题就给大家分享到这里,感谢你花时间阅读本站内容,更多关于c–从QtWebKit到QtWebEngine的QWe
关于无法在PyQt5中导入QtWebKitWidgets和pyqt5安装后导入包找不到的问题就给大家分享到这里,感谢你花时间阅读本站内容,更多关于c – 从QtWebKit到QtWebEngine的QWebView :: settings() – > setUserStyleSheetUrl()?、centos 7.5安装temviewer14,遇到qt5-qtwebkit问题解决以及文件下载地址、Differences Between PyQt4 and PyQt5、HT for Web嵌入QtWebKit的客户端解决方案等相关知识的信息别忘了在本站进行查找喔。
本文目录一览:- 无法在PyQt5中导入QtWebKitWidgets(pyqt5安装后导入包找不到)
- c – 从QtWebKit到QtWebEngine的QWebView :: settings() – > setUserStyleSheetUrl()?
- centos 7.5安装temviewer14,遇到qt5-qtwebkit问题解决以及文件下载地址
- Differences Between PyQt4 and PyQt5
- HT for Web嵌入QtWebKit的客户端解决方案
无法在PyQt5中导入QtWebKitWidgets(pyqt5安装后导入包找不到)
我最近在这里使用Windows
32位安装程序将PyQt5从5.5.1升级到了5.6.0:https
://www.riverbankcomputing.com/software/pyqt/download5 。我还将python从3.4升级到3.5。
当我使用最新版本运行旧代码(该代码曾经可以工作)时,出现异常:
from PyQt5.QtWebKitWidgets import *ImportError: No module named ''PyQt5.QtWebKitWidgets''
我在python中进行的所有QT调用都是连续发生的(并且,我知道我不应该导入*,但是我认为这是问题所在):
from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5.QtWidgets import * from PyQt5.QtWebKitWidgets import *
因此,QtCore,QtGui和QtWidgets导入都可以。
另外,当我在源代码中搜索QtWebKitWidgets时,会出现对该模块的一些引用。
最后,我的python路径如下所示:
C:\PYTHON35;C:\PYTHON35\DLLs;C:\PYTHON35\LIB;C:\PYTHON35\LIB\LIB-TK;
和环境路径:
C:\Python35\Lib\site-packages\PyQt5;C:\Python35;C:\Python35\Lib;C:\Python35\Lib\site-packages;C:\Python35\Scripts ....
答案1
小编典典QtWebKit
在Qt
5.5中被上游弃用,在5.6中被删除。
您可能要切换到PyQt5.QtWebEngineWidgets:
这取代了QtWebKit模块,并为HTML,CSS和JavaScript功能提供了更好的最新支持。
c – 从QtWebKit到QtWebEngine的QWebView :: settings() – > setUserStyleSheetUrl()?
QWebEngineView *qwebview = new QWebEngineView(this); qwebview->settings()->setuserstylesheetUrl(QUrl("qrc:/about.css")); qwebview->setHtml(fileContentStr);
使用新的Qt Web引擎插入用户CSS的最佳方法是什么?
解决方法
The only opportunity to inject CSS code into the WebEngineView is
using JavaScript. It would be nice to have an appropriate API for this
and it Could look like our already existing UserScripts API.
看起来很清楚:你不能再使用WebSettings来插入CSS了.相反,您将不得不使用HTML / JavaScript来做到这一点.
我不知道它是否会对你有所帮助,但这里有我所做过的摘录.
在我的.cpp中:
m_pView = new QWebEngineView(this); QUrl startURL = QUrl("path/to/index.html"); m_pView->setUrl(startURL);
在index.html中:
<html> <head> <title>TITLE</title> <Meta charset="UTF-8"> <Meta name="viewport" content="width=device-width,initial-scale=1.0"> <!-- Many JS scripts here --> <link href="./css/style.css" rel="stylesheet"> </head> <body ng-app="myApp" > <div ui-view></div> </body> </html>
希望有所帮助.
centos 7.5安装temviewer14,遇到qt5-qtwebkit问题解决以及文件下载地址
warning: teamviewer_14.2.8352.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID 0c1289c0: NOKEY
error: Failed dependencies:
libQt5Qml.so.5()(64bit) >= 5.5 is needed by teamviewer-14.2.8352-0.x86_64
libQt5Quick.so.5()(64bit) >= 5.5 is needed by teamviewer-14.2.8352-0.x86_64
libQt5WebKit.so.5()(64bit) >= 5.5 is needed by teamviewer-14.2.8352-0.x86_64
libQt5WebKitWidgets.so.5()(64bit) >= 5.5 is needed by teamviewer-14.2.8352-0.x86_64
libQt5X11Extras.so.5()(64bit) >= 5.5 is needed by teamviewer-14.2.8352-0.x86_64
qt5-qtdeclarative >= 5.5 is needed by teamviewer-14.2.8352-0.x86_64
qt5-qtquickcontrols >= 5.5 is needed by teamviewer-14.2.8352-0.x86_64
下面是安装命令行以及下载地址
wget https://download.teamviewer.com/download/linux/teamviewer_14.0.12762.x86_64.rpm
wget http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/q/qt5-qtwebkit-5.9.1-1.el7.x86_64.rpm
yum -y install qt5-qtwebkit-5.9.1-1.el7.x86_64.rpm yum -y install teamviewer_14.0.12762.x86_64.rpm
如果失败,请访问该网站最下面有下载选项。
http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/q/qt5-qtwebkit-5.9.1-1.el7.x86_64.rpm
Differences Between PyQt4 and PyQt5
Differences Between PyQt4 and PyQt5
PyQt5 is not compatibile with PyQt4 (although experience shows that the effort in porting applications from PyQt4 to PyQt5 is not great). This section describes the main differences between the two.
Supported Python Versions
Versions of Python earlier than v2.6 are not supported.
Deprecated Features
PyQt5 does not support any parts of the Qt API that are marked as deprecated or obsolete in Qt v5.0. However it is possible that some of these have been included accidentaly. These are considered bugs and will be removed if found.