C++ (Qt)#include <QApplication>#include <QtWebKit/QWebView> int main(int argc, char *argv[]){ QApplication a(argc, argv); QWebView *view = new QWebView(); view->load(QUrl("http://gama-gama.ru/")); view->show(); return a.exec();}
Pythonclass UserAgentWebPage(QWebPage): def userAgentForUrl(self, url): return "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:50.0) Gecko/20100101 Firefox/50.0" def javaScriptConsoleMessage(self, msg, line, source): print('%s line %d: %s' % (source, line, msg))
C++ (Qt)#include <QApplication>#include <QWebEngineView> int main(int argc, char *argv[]){ QApplication app(argc, argv); QWebEngineView w; w.load(QUrl("http://gama-gama.ru/")); w.show(); return app.exec();}
Pythonurl = 'http://gama-gama.ru/' from PyQt5.QtCore import *from PyQt5.QtWidgets import *from PyQt5.QtWebEngineWidgets import * app = QApplication([]) view = QWebEngineView()view.setWindowTitle('Qt5 QWebEngineView')view.show() view.load(QUrl(url)) app.exec()
Pythonfrom PyQt4.QtCore import *from PyQt4.QtGui import *from PyQt4.QtWebKit import * app = QApplication([]) view = QWebView()view.setWindowTitle('Qt4 QWebView')view.show() view.load(QUrl(url)) app.exec()