diff --git a/python/core/qgsapplication.sip b/python/core/qgsapplication.sip index e685671b2b8..9b08c802a1f 100644 --- a/python/core/qgsapplication.sip +++ b/python/core/qgsapplication.sip @@ -437,13 +437,6 @@ static void qtgui_UpdatePyArgv(PyObject *argvlist, int argc, char **argv) */ static QgsMessageLog* messageLog(); - /** - * Returns the application's help viewer, used for displaying - * help topic for the given key - * @note added in QGIS 3.0 - */ - static QgsHelp* helpViewer(); - %If(ANDROID) //dummy method to workaround sip generation issue issue bool x11EventFilter ( XEvent * event ); diff --git a/python/core/qgshelp.sip b/python/core/qgshelp.sip index f7311f22f18..7c2429bfd39 100644 --- a/python/core/qgshelp.sip +++ b/python/core/qgshelp.sip @@ -14,12 +14,9 @@ * If no help found, default error page with information how to setup * help system will be shown. * - * This class can be created directly, or accessed via - * QgsApplication::helpViewer(). - * * @note added in QGIS 3.0 */ -class QgsHelp : QObject +class QgsHelp { %TypeHeaderCode #include @@ -27,24 +24,17 @@ class QgsHelp : QObject public: - /** Constructor for QgsHelp. - * @param parent parent QObject - */ - QgsHelp( QObject* parent = nullptr ); - - virtual ~QgsHelp(); - /** Opens help topic for the given help key using default system * web browser. If help topic not found, builtin error page shown. * @param key key which identified help topic * @note added in QGIS 3.0 */ - void openHelp( const QString& key ) const; + static void openHelp( const QString& key ); /** Returns URI of the help topic for the given key. If help topic * not found, URI of the builtin error page returned. * @param key key which identified help topic * @note added in QGIS 3.0 */ - QUrl helpUrl( const QString& key ) const; + static QUrl helpUrl( const QString& key ); }; diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index bcf06ac5a03..6bee1c30e05 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -482,7 +482,6 @@ SET(QGIS_CORE_MOC_HDRS qgsgeometryvalidator.h qgsgml.h qgsgmlschema.h - qgshelp.h qgsmaplayer.h qgsmaplayerlegend.h qgsmaplayermodel.h @@ -675,6 +674,7 @@ SET(QGIS_CORE_HDRS qgsfields.h qgsfontutils.h qgsgeometrycache.h + qgshelp.h qgshistogram.h qgsindexedfeature.h qgsinterval.h diff --git a/src/core/qgsapplication.cpp b/src/core/qgsapplication.cpp index 715783b6dc5..62eb247379d 100644 --- a/src/core/qgsapplication.cpp +++ b/src/core/qgsapplication.cpp @@ -36,7 +36,6 @@ #include "gps/qgsgpsconnectionregistry.h" #include "qgspluginlayerregistry.h" #include "qgsmessagelog.h" -#include "qgshelp.h" #include #include @@ -147,7 +146,6 @@ QgsApplication::QgsApplication( int & argc, char ** argv, bool GUIenabled, const mRasterRendererRegistry = new QgsRasterRendererRegistry(); mGpsConnectionRegistry = new QgsGPSConnectionRegistry(); mPluginLayerRegistry = new QgsPluginLayerRegistry(); - mHelpViewer = new QgsHelp(); init( customConfigPath ); // init can also be called directly by e.g. unit tests that don't inherit QApplication. } @@ -293,7 +291,6 @@ QgsApplication::~QgsApplication() delete mDataItemProviderRegistry; delete mProfiler; delete mMessageLog; - delete mHelpViewer; } QgsApplication* QgsApplication::instance() @@ -1600,8 +1597,3 @@ QgsFieldFormatterRegistry* QgsApplication::fieldFormatterRegistry() { return instance()->mFieldFormatterRegistry; } - -QgsHelp* QgsApplication::helpViewer() -{ - return instance()->mHelpViewer; -} diff --git a/src/core/qgsapplication.h b/src/core/qgsapplication.h index 1644c9946ba..0b16268a06d 100644 --- a/src/core/qgsapplication.h +++ b/src/core/qgsapplication.h @@ -37,7 +37,6 @@ class QgsGPSConnectionRegistry; class QgsDataItemProviderRegistry; class QgsPluginLayerRegistry; class QgsMessageLog; -class QgsHelp; /** \ingroup core * Extends QApplication to provide access to QGIS specific resources such @@ -450,15 +449,6 @@ class CORE_EXPORT QgsApplication : public QApplication */ static QgsMessageLog* messageLog(); - /** - * Returns the application's help viewer, used for displaying - * help topic for the given key - * @note added in QGIS 3.0 - */ - static QgsHelp* helpViewer(); - - - #ifdef ANDROID //dummy method to workaround sip generation issue issue bool x11EventFilter( XEvent * event ) @@ -592,7 +582,6 @@ class CORE_EXPORT QgsApplication : public QApplication QgsActionScopeRegistry* mActionScopeRegistry; QgsRuntimeProfiler* mProfiler; QgsTaskManager* mTaskManager; - QgsHelp* mHelpViewer; QgsFieldFormatterRegistry* mFieldFormatterRegistry; QgsColorSchemeRegistry* mColorSchemeRegistry; QgsPaintEffectRegistry* mPaintEffectRegistry; diff --git a/src/core/qgshelp.cpp b/src/core/qgshelp.cpp index c912e3af0d6..38ef26412d1 100644 --- a/src/core/qgshelp.cpp +++ b/src/core/qgshelp.cpp @@ -25,21 +25,12 @@ #include "qgis.h" #include "qgsapplication.h" -QgsHelp::QgsHelp( QObject* parent ) - : QObject( parent ) +void QgsHelp::openHelp( const QString& key ) { + QDesktopServices::openUrl( QgsHelp::helpUrl( key ) ); } -QgsHelp::~QgsHelp() -{ -} - -void QgsHelp::openHelp( const QString& key ) const -{ - QDesktopServices::openUrl( helpUrl( key ) ); -} - -QUrl QgsHelp::helpUrl( const QString& key ) const +QUrl QgsHelp::helpUrl( const QString& key ) { QUrl helpNotFound = QUrl::fromLocalFile( QgsApplication::pkgDataPath() + "/doc/nohelp.html" ); @@ -84,7 +75,7 @@ QUrl QgsHelp::helpUrl( const QString& key ) const if ( path.startsWith( QStringLiteral( "http://" ) ) ) { - if ( !urlExists( helpPath ) ) + if ( !QgsHelp::urlExists( helpPath ) ) { continue; } @@ -108,7 +99,7 @@ QUrl QgsHelp::helpUrl( const QString& key ) const return helpFound ? helpUrl : helpNotFound; } -bool QgsHelp::urlExists( const QString& url ) const +bool QgsHelp::urlExists( const QString& url ) { QUrl helpUrl( url ); QTcpSocket socket; diff --git a/src/core/qgshelp.h b/src/core/qgshelp.h index b8374fd1794..9c4441ca089 100644 --- a/src/core/qgshelp.h +++ b/src/core/qgshelp.h @@ -16,7 +16,7 @@ #ifndef QGSHELP_H #define QGSHELP_H -#include +#include /** \ingroup core * \class QgsHelp @@ -34,37 +34,25 @@ * If no help found, default error page with information how to setup * help system will be shown. * - * This class can be created directly, or accessed via - * QgsApplication::helpViewer(). - * * @note added in QGIS 3.0 */ -class CORE_EXPORT QgsHelp : public QObject +class CORE_EXPORT QgsHelp { - Q_OBJECT - public: - /** Constructor for QgsHelp. - * @param parent parent QObject - */ - QgsHelp( QObject* parent = nullptr ); - - virtual ~QgsHelp(); - /** Opens help topic for the given help key using default system * web browser. If help topic not found, builtin error page shown. * @param key key which identified help topic * @note added in QGIS 3.0 */ - void openHelp( const QString& key ) const; + static void openHelp( const QString& key ); /** Returns URI of the help topic for the given key. If help topic * not found, URI of the builtin error page returned. * @param key key which identified help topic * @note added in QGIS 3.0 */ - QUrl helpUrl( const QString& key ) const; + static QUrl helpUrl( const QString& key ); private: @@ -73,7 +61,7 @@ class CORE_EXPORT QgsHelp : public QObject * @param url URL to check * @note added in QGIS 3.0 */ - bool urlExists( const QString& url ) const; + static bool urlExists( const QString& url ); }; #endif // QGSHELP_H