MCPcopy Create free account
hub / github.com/KangLin/RabbitRemoteControl / setPage

Method setPage

Plugins/WebBrowser/FrmWebView.cpp:129–185  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

127#endif
128
129void CFrmWebView::setPage(QWebEnginePage *page)
130{
131 Q_ASSERT(page);
132 CreateWebActionTrigger(page, QWebEnginePage::Forward);
133 CreateWebActionTrigger(page, QWebEnginePage::Back);
134 CreateWebActionTrigger(page, QWebEnginePage::Reload);
135 CreateWebActionTrigger(page, QWebEnginePage::Stop);
136
137 if (auto oldPage = QWebEngineView::page()) {
138 oldPage->disconnect(this);
139 }
140 QWebEngineView::setPage(page);
141 connect(page, &QWebEnginePage::linkHovered, this, &CFrmWebView::sigLinkHovered);
142 connect(page, &QWebEnginePage::windowCloseRequested,
143 this, &CFrmWebView::sigCloseRequested);
144 connect(page, &QWebEnginePage::selectClientCertificate,
145 this, &CFrmWebView::slotSelectClientCertificate);
146 connect(page, &QWebEnginePage::authenticationRequired, this,
147 &CFrmWebView::slotAuthenticationRequired);
148 connect(page, &QWebEnginePage::proxyAuthenticationRequired, this,
149 &CFrmWebView::slotProxyAuthenticationRequired);
150 connect(page, &QWebEnginePage::fullScreenRequested, this,
151 &CFrmWebView::slotFullScreenRequested);
152 connect(page, &QWebEnginePage::registerProtocolHandlerRequested, this,
153 &CFrmWebView::handleRegisterProtocolHandlerRequested);
154 #if QT_VERSION >= QT_VERSION_CHECK(6, 8, 0)
155 connect(page, &QWebEnginePage::certificateError,
156 this, &CFrmWebView::slotCertificateError);
157 connect(page, &QWebEnginePage::permissionRequested, this,
158 &CFrmWebView::slotPermissionRequested);
159 #endif
160 #if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0)
161 connect(page, &QWebEnginePage::fileSystemAccessRequested, this,
162 &CFrmWebView::slotFileSystemAccessRequested);
163 #endif
164 #if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
165 connect(page, &QWebEnginePage::desktopMediaRequested, this,
166 &CFrmWebView::slotDesktopMediaRequest);
167 connect(page, &QWebEnginePage::webAuthUxRequested,
168 this, &CFrmWebView::slotWebAuthUxRequested);
169 #endif
170
171 Q_ASSERT(m_pBrowser);
172 if(m_pBrowser->m_pPara->GetAutoFillUserAndPassword()) {
173 if(!m_pWebChannel)
174 m_pWebChannel = new QWebChannel(this);
175 if(!m_pPasswordStore)
176 m_pPasswordStore = new CPasswordStore(m_pBrowser->m_pPara, this);
177 if(m_pWebChannel && m_pPasswordStore) {
178 // 创建并注册 QWebChannel 对象,暴露 passwordStore 给 JS
179 m_pWebChannel->registerObject(QStringLiteral("PasswordManager"), m_pPasswordStore);
180 page->setWebChannel(m_pWebChannel);
181 InjectScriptQWebChannel();
182 } else
183 qCritical(log) << "Don't register PasswordManager";
184 }
185}
186

Callers 2

CFrmPopupMethod · 0.80
CreateWebViewMethod · 0.80

Calls 1

Tested by

no test coverage detected