本文整理汇总了C++中QWebEngineView::setUrl方法的典型用法代码示例。如果您正苦于以下问题:C++ QWebEngineView::setUrl方法的具体用法?C++ QWebEngineView::setUrl怎么用?C++ QWebEngineView::setUrl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QWebEngineView
的用法示例。
在下文中一共展示了QWebEngineView::setUrl方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[])
{
TaskConfig agent_cfg, config;
if (!parseArgs(argc, argv, config, agent_cfg))
return 1;
agent_cfg.set("Measure.AutoSaveReport", "true");
std::ofstream log_file;
if (config.value("logfile") != "-") {
log_file.open(config.value("logfile"));
Logger::setLogFile(log_file);
}
config.set("listen_pw", MeasurementAgent::createHashKey(12));
config.set("listen", "0");
config.set("listen_addr", "127.0.0.1");
config.set("browser", "2");
agent_cfg.set("config_file", config.value("config_file"));
WebsocketBridge *bridge = new WebsocketBridge(nullptr, config);
std::thread agent_thread(runAgent, bridge, agent_cfg);
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QApplication app(argc, argv);
QWebEngineView view;
view.resize(700, 950);
view.show();
// Wait for a few seconds for the agent to start listening on a port
for (unsigned int i = 0; bridge->url().empty() && i < 400; ++i)
std::this_thread::sleep_for(std::chrono::milliseconds(1+i/10));
int ret;
if (bridge->url().empty()) {
std::cerr << "cannot start measurement engine";
ret = 1;
} else {
view.setUrl(QUrl(bridge->url().c_str()));
ret = app.exec();
}
bridge->die();
agent_thread.join();
return ret;
}