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

Method SetConnect

Plugins/WebBrowser/FrmWebBrowser.cpp:349–452  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

347}
348
349void CFrmWebBrowser::SetConnect(CFrmWebView* pWeb)
350{
351 bool check = false;
352 if(!pWeb) return;
353 check = connect(pWeb, &CFrmWebView::sigDevToolsRequested,
354 this, [&](){
355 if(m_pInspector)
356 m_pInspector->setChecked(true);
357 });
358 Q_ASSERT(check);
359 check = connect(pWeb, &CFrmWebView::sigWebActionEnabledChanged,
360 this, [this, pWeb](QWebEnginePage::WebAction webAction, bool enabled){
361 if(!IsCurrentView(pWeb)) return;
362 switch(webAction){
363 case QWebEnginePage::WebAction::Back:
364 m_pBack->setEnabled(enabled);
365 break;
366 case QWebEnginePage::WebAction::Forward:
367 m_pForward->setEnabled(enabled);
368 break;
369 case QWebEnginePage::WebAction::Reload: {
370 m_pRefresh->setEnabled(enabled);
371 if(m_pRefresh->isEnabled())
372 m_pToolBar->insertAction(m_pUrl, m_pRefresh);
373 else
374 m_pToolBar->removeAction(m_pRefresh);
375 break;
376 }
377 case QWebEnginePage::WebAction::Stop: {
378 m_pStop->setEnabled(enabled);
379 if(m_pStop->isEnabled())
380 m_pToolBar->insertAction(m_pUrl, m_pStop);
381 else
382 m_pToolBar->removeAction(m_pStop);
383 break;
384 }
385 default:
386 break;
387 }
388 });
389 check = connect(pWeb, &QWebEngineView::urlChanged,
390 this, [&](const QUrl &url) {
391 CFrmWebView* pWeb = qobject_cast<CFrmWebView*>(sender());
392 if(IsCurrentView(pWeb))
393 m_pUrlLineEdit->setText(url.toString());
394 if(m_pPara) {
395 m_pPara->m_HistoryDatabase.addHistoryEntry(url.toString());
396 }
397 });
398 Q_ASSERT(check);
399 check = connect(pWeb, &CFrmWebView::titleChanged,
400 this, [&](const QString &title) {
401 CFrmWebView* pWeb = qobject_cast<CFrmWebView*>(sender());
402 int index = IndexOfTab(pWeb);
403 if(-1 < index) {
404 if(m_pTab)
405 m_pTab->setTabText(index, title);
406 setWindowTitle(title);

Callers

nothing calls this directly

Calls 4

addHistoryEntryMethod · 0.80
updateHistoryEntryMethod · 0.80
urlMethod · 0.80
progressMethod · 0.80

Tested by

no test coverage detected