Nano Browser Example¶
A web browser implemented using the WebEngineView QML type.
"""PySide6 WebEngine QtQuick 2 Example"""
import os
from PySide6.QtCore import QUrl
from PySide6.QtQml import QQmlApplicationEngine
from PySide6.QtWidgets import QApplication
from PySide6.QtWebEngineQuick import QtWebEngineQuick
def main():
app = QApplication([])
QtWebEngineQuick.initialize()
engine = QQmlApplicationEngine()
qml_file_path = os.path.join(os.path.dirname(__file__), 'browser.qml')
qml_url = QUrl.fromLocalFile(os.path.abspath(qml_file_path))
engine.load(qml_url)
app.exec()
if __name__ == '__main__':
main()
import QtQuick
import QtQuick.Window
import QtWebEngine
Window {
width: 1024
height: 768
visible: true
WebEngineView {
anchors.fill: parent
url: "https://www.qt.io"
}
}
© 2022 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.