Skip to content

Commit

Permalink
Fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
YoannQDQ committed Nov 4, 2024
1 parent d725d0f commit 3d7ecb8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 );} );

}
Expand Down
5 changes: 5 additions & 0 deletions src/core/qgswebview.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ class CORE_EXPORT QgsWebView : public QTextBrowser
setSource( url );
}

QUrl url() const
{
return source();
}

QWebPage *page() const
{
return mPage;
Expand Down
14 changes: 7 additions & 7 deletions src/gui/codeeditors/qgscodeeditorpython.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -521,11 +521,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() )
{
Expand All @@ -536,6 +531,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 );} );
Expand Down Expand Up @@ -748,14 +748,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 ) ) );
Expand Down

0 comments on commit 3d7ecb8

Please sign in to comment.