本文整理汇总了C++中QWebEngineView::setPage方法的典型用法代码示例。如果您正苦于以下问题:C++ QWebEngineView::setPage方法的具体用法?C++ QWebEngineView::setPage怎么用?C++ QWebEngineView::setPage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QWebEngineView
的用法示例。
在下文中一共展示了QWebEngineView::setPage方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: page
QWebEnginePage* QWebEngineView::page() const
{
Q_D(const QWebEngineView);
if (!d->page) {
QWebEngineView *that = const_cast<QWebEngineView*>(this);
that->setPage(new QWebEnginePage(that));
}
return d->page;
}
示例2: QWebEngineView
QWebEngineView *VUtils::getWebEngineView(QWidget *p_parent)
{
QWebEngineView *viewer = new QWebEngineView(p_parent);
VPreviewPage *page = new VPreviewPage(viewer);
page->setBackgroundColor(Qt::transparent);
viewer->setPage(page);
viewer->setZoomFactor(g_config->getWebZoomFactor());
return viewer;
}
示例3: main
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
app.setQuitOnLastWindowClosed(false);
app.setApplicationName("electric-webview");
app.setApplicationVersion("1.0");
QCommandLineParser cmdParser;
cmdParser.setSingleDashWordOptionMode(QCommandLineParser::ParseAsCompactedShortOptions);
cmdParser.setApplicationDescription("Electric WebView is a scriptable WebView for developers.");
cmdParser.addHelpOption();
cmdParser.addVersionOption();
cmdParser.addOption(QCommandLineOption(QStringList() << "t" << "transport", "Command Transport Layer to use.", "tcp|unixsocket|websocket"));
cmdParser.addOption(QCommandLineOption(QStringList() << "r" << "reverse", "Enable reverse mode. The ID is used to identify your session in the server.", "ID"));
cmdParser.addOption(QCommandLineOption(QStringList() << "s" << "script", "Script to run.", "path"));
cmdParser.process(app);
if (cmdParser.value("transport").isEmpty()) {
qDebug().noquote() << "You must provide a command transport layer";
return -1;
}
CommandServer *commandServer = new CommandServer();
commandServer->setTransport(cmdParser.value("transport"));
commandServer->setReverse(cmdParser.isSet("reverse"));
commandServer->setReverseId(cmdParser.value("reverse"));
commandServer->initialize();
QWebEngineView *webView = new QWebEngineView;
webView->setPage(new WebPage);
ElectricWebView::instance()->setWebView(webView);
ElectricWebView::instance()->initialize();
QObject::connect(commandServer, &CommandServer::newCommand, ElectricWebView::instance()->commandHandler(), &CommandHandler::processCommand);
if (cmdParser.isSet("script"))
ElectricWebView::instance()->runScript(cmdParser.value("transport"), cmdParser.value("script"));
return app.exec();
}