From b8bd03c5d64ddb38956dbf967b8dab9c8212b34e Mon Sep 17 00:00:00 2001 From: Yoann Quenach de Quivillic Date: Mon, 7 Oct 2024 09:38:17 +0200 Subject: [PATCH] Fix build --- .../documentation/qgsdocumentationpanelwidget.cpp | 6 +++--- src/core/qgswebview.h | 5 +++++ src/gui/codeeditors/qgscodeeditorpython.cpp | 14 +++++++------- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/app/devtools/documentation/qgsdocumentationpanelwidget.cpp b/src/app/devtools/documentation/qgsdocumentationpanelwidget.cpp index b050f37c2fa5..81cefc3c92e3 100644 --- a/src/app/devtools/documentation/qgsdocumentationpanelwidget.cpp +++ b/src/app/devtools/documentation/qgsdocumentationpanelwidget.cpp @@ -27,9 +27,9 @@ QgsDocumentationPanelWidget::QgsDocumentationPanelWidget( QWidget *parent ) { setupUi( this ); - connect( mPythonHomeButton, &QToolButton::clicked, this, [this] {QgisApp::instance()->showApiDocumentation( QStringLiteral( "pyqgis" ), true );} ); - connect( mCppHomeButton, &QToolButton::clicked, this, [this] {QgisApp::instance()->showApiDocumentation( QStringLiteral( "qgis" ), true );} ); - connect( mQtHomeButton, &QToolButton::clicked, this, [this] {QgisApp::instance()->showApiDocumentation( QStringLiteral( "qt" ), true );} ); + connect( mPythonHomeButton, &QToolButton::clicked, this, [] {QgisApp::instance()->showApiDocumentation( QStringLiteral( "pyqgis" ), true );} ); + connect( mCppHomeButton, &QToolButton::clicked, this, [] {QgisApp::instance()->showApiDocumentation( QStringLiteral( "qgis" ), true );} ); + connect( mQtHomeButton, &QToolButton::clicked, this, [] {QgisApp::instance()->showApiDocumentation( QStringLiteral( "qt" ), true );} ); connect( mOpenUrlButton, &QToolButton::clicked, this, [this] {QgisApp::instance()->openURL( mWebView->url().toString(), false );} ); } diff --git a/src/core/qgswebview.h b/src/core/qgswebview.h index ce98e823e891..cdfdc5454e31 100644 --- a/src/core/qgswebview.h +++ b/src/core/qgswebview.h @@ -93,6 +93,11 @@ class CORE_EXPORT QgsWebView : public QTextBrowser setSource( url ); } + QUrl url() const + { + return source(); + } + QWebPage *page() const { return mPage; diff --git a/src/gui/codeeditors/qgscodeeditorpython.cpp b/src/gui/codeeditors/qgscodeeditorpython.cpp index 07d7a5273daf..17e7bb57c842 100644 --- a/src/gui/codeeditors/qgscodeeditorpython.cpp +++ b/src/gui/codeeditors/qgscodeeditorpython.cpp @@ -532,11 +532,6 @@ void QgsCodeEditorPython::populateContextMenu( QMenu *menu ) { QgsCodeEditor::populateContextMenu( menu ); - QAction *pyQgisHelpAction = new QAction( - QgsApplication::getThemeIcon( QStringLiteral( "console/iconHelpConsole.svg" ) ), - tr( "Search Selection in PyQGIS Documentation" ), - menu ); - QString text = selectedText(); if ( text.isEmpty() ) { @@ -547,6 +542,11 @@ void QgsCodeEditorPython::populateContextMenu( QMenu *menu ) return; } + QAction *pyQgisHelpAction = new QAction( + QgsApplication::getThemeIcon( QStringLiteral( "console/iconHelpConsole.svg" ) ), + tr( "Search Selection in PyQGIS Documentation" ), + menu ); + pyQgisHelpAction->setEnabled( hasSelectedText() ); pyQgisHelpAction->setShortcut( QStringLiteral( "F1" ) ); connect( pyQgisHelpAction, &QAction::triggered, this, [text, this] {showApiDocumentation( text );} ); @@ -759,14 +759,14 @@ void QgsCodeEditorPython::showApiDocumentation( const QString &text ) QString baseUrl = settings.value( QStringLiteral( "qgis/QgisApiUrl" ), QString( "https://qgis.org/api/%1" ).arg( qgisVersion ) ).toString(); - QDesktopServices::openUrl( QUrl( QString( "%1/class%2.html" ).arg( qgisVersion, searchText ) ) ); + QDesktopServices::openUrl( QUrl( QString( "%1/class%2.html" ).arg( baseUrl, searchText ) ) ); return; } } else if ( qtExpression.match( searchText ).hasMatch() ) { QString baseUrl = QString( "https://doc.qt.io/qt-%1" ).arg( qtVersion ); - QDesktopServices::openUrl( QUrl( QStringLiteral( "https://doc.qt.io/qt-5/%1.html" ).arg( searchText.toLower() ) ) ); + QDesktopServices::openUrl( QUrl( QStringLiteral( "%1/%2.html" ).arg( baseUrl, searchText.toLower() ) ) ); return; } QDesktopServices::openUrl( QUrl( QStringLiteral( "https://qgis.org/pyqgis/%1/search.html?q=%2" ).arg( qgisVersion, searchText ) ) );