| 282 | } |
| 283 | |
| 284 | void BrowserWindow::handleDevToolsRequested(QWebEnginePage *source) |
| 285 | { |
| 286 | // use same mechanism as for the widget apps |
| 287 | if (m_inspectorWindow) |
| 288 | { |
| 289 | QWebEngineView *inspector = qobject_cast<QWebEngineView*>(m_inspectorWindow->centralWidget()); |
| 290 | |
| 291 | if (inspector && inspector->page()->inspectedPage() != source) { |
| 292 | source->setDevToolsPage(inspector->page()); |
| 293 | } |
| 294 | |
| 295 | m_inspectorWindow->activateWindow(); |
| 296 | } |
| 297 | else |
| 298 | { |
| 299 | QRect controlGeometry = UBApplication::displayManager->screenGeometry(ScreenRole::Control); |
| 300 | QRect inspectorGeometry(controlGeometry.left() + 50, controlGeometry.top() + 50, controlGeometry.width() / 2, controlGeometry.height() / 2); |
| 301 | |
| 302 | m_inspectorWindow = new QMainWindow(); |
| 303 | m_inspectorWindow->setAttribute(Qt::WA_DeleteOnClose, true); |
| 304 | m_inspectorWindow->setFocusPolicy(Qt::ClickFocus); |
| 305 | |
| 306 | QWebEngineView *inspector = new QWebEngineView(); |
| 307 | m_inspectorWindow->setCentralWidget(inspector); |
| 308 | m_inspectorWindow->setGeometry(inspectorGeometry); |
| 309 | m_inspectorWindow->show(); |
| 310 | |
| 311 | source->setDevToolsPage(inspector->page()); |
| 312 | source->triggerAction(QWebEnginePage::InspectElement); |
| 313 | |
| 314 | connect(m_inspectorWindow, &QObject::destroyed, this, [this](){ |
| 315 | m_inspectorWindow = nullptr; |
| 316 | }); |
| 317 | } |
| 318 | } |
| 319 | |
| 320 | void BrowserWindow::handleTabClosing(WebView* webView) |
| 321 | { |
nothing calls this directly
no test coverage detected