17#include "moc_qgsrasterlabelingwidget.cpp" 
   28  , mMessageBar( messageBar )
 
   33  mLabelModeComboBox->addItem( 
QgsApplication::getThemeIcon( QStringLiteral( 
"labelingNone.svg" ) ), tr( 
"No Labels" ), QStringLiteral( 
"none" ) );
 
   34  mLabelModeComboBox->addItem( 
QgsApplication::getThemeIcon( QStringLiteral( 
"labelingSingle.svg" ) ), tr( 
"Label with Pixel Values" ), QStringLiteral( 
"simple" ) );
 
   36  connect( mLabelModeComboBox, qOverload<int>( &QComboBox::currentIndexChanged ), 
this, &QgsRasterLabelingWidget::labelModeChanged );
 
   39  connect( mLabelRulesButton, &QAbstractButton::clicked, 
this, &QgsRasterLabelingWidget::showLabelingEngineRulesPrivate );
 
   40  connect( mEngineSettingsButton, &QAbstractButton::clicked, 
this, &QgsRasterLabelingWidget::showEngineConfigDialogPrivate );
 
   43  mEngineSettingsButton->setIconSize( QSize( iconSize16, iconSize16 ) );
 
   44  mLabelRulesButton->setIconSize( QSize( iconSize16, iconSize16 ) );
 
 
   69  QgsRasterLayer *layer = qobject_cast<QgsRasterLayer *>( mapLayer );
 
 
   84    index = mLabelModeComboBox->findData( labeling->
type() );
 
   87      settingsWidget->setLayer( mLayer );
 
   88      settingsWidget->setLabeling( labeling );
 
   96  if ( index != mLabelModeComboBox->currentIndex() )
 
   98    mLabelModeComboBox->setCurrentIndex( index );
 
 
  104  const QString mode = mLabelModeComboBox->currentData().toString();
 
  105  if ( mode == QLatin1String( 
"simple" ) )
 
  107    auto labeling = std::make_unique<QgsRasterLayerSimpleLabeling>();
 
  110      settingsWidget->updateLabeling( labeling.get() );
 
 
  129void QgsRasterLabelingWidget::labelModeChanged( 
int index )
 
  132    mStackedWidget->removeWidget( mWidget );
 
  140  const QString mode = mLabelModeComboBox->currentData().toString();
 
  141  if ( mode == QLatin1String( 
"simple" ) )
 
  148    settingsWidget->layout()->setContentsMargins( 0, 0, 0, 0 );
 
  149    settingsWidget->setContext( context );
 
  151    settingsWidget->setDockMode( 
dockMode() );
 
  154    mWidget = settingsWidget;
 
  157      auto labeling = std::make_unique<QgsRasterLayerSimpleLabeling>();
 
  166    mStackedWidget->addWidget( mWidget );
 
  167    mStackedWidget->setCurrentWidget( mWidget );
 
  173void QgsRasterLabelingWidget::showLabelingEngineRulesPrivate()
 
  178void QgsRasterLabelingWidget::showEngineConfigDialogPrivate()
 
Abstract base class for labeling settings for raster layers.
 
virtual QString type() const =0
Unique type string of the labeling configuration implementation.
 
static QIcon getThemeIcon(const QString &name, const QColor &fillColor=QColor(), const QColor &strokeColor=QColor())
Helper to get a theme icon.
 
Map canvas is a class for displaying all GIS data types on a canvas.
 
Base class for all map layer types.
 
void triggerRepaint(bool deferredUpdate=false)
Will advise the map canvas (and any other interested party) that this layer requires to be repainted.
 
A bar for displaying non-blocking messages to the user.
 
static QgsProject * instance()
Returns the QgsProject singleton instance.
 
void setDirty(bool b=true)
Flag the project as dirty (modified).
 
Basic implementation of the labeling interface for raster layers.
 
Represents a raster layer.
 
const QgsAbstractRasterLayerLabeling * labeling() const
Access to const labeling configuration.
 
bool labelsEnabled() const
Returns whether the layer contains labels which are enabled and should be drawn.
 
void setLabeling(QgsAbstractRasterLayerLabeling *labeling)
Sets labeling configuration.
 
void setLabelsEnabled(bool enabled)
Sets whether labels should be enabled for the layer.
 
Contains settings which reflect the context in which a symbol (or renderer) widget is shown,...
 
void setMapCanvas(QgsMapCanvas *canvas)
Sets the map canvas associated with the widget.
 
void setMessageBar(QgsMessageBar *bar)
Sets the message bar associated with the widget.
 
int scaleIconSize(int standardSize)
Scales an icon size to compensate for display pixel density, making the icon size hi-dpi friendly,...