More raster maptips work

It should actually be moved to a generic maplayer implementation.
This commit is contained in:
Alessandro Pasotti 2022-10-27 10:40:15 +02:00
parent b37f5f4b03
commit 25e94fa52d
3 changed files with 72 additions and 0 deletions

View File

@ -448,6 +448,24 @@ to be drawn outside the data extent.
virtual QgsMapLayerElevationProperties *elevationProperties();
QString mapTipTemplate() const;
%Docstring
The mapTip is a pretty, html representation for feature information.
It may also contain embedded expressions.
.. versionadded:: 3.30
%End
void setMapTipTemplate( const QString &mapTip );
%Docstring
The mapTip is a pretty, html representation for feature information.
It may also contain embedded expressions.
.. versionadded:: 3.30
%End
public slots:
void showStatusMessage( const QString &message );
@ -467,6 +485,14 @@ Emitted when the layer's subset string has changed.
.. versionadded:: 3.12
%End
void mapTipTemplateChanged();
%Docstring
Emitted when the map tip changes
.. versionadded:: 3.30
%End
protected:
virtual bool readSymbology( const QDomNode &node, QString &errorMessage, QgsReadWriteContext &context, QgsMapLayer::StyleCategories categories = QgsMapLayer::AllStyleCategories );

View File

@ -1213,6 +1213,21 @@ QgsMapLayerElevationProperties *QgsRasterLayer::elevationProperties()
return mElevationProperties;
}
QString QgsRasterLayer::mapTipTemplate() const
{
return mMapTipTemplate;
}
void QgsRasterLayer::setMapTipTemplate( const QString &mapTip )
{
if ( mMapTipTemplate == mapTip )
return;
mMapTipTemplate = mapTip;
emit mapTipTemplateChanged();
}
void QgsRasterLayer::setContrastEnhancement( QgsContrastEnhancement::ContrastEnhancementAlgorithm algorithm, QgsRasterMinMaxOrigin::Limits limits, const QgsRectangle &extent, int sampleSize, bool generateLookupTableFlag )
{
setContrastEnhancement( algorithm,

View File

@ -76,6 +76,9 @@ typedef QList < QPair< QString, QColor > > QgsLegendColorList;
class CORE_EXPORT QgsRasterLayer : public QgsMapLayer, public QgsAbstractProfileSource
{
Q_OBJECT
Q_PROPERTY( QString mapTipTemplate READ mapTipTemplate WRITE setMapTipTemplate NOTIFY mapTipTemplateChanged )
public:
//! \brief Default sample size (number of pixels) for estimated statistics/histogram calculation
@ -491,6 +494,24 @@ class CORE_EXPORT QgsRasterLayer : public QgsMapLayer, public QgsAbstractProfile
QgsMapLayerTemporalProperties *temporalProperties() override;
QgsMapLayerElevationProperties *elevationProperties() override;
/**
* The mapTip is a pretty, html representation for feature information.
*
* It may also contain embedded expressions.
*
* \since QGIS 3.30
*/
QString mapTipTemplate() const;
/**
* The mapTip is a pretty, html representation for feature information.
*
* It may also contain embedded expressions.
*
* \since QGIS 3.30
*/
void setMapTipTemplate( const QString &mapTip );
public slots:
void showStatusMessage( const QString &message );
@ -509,6 +530,14 @@ class CORE_EXPORT QgsRasterLayer : public QgsMapLayer, public QgsAbstractProfile
*/
void subsetStringChanged();
/**
* Emitted when the map tip changes
*
* \since QGIS 3.30
*/
void mapTipTemplateChanged();
protected:
bool readSymbology( const QDomNode &node, QString &errorMessage, QgsReadWriteContext &context, QgsMapLayer::StyleCategories categories = QgsMapLayer::AllStyleCategories ) override;
@ -608,6 +637,8 @@ class CORE_EXPORT QgsRasterLayer : public QgsMapLayer, public QgsAbstractProfile
QDomDocument mOriginalStyleDocument;
QDomElement mOriginalStyleElement;
QString mMapTipTemplate;
};
// clazy:excludeall=qstring-allocations