Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: FramelessWebEngineView加载url很慢 #871

Closed
zzycrisis opened this issue May 9, 2024 · 2 comments
Closed

[Bug]: FramelessWebEngineView加载url很慢 #871

zzycrisis opened this issue May 9, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@zzycrisis
Copy link

What happened?

我使用高德地图api绘制一个3D地图的html,但无法很快加载出地图,需要刷新很多次才会依次出现组件、地图,这个html中使用了channel进行通信,这个会影响到显示效果吗,使用QWebEngineView时可以正常显示html,但是fluentWindows的导航栏会出现黑影。

Operation System

win11

Python Version

3.9

PyQt/PySide Version

PyQt5

PyQt/PySide-Fluent-Widgets Version

v1

How to Reproduce?

image
image
效果如上所示

Minimum code

class Widget(QFrame):

    def __init__(self, parent=None):
        super().__init__(parent=parent)
        self.setObjectName("homeInterface")
        #self.webView = QWebEngineView(self)
        self.webView = FramelessWebEngineView(self)
        self.webView.load(QUrl.fromLocalFile("D:/python/pyQt/test.html"))
        # 增加一个通信中需要用到的频道
        self.channel = QWebChannel()
        self.printer = Printer()# 通信过程中需要使用到的功能类
        # 将功能类注册到频道中,注册名可以任意,但将在网页中作为标识
        self.channel.registerObject("printer", self.printer)
        self.webView.page().setWebChannel(self.channel)
        self.vBoxLayout = QVBoxLayout(self)
        self.vBoxLayout.setContentsMargins(0, 40, 0, 0)
        self.vBoxLayout.addWidget(self.webView)
    def load_url(self,url):
        print(url)
        self.webView.load(QUrl.fromLocalFile(url))
@zzycrisis zzycrisis added the bug Something isn't working label May 9, 2024
@zhiyiYo
Copy link
Owner

zhiyiYo commented May 12, 2024

云母效果的问题,解决方案看官网文档:

https://qfluentwidgets.com/zh/pages/components/fluentwindow

@zhiyiYo zhiyiYo closed this as completed May 12, 2024
@zzycrisis
Copy link
Author

那请问加载url很慢应该怎么解决呢?我认为加载得慢可能是因为FramelessWebEngineView没那么高效,所以换成了QWebEngine,但现在不能替换的话应该怎么快速显示html界面呢?期待您的回复!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants