95 if (!
qapp && !QApplication::instance()) {
114 Int_t interval =
gEnv->GetValue(
"WebGui.Qt5Timer", 1);
116 fTimer = std::make_unique<TQt6Timer>(interval,
kTRUE);
121 QString fullurl = QString(args.
GetFullUrl().c_str());
126 fHandler = std::make_unique<RootUrlSchemeHandler>();
127 QWebEngineProfile::defaultProfile()->installUrlSchemeHandler(
"rootscheme",
fHandler.get());
128 QWebEngineProfile::defaultProfile()->connect(QWebEngineProfile::defaultProfile(), &QWebEngineProfile::downloadRequested,
129 [](QWebEngineDownloadRequest *request) { request->accept(); });
137 auto handle = std::make_unique<RQt6WebDisplayHandle>(fullurl.toLatin1().constData());
142 if (!qparent) handle->fView = view;
143 view->load(QUrl(fullurl));
147 int tmout_sec = 30, expired = tmout_sec * 100;
148 bool load_finished =
false, did_try =
false, get_content =
false, is_error =
false;
149 std::string content, pdffile;
154 QObject::connect(view, &RootWebView::loadFinished, [&load_finished, &is_error](
bool is_ok) {
155 load_finished =
true; is_error = !is_ok;
158 if (!pdffile.empty())
159 QObject::connect(view->page(), &RootWebPage::pdfPrintingFinished, [&expired, &is_error](
const QString &,
bool is_ok) {
160 expired = 0; is_error = !is_ok;
164 if (page_content.empty())
165 view->load(QUrl(fullurl));
167 view->setHtml(QString::fromUtf8(page_content.data(), page_content.size()), QUrl(
"file:///batch_page.html"));
170 while ((--expired > 0) && !get_content && !is_error) {
172 if (
gSystem->ProcessEvents())
break;
174 QApplication::sendPostedEvents();
175 QApplication::processEvents();
177 if (load_finished && !did_try) {
180 if (pdffile.empty()) {
181 view->page()->toHtml([&get_content, &content](
const QString& res) {
183 content = res.toLatin1().constData();
186 view->page()->printToPdf(QString::fromUtf8(pdffile.data(), pdffile.size()));
187 #if QT_VERSION < 0x050900
197 handle->SetContent(content);
202 for (expired=0;expired<100;++expired) {
203 QApplication::sendPostedEvents();
204 QApplication::processEvents();