mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-30 17:24:08 +00:00
fix:inspect windows on qt6 can not work with right context menu
This commit is contained in:
parent
4e4c9375be
commit
4a3905c701
|
@ -3,7 +3,7 @@
|
||||||
#if (QT_VERSION > QT_VERSION_CHECK(6,0,0))
|
#if (QT_VERSION > QT_VERSION_CHECK(6,0,0))
|
||||||
#include <QWebEngineContextMenuRequest>
|
#include <QWebEngineContextMenuRequest>
|
||||||
#endif
|
#endif
|
||||||
ArticleInspector::ArticleInspector( QWidget * parent ) : QWidget( parent, Qt::WindowType::Window ),firstTimeOpened(false)
|
ArticleInspector::ArticleInspector( QWidget * parent ) : QWidget( parent, Qt::WindowType::Window )
|
||||||
{
|
{
|
||||||
setWindowTitle(tr("Inspect"));
|
setWindowTitle(tr("Inspect"));
|
||||||
setAttribute( Qt::WidgetAttribute::WA_DeleteOnClose, false );
|
setAttribute( Qt::WidgetAttribute::WA_DeleteOnClose, false );
|
||||||
|
@ -22,14 +22,12 @@ void ArticleInspector::setInspectPage( QWebEngineView * view )
|
||||||
viewContainer->page()->setInspectedPage(page);
|
viewContainer->page()->setInspectedPage(page);
|
||||||
#if( QT_VERSION > QT_VERSION_CHECK( 6, 0, 0 ) )
|
#if( QT_VERSION > QT_VERSION_CHECK( 6, 0, 0 ) )
|
||||||
// without this line, application will crash on qt6.2 ,see https://bugreports.qt.io/browse/QTBUG-101724
|
// without this line, application will crash on qt6.2 ,see https://bugreports.qt.io/browse/QTBUG-101724
|
||||||
if( view->lastContextMenuRequest() && firstTimeOpened )
|
// and seems to hangup forever on qt6.3 ,so the best solution for now is to comment out the following lines.
|
||||||
{
|
|
||||||
page->triggerAction( QWebEnginePage::InspectElement );
|
// if( view->lastContextMenuRequest())
|
||||||
}
|
// {
|
||||||
if( !firstTimeOpened )
|
// page->triggerAction( QWebEnginePage::InspectElement );
|
||||||
{
|
// }
|
||||||
firstTimeOpened = true;
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
page->triggerAction( QWebEnginePage::InspectElement );
|
page->triggerAction( QWebEnginePage::InspectElement );
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -15,9 +15,7 @@ public:
|
||||||
|
|
||||||
void setInspectPage( QWebEngineView * view);
|
void setInspectPage( QWebEngineView * view);
|
||||||
private:
|
private:
|
||||||
//used to record if the devtool was first time opened.
|
|
||||||
//if right click on the webpage and open inspect page on the first time ,the application has great possiblity to hang forever.
|
|
||||||
bool firstTimeOpened;
|
|
||||||
virtual void closeEvent( QCloseEvent * );
|
virtual void closeEvent( QCloseEvent * );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue