diff --git a/python/core/qgsproject.sip.in b/python/core/qgsproject.sip.in index a982b4ee5ea..eaddae81ca5 100644 --- a/python/core/qgsproject.sip.in +++ b/python/core/qgsproject.sip.in @@ -911,12 +911,18 @@ Emitted when a layer from a projects was read. %End void loadingLayer( const QString &layerName ); +%Docstring +Emitted when a layer is loaded +%End - void loadingLayerMessages( const QString &layerName, const QList &messages ); + void loadingLayerMessageReceived( const QString &layerName, const QList &messages ); %Docstring Emitted when loading layers has produced some messages -@param layerName the layer name -@param messages a list of pairs of Qgis.MessageLevel and messages + +:param layerName: the layer name +:param messages: a list of pairs of Qgis.MessageLevel and messages + +.. versionadded:: 3.2 %End void nonIdentifiableLayersChanged( QStringList nonIdentifiableLayers ); diff --git a/python/core/qgsreadwritecontext.sip.in b/python/core/qgsreadwritecontext.sip.in index 9af5a6ef46d..52e39505331 100644 --- a/python/core/qgsreadwritecontext.sip.in +++ b/python/core/qgsreadwritecontext.sip.in @@ -24,7 +24,7 @@ The class is used as a container of context for various read/write operations on struct ReadWriteMessage { - ReadWriteMessage( const QString &message, Qgis::MessageLevel level = Qgis::Warning, QStringList categories = QStringList() ); + ReadWriteMessage( const QString &message, Qgis::MessageLevel level = Qgis::Warning, const QStringList &categories = QStringList() ); %Docstring Construct a container for QgsReadWriteContext error or warning messages %End @@ -65,7 +65,7 @@ Sets up path resolver for conversion between relative and absolute paths void pushMessage( const QString &message, Qgis::MessageLevel level ); %Docstring -append a message to the context +Append a message to the context .. versionadded:: 3.2 %End @@ -86,7 +86,7 @@ Pop the last category QList takeMessages(); %Docstring -return the stored messages and remove them +Return the stored messages and remove them .. versionadded:: 3.2 %End diff --git a/python/gui/qgsmessagebar.sip.in b/python/gui/qgsmessagebar.sip.in index 10dc98e19f3..882988471f2 100644 --- a/python/gui/qgsmessagebar.sip.in +++ b/python/gui/qgsmessagebar.sip.in @@ -83,8 +83,6 @@ convenience method for pushing a message with title to the bar convenience method for pushing a message to the bar with a detail text which be shown when pressing a "more" button %End - - QgsMessageBarItem *currentItem(); signals: diff --git a/src/app/qgisapp.cpp b/src/app/qgisapp.cpp index 573881b7ff0..b4a77297955 100644 --- a/src/app/qgisapp.cpp +++ b/src/app/qgisapp.cpp @@ -3230,7 +3230,7 @@ void QgisApp::setupConnections() this, &QgisApp::showProgress ); connect( QgsProject::instance(), &QgsProject::loadingLayer, this, &QgisApp::showStatusMessage ); - connect( QgsProject::instance(), &QgsProject::loadingLayerMessages, + connect( QgsProject::instance(), &QgsProject::loadingLayerMessageReceived, this, &QgisApp::loadingLayerMessages ); connect( QgsProject::instance(), &QgsProject::readProject, this, &QgisApp::readProject ); diff --git a/src/core/qgseditformconfig.cpp b/src/core/qgseditformconfig.cpp index 75874df5c23..bc70fc35425 100644 --- a/src/core/qgseditformconfig.cpp +++ b/src/core/qgseditformconfig.cpp @@ -260,7 +260,7 @@ void QgsEditFormConfig::setSuppress( QgsEditFormConfig::FeatureFormSuppress s ) void QgsEditFormConfig::readXml( const QDomNode &node, QgsReadWriteContext &context ) { - context.enterCategory( QString( "Edit form config" ) ); + context.enterCategory( QObject::tr( "Edit form config" ) ); d.detach(); QDomNode editFormNode = node.namedItem( QStringLiteral( "editform" ) ); diff --git a/src/core/qgsproject.cpp b/src/core/qgsproject.cpp index 0c1c55f9c21..8e2058a4be8 100644 --- a/src/core/qgsproject.cpp +++ b/src/core/qgsproject.cpp @@ -719,7 +719,7 @@ bool QgsProject::_getMapLayers( const QDomDocument &doc, QList &broken const auto messages = context.takeMessages(); if ( messages.count() ) { - emit loadingLayerMessages( tr( "Loading layer %1" ).arg( name ), messages ); + emit loadingLayerMessageReceived( tr( "Loading layer %1" ).arg( name ), messages ); } } emit layerLoaded( i + 1, nl.count() ); diff --git a/src/core/qgsproject.h b/src/core/qgsproject.h index a485f7e3413..1e2dd96ccea 100644 --- a/src/core/qgsproject.h +++ b/src/core/qgsproject.h @@ -888,14 +888,16 @@ class CORE_EXPORT QgsProject : public QObject, public QgsExpressionContextGenera */ void layerLoaded( int i, int n ); + //! Emitted when a layer is loaded void loadingLayer( const QString &layerName ); /** - * @brief Emitted when loading layers has produced some messages - * @param layerName the layer name - * @param messages a list of pairs of Qgis::MessageLevel and messages + * \brief Emitted when loading layers has produced some messages + * \param layerName the layer name + * \param messages a list of pairs of Qgis::MessageLevel and messages + * \since 3.2 */ - void loadingLayerMessages( const QString &layerName, const QList &messages ); + void loadingLayerMessageReceived( const QString &layerName, const QList &messages ); //! Emitted when the list of layer which are excluded from map identification changes void nonIdentifiableLayersChanged( QStringList nonIdentifiableLayers ); diff --git a/src/core/qgsreadwritecontext.h b/src/core/qgsreadwritecontext.h index 4c714780352..81496f570d6 100644 --- a/src/core/qgsreadwritecontext.h +++ b/src/core/qgsreadwritecontext.h @@ -38,7 +38,7 @@ class CORE_EXPORT QgsReadWriteContext struct ReadWriteMessage { //! Construct a container for QgsReadWriteContext error or warning messages - ReadWriteMessage( const QString &message, Qgis::MessageLevel level = Qgis::Warning, QStringList categories = QStringList() ) + ReadWriteMessage( const QString &message, Qgis::MessageLevel level = Qgis::Warning, const QStringList &categories = QStringList() ) : mMessage( message ) , mLevel( level ) , mCategories( categories ) @@ -54,9 +54,9 @@ class CORE_EXPORT QgsReadWriteContext QStringList categories() const {return mCategories;} private: - QString mMessage = QString(); - Qgis::MessageLevel mLevel = Qgis::Warning; - QStringList mCategories = QStringList(); + QString mMessage; + Qgis::MessageLevel mLevel; + QStringList mCategories; }; /** @@ -73,7 +73,7 @@ class CORE_EXPORT QgsReadWriteContext void setPathResolver( const QgsPathResolver &resolver ); /** - * append a message to the context + * Append a message to the context * \since QGIS 3.2 */ void pushMessage( const QString &message, Qgis::MessageLevel level ); @@ -91,7 +91,7 @@ class CORE_EXPORT QgsReadWriteContext void leaveCategory(); /** - * return the stored messages and remove them + * Return the stored messages and remove them * \since QGIS 3.2 */ QList takeMessages(); diff --git a/src/gui/qgsmessagebar.h b/src/gui/qgsmessagebar.h index f689e6dd2e7..7c93f476ca4 100644 --- a/src/gui/qgsmessagebar.h +++ b/src/gui/qgsmessagebar.h @@ -92,10 +92,6 @@ class GUI_EXPORT QgsMessageBar: public QFrame //! convenience method for pushing a message to the bar with a detail text which be shown when pressing a "more" button void pushMessage( const QString &title, const QString &text, const QString &showMore, Qgis::MessageLevel level = Qgis::Info, int duration = 5 ); -// //! make out a widget containing a message to be displayed on the bar with a detail text which be shown when pressing a "more" button -// QgsMessageBarItem( const QString &title, const QString &text, const QString &showMore, Qgis::MessageLevel level = Qgis::Info, int duration = 0, QWidget *parent SIP_TRANSFERTHIS = nullptr ); - - QgsMessageBarItem *currentItem() { return mCurrentItem; } signals: