def main(): import sys QCoreApplication.setOrganizationName("QtExamples") QCoreApplication.setAttribute(Qt.AA_EnableHighDpiScaling) # QtWebEngine::initialize() if QT_NO_WIDGETS: app = QApplication(sys.argv) else: app = QGuiApplication(sys.argv) engine = QQmlApplicationEngine() server = Server(engine) engine.load(QUrl("qrc:/main.qml")) QTimer.singleShot(0, server.run) proxy = QNetworkProxy() proxy.setType(QNetworkProxy.HttpProxy) proxy.setHostName("localhost") proxy.setPort(5555) QNetworkProxy.setApplicationProxy(proxy) sys.exit(app.exec_())
def main(): import sys QCoreApplication.setAttribute(Qt.AA_EnableHighDpiScaling) app = QApplication(sys.argv) engine = QQmlApplicationEngine() engine.addImportPath(":/imports") engine.load(QUrl("qrc:/flatstyle.qml")) sys.exit(app.exec_())
def main(): import sys QCoreApplication.setOrganizationName("QtExamples") QCoreApplication.setAttribute(Qt.AA_EnableHighDpiScaling) app = QApplication(sys.argv) w = MainWindow() w.show() sys.exit(app.exec_())
def main(): import sys QCoreApplication.setOrganizationName("QtExamples") QCoreApplication.setAttribute(Qt.AA_EnableHighDpiScaling) # QtWebEngine::initialize() app = QGuiApplication(sys.argv) engine = QQmlApplicationEngine() engine.load(QUrl("qrc:/WebBrowser.qml")) sys.exit(app.exec_())
def main(): import sys QCoreApplication.setOrganizationName("QtExamples") QCoreApplication.setAttribute(Qt.AA_EnableHighDpiScaling) app = QApplication(sys.argv) w = MainWindow(QUrl("http://qt.io")) w.resize(1024, 768) w.show() sys.exit(app.exec_())
def main() -> None: import sys QCoreApplication.setOrganizationName("QtExamples") QCoreApplication.setAttribute(Qt.AA_EnableHighDpiScaling) app = QApplication(sys.argv) view = QWebEngineView() view.setUrl(commandLineUrlArgument()) view.resize(1024, 750) view.show() sys.exit(app.exec_())
def main(): import sys QCoreApplication.setAttribute(Qt.AA_EnableHighDpiScaling) QCoreApplication.setOrganizationName("QtExamples") app = QGuiApplication(sys.argv) engine = QQmlApplicationEngine() engine.addImportPath(":/imports") engine.load(QUrl("qrc:/main.qml")) if not engine.rootObjects(): sys.exit(-1) sys.exit(app.exec_())
def main(): import sys QCoreApplication.setAttribute(Qt.AA_EnableHighDpiScaling) QCoreApplication.setOrganizationName("QtExamples") app = QGuiApplication(sys.argv) view = QQuickView() view.engine().quit.connect(app.quit) view.setSource(QUrl("qrc:/demos/calqlatr/calqlatr.qml")) if view.status() == QQuickView.Error: sys.exit(-1) view.setResizeMode(QQuickView.SizeRootObjectToView) view.show() sys.exit(app.exec_())
def main(): import os import sys CURRENT_DIR = os.path.dirname(os.path.realpath(__file__)) os.environ["QTWEBENGINE_DICTIONARIES_PATH"] = os.path.join( CURRENT_DIR, "qtwebengine_dictionaries") QCoreApplication.setOrganizationName("QtExamples") QCoreApplication.setAttribute(Qt.AA_EnableHighDpiScaling) app = QApplication(sys.argv) view = WebView() view.setUrl(QUrl("qrc:/index.html")) view.resize(500, 640) view.show() sys.exit(app.exec_())
def main(): import os import sys QCoreApplication.setOrganizationName("QtExamples") QCoreApplication.setAttribute(Qt.AA_EnableHighDpiScaling) app = QGuiApplication(sys.argv) os.environ["QT_QUICK_CONTROLS_STYLE"] = "Material" engine = QQmlApplicationEngine() isEmbedded = False engine.rootContext().setContextProperty("isEmbedded", isEmbedded) engine.load(QUrl("qrc:/qml/main.qml")) sys.exit(app.exec_())
def main(): import sys QCoreApplication.setOrganizationName("QtExamples") QCoreApplication.setAttribute(Qt.AA_EnableHighDpiScaling) app = QApplication(sys.argv) url = QUrl() if len(sys.argv) > 1: url = QUrl.fromUserInput(sys.argv[1]) else: url = QUrl("http://www.google.com/ncr") browser = MainWindow(url) browser.resize(1024, 768) browser.show() sys.exit(app.exec_())
def main(): import sys QCoreApplication.setAttribute(Qt.AA_EnableHighDpiScaling) app = QApplication(sys.argv) view = QWebEngineView() view.setUrl(QUrl("qrc:/index.html")) view.resize(1024, 750) view.show() handler = PrintHandler() handler.setPage(view.page()) printPreviewShortCut = QShortcut(QKeySequence(Qt.CTRL + Qt.Key_P), view) printShortCut = QShortcut(QKeySequence(Qt.CTRL + Qt.SHIFT + Qt.Key_P), view) printPreviewShortCut.activated.connect(handler.printPreview) printShortCut.activated.connect(handler.print) sys.exit(app.exec_())
def main(): import sys QCoreApplication.setAttribute(Qt.AA_EnableHighDpiScaling) QCoreApplication.setOrganizationName("QtExamples") app = QApplication(sys.argv) view = QWebEngineView() # set custom page to open all page's links for https scheme in system browser view.setPage(WebEnginePage(view)) profile = view.page().profile() popup = NotificationPopup(view) profile.setNotificationPresenter(popup.present) view.resize(640, 480) view.show() view.setUrl(QUrl("qrc:/index.html")) sys.exit(app.exec_())