Skip to content

Commit

Permalink
qt6.2 qt5.15 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoyifang committed Mar 26, 2022
1 parent 63a4d64 commit 65c78be
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions article_inspect.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#include "article_inspect.h"
#include <QCloseEvent>
#if (QT_VERSION > QT_VERSION_CHECK(6,0,0))
#include <QWebEngineContextMenuRequest>
#endif
ArticleInspector::ArticleInspector( QWidget * parent ) : QDialog( parent, Qt::WindowType::Window )
{
setAttribute( Qt::WidgetAttribute::WA_DeleteOnClose, false );
Expand All @@ -16,11 +18,15 @@ void ArticleInspector::setInspectPage( QWebEngineView * view )
auto page=view->page();
this->inspectedPage = page;
page->setDevToolsPage( inspectView->page() );
#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
if( view->lastContextMenuRequest() )
{
page->triggerAction( QWebEnginePage::InspectElement );
}
#else
page->triggerAction( QWebEnginePage::InspectElement );
#endif
raise();
show();
}
Expand Down

0 comments on commit 65c78be

Please sign in to comment.