mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-23 20:14:05 +00:00
inspect element crash on the first time
This commit is contained in:
parent
e4a083cccc
commit
ead9e6132f
|
@ -27,19 +27,27 @@ void ArticleInspector::setInspectPage( QWebEnginePage * page )
|
|||
return;
|
||||
}
|
||||
|
||||
qDebug() << page->lifecycleState();
|
||||
#if( QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) || QT_VERSION > QT_VERSION_CHECK(6,3,0) )
|
||||
page->triggerAction( QWebEnginePage::InspectElement );
|
||||
#else
|
||||
// without this line, application will crash on qt6.2 ,see https://bugreports.qt.io/browse/QTBUG-101724
|
||||
// and seems to hangup forever on qt6.3.0 ,so the best solution for now is to comment out the following lines.
|
||||
#endif
|
||||
|
||||
raise();
|
||||
show();
|
||||
qDebug() << "inspector finished";
|
||||
}
|
||||
|
||||
void ArticleInspector::triggerAction( QWebEnginePage * page )
|
||||
{
|
||||
if( !page )
|
||||
{
|
||||
qDebug() << "set inspected page to nullptr";
|
||||
return;
|
||||
}
|
||||
|
||||
setInspectPage(page);
|
||||
|
||||
#if( QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) || QT_VERSION > QT_VERSION_CHECK(6,3,0) )
|
||||
page->triggerAction( QWebEnginePage::InspectElement );
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void ArticleInspector::closeEvent( QCloseEvent * )
|
||||
{
|
||||
viewContainer->page()->setInspectedPage(nullptr);
|
||||
|
|
|
@ -14,6 +14,7 @@ public:
|
|||
ArticleInspector( QWidget * parent = nullptr );
|
||||
|
||||
void setInspectPage( QWebEnginePage * page);
|
||||
void triggerAction( QWebEnginePage * page );
|
||||
private:
|
||||
|
||||
virtual void closeEvent( QCloseEvent * );
|
||||
|
|
|
@ -1739,7 +1739,7 @@ ArticleView * MainWindow::createNewTab( bool switchToIt,
|
|||
|
||||
void MainWindow::inspectElement( QWebEnginePage * page )
|
||||
{
|
||||
inspector->setInspectPage( page );
|
||||
inspector->triggerAction( page );
|
||||
}
|
||||
|
||||
void MainWindow::tabCloseRequested( int x )
|
||||
|
|
Loading…
Reference in a new issue