mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 23:34:06 +00:00
Merge remote-tracking branch 'origin/feature/optimize-F12' into staged
This commit is contained in:
commit
69f7627668
|
@ -321,15 +321,8 @@ ArticleView::ArticleView( QWidget * parent, ArticleNetworkAccessManager & nm, Au
|
|||
inspectAction.setText( tr( "Inspect" ) );
|
||||
ui.definition->addAction( &inspectAction );
|
||||
|
||||
QWebEnginePage *page = ui.definition->page();
|
||||
connect(&inspectAction, &QAction::triggered, this, [page, this]() {
|
||||
if (inspectView == nullptr || !inspectView->isVisible()) {
|
||||
inspectView = new QWebEngineView();
|
||||
page->setDevToolsPage(inspectView->page());
|
||||
page->triggerAction(QWebEnginePage::InspectElement);
|
||||
inspectView->show();
|
||||
}
|
||||
});
|
||||
|
||||
connect(&inspectAction, &QAction::triggered, this, &ArticleView::inspectElement);
|
||||
|
||||
ui.definition->installEventFilter( this );
|
||||
ui.searchFrame->installEventFilter( this );
|
||||
|
@ -512,6 +505,27 @@ void ArticleView::showAnticipation()
|
|||
ui.definition->setCursor( Qt::WaitCursor );
|
||||
}
|
||||
|
||||
void ArticleView::inspectElement(){
|
||||
QWebEnginePage *page = ui.definition->page();
|
||||
if (inspectView == nullptr) {
|
||||
inspectView = new QWebEngineView();
|
||||
page->setDevToolsPage( inspectView->page() );
|
||||
devDialog = new QDialog( this );
|
||||
devDialog->setWindowTitle( tr( "Inspect" ) );
|
||||
devDialog->setWindowFlags( Qt::Window );
|
||||
devDialog->setContentsMargins( 0, 0, 0, 0 );
|
||||
devDialog->setAttribute( Qt::WidgetAttribute::WA_DeleteOnClose, false );
|
||||
QVBoxLayout * v=new QVBoxLayout( devDialog );
|
||||
// devDialog->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
|
||||
// inspectView->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
// inspectView->setContentsMargins(0,0,0,0);
|
||||
v->addWidget( inspectView );
|
||||
}
|
||||
page->triggerAction( QWebEnginePage::InspectElement );
|
||||
devDialog->raise();
|
||||
devDialog->show();
|
||||
}
|
||||
|
||||
void ArticleView::loadFinished( bool result )
|
||||
{
|
||||
setZoomFactor(cfg.preferences.zoomFactor);
|
||||
|
|
|
@ -46,6 +46,7 @@ class ArticleView: public QFrame
|
|||
|
||||
//used to hold the F12 inspect source view.
|
||||
QWebEngineView *inspectView = nullptr;
|
||||
QDialog * devDialog = nullptr;
|
||||
|
||||
/// Any resource we've decided to download off the dictionary gets stored here.
|
||||
/// Full vector capacity is used for search requests, where we have to make
|
||||
|
@ -303,7 +304,7 @@ public slots:
|
|||
//aim to receive signal from html. the fragment url click to navigation through page wil not be intecepted by weburlinteceptor
|
||||
Q_INVOKABLE void linkClickedInHtml( QUrl const & );
|
||||
private slots:
|
||||
|
||||
void inspectElement();
|
||||
void loadFinished( bool ok );
|
||||
void loadProgress(int);
|
||||
void handleTitleChanged( QString const & title );
|
||||
|
|
Loading…
Reference in a new issue