30   connect( mRedMinLineEdit, &QLineEdit::textChanged, 
this, &QgsPointCloudRgbRendererWidget::mRedMinLineEdit_textChanged );
 
   31   connect( mRedMaxLineEdit, &QLineEdit::textChanged, 
this, &QgsPointCloudRgbRendererWidget::mRedMaxLineEdit_textChanged );
 
   32   connect( mGreenMinLineEdit, &QLineEdit::textChanged, 
this, &QgsPointCloudRgbRendererWidget::mGreenMinLineEdit_textChanged );
 
   33   connect( mGreenMaxLineEdit, &QLineEdit::textChanged, 
this, &QgsPointCloudRgbRendererWidget::mGreenMaxLineEdit_textChanged );
 
   34   connect( mBlueMinLineEdit, &QLineEdit::textChanged, 
this, &QgsPointCloudRgbRendererWidget::mBlueMinLineEdit_textChanged );
 
   35   connect( mBlueMaxLineEdit, &QLineEdit::textChanged, 
this, &QgsPointCloudRgbRendererWidget::mBlueMaxLineEdit_textChanged );
 
   38   mRedAttributeComboBox->setAllowEmptyAttributeName( 
true );
 
   39   mGreenAttributeComboBox->setAllowEmptyAttributeName( 
true );
 
   40   mBlueAttributeComboBox->setAllowEmptyAttributeName( 
true );
 
   50     mRedAttributeComboBox->setLayer( 
layer );
 
   51     mGreenAttributeComboBox->setLayer( 
layer );
 
   52     mBlueAttributeComboBox->setLayer( 
layer );
 
   58            this, &QgsPointCloudRgbRendererWidget::redAttributeChanged );
 
   60            this, &QgsPointCloudRgbRendererWidget::greenAttributeChanged );
 
   62            this, &QgsPointCloudRgbRendererWidget::blueAttributeChanged );
 
   63   connect( mContrastEnhancementAlgorithmComboBox, 
static_cast<void ( QComboBox::* )( 
int )
>( &QComboBox::currentIndexChanged ), 
this, &QgsPointCloudRgbRendererWidget::emitWidgetChanged );
 
   68     mBlockChangedSignal = 
true;
 
   69     redAttributeChanged();
 
   70     greenAttributeChanged();
 
   71     blueAttributeChanged();
 
   72     mBlockChangedSignal = 
false;
 
   79   return new QgsPointCloudRgbRendererWidget( layer, style );
 
   89   std::unique_ptr< QgsPointCloudRgbRenderer > renderer = std::make_unique< QgsPointCloudRgbRenderer >();
 
   90   renderer->setRedAttribute( mRedAttributeComboBox->currentAttribute() );
 
   91   renderer->setGreenAttribute( mGreenAttributeComboBox->currentAttribute() );
 
   92   renderer->setBlueAttribute( mBlueAttributeComboBox->currentAttribute() );
 
   94   setCustomMinMaxValues( renderer.get() );
 
   95   return renderer.release();
 
   98 void QgsPointCloudRgbRendererWidget::createValidators()
 
  115   if ( mContrastEnhancementAlgorithmComboBox->currentData().toInt() ==
 
  128   bool redMinOk, redMaxOk;
 
  131   if ( redMinOk && redMaxOk && !mRedAttributeComboBox->currentAttribute().isEmpty() )
 
  138   bool greenMinOk, greenMaxOk;
 
  141   if ( greenMinOk && greenMaxOk && !mGreenAttributeComboBox->currentAttribute().isEmpty() )
 
  148   bool blueMinOk, blueMaxOk;
 
  151   if ( blueMinOk && blueMaxOk && !mBlueAttributeComboBox->currentAttribute().isEmpty() )
 
  158   if ( redEnhancement )
 
  161           ( mContrastEnhancementAlgorithmComboBox->currentData().toInt() ) ) );
 
  163   if ( greenEnhancement )
 
  166           ( mContrastEnhancementAlgorithmComboBox->currentData().toInt() ) ) );
 
  168   if ( blueEnhancement )
 
  171           ( mContrastEnhancementAlgorithmComboBox->currentData().toInt() ) ) );
 
  178 void QgsPointCloudRgbRendererWidget::mRedMinLineEdit_textChanged( 
const QString & )
 
  183 void QgsPointCloudRgbRendererWidget::mRedMaxLineEdit_textChanged( 
const QString & )
 
  188 void QgsPointCloudRgbRendererWidget::mGreenMinLineEdit_textChanged( 
const QString & )
 
  193 void QgsPointCloudRgbRendererWidget::mGreenMaxLineEdit_textChanged( 
const QString & )
 
  198 void QgsPointCloudRgbRendererWidget::mBlueMinLineEdit_textChanged( 
const QString & )
 
  203 void QgsPointCloudRgbRendererWidget::mBlueMaxLineEdit_textChanged( 
const QString & )
 
  208 void QgsPointCloudRgbRendererWidget::emitWidgetChanged()
 
  210   if ( !mBlockChangedSignal )
 
  211     emit widgetChanged();
 
  214 void QgsPointCloudRgbRendererWidget::redAttributeChanged()
 
  216   if ( mLayer && mLayer->dataProvider() )
 
  219     const double max = stats.
maximum( mRedAttributeComboBox->currentAttribute() );
 
  220     if ( !std::isnan( max ) )
 
  222       mDisableMinMaxWidgetRefresh++;
 
  223       mRedMinLineEdit->setText( QLocale().toString( 0 ) );
 
  227       mRedMaxLineEdit->setText( QLocale().toString( max > 255 ? 65535 : 255 ) );
 
  228       mDisableMinMaxWidgetRefresh--;
 
  234 void QgsPointCloudRgbRendererWidget::greenAttributeChanged()
 
  236   if ( mLayer && mLayer->dataProvider() )
 
  239     const double max = stats.
maximum( mGreenAttributeComboBox->currentAttribute() );
 
  240     if ( !std::isnan( max ) )
 
  242       mDisableMinMaxWidgetRefresh++;
 
  243       mGreenMinLineEdit->setText( QLocale().toString( 0 ) );
 
  247       mGreenMaxLineEdit->setText( QLocale().toString( max > 255 ? 65535 : 255 ) );
 
  248       mDisableMinMaxWidgetRefresh--;
 
  254 void QgsPointCloudRgbRendererWidget::blueAttributeChanged()
 
  256   if ( mLayer && mLayer->dataProvider() )
 
  259     const double max = stats.
maximum( mBlueAttributeComboBox->currentAttribute() );
 
  260     if ( !std::isnan( max ) )
 
  262       mDisableMinMaxWidgetRefresh++;
 
  263       mBlueMinLineEdit->setText( QLocale().toString( 0 ) );
 
  267       mBlueMaxLineEdit->setText( QLocale().toString( max > 255 ? 65535 : 255 ) );
 
  268       mDisableMinMaxWidgetRefresh--;
 
  274 void QgsPointCloudRgbRendererWidget::minMaxModified()
 
  276   if ( !mDisableMinMaxWidgetRefresh )
 
  280       mContrastEnhancementAlgorithmComboBox->setCurrentIndex(
 
  287 void QgsPointCloudRgbRendererWidget::setMinMaxValue( 
const QgsContrastEnhancement *ce, QLineEdit *minEdit, QLineEdit *maxEdit )
 
  289   if ( !minEdit || !maxEdit )
 
  301   minEdit->setText( QLocale().toString( ce->
minimumValue() ) );
 
  302   maxEdit->setText( QLocale().toString( ce->
maximumValue() ) );
 
  306   mContrastEnhancementAlgorithmComboBox->setCurrentIndex( mContrastEnhancementAlgorithmComboBox->findData(
 
  312   mBlockChangedSignal = 
true;
 
  316     mRedAttributeComboBox->setAttribute( mbcr->
redAttribute() );
 
  318     mBlueAttributeComboBox->setAttribute( mbcr->
blueAttribute() );
 
  320     mDisableMinMaxWidgetRefresh++;
 
  324     mDisableMinMaxWidgetRefresh--;
 
  328     if ( mRedAttributeComboBox->findText( QStringLiteral( 
"Red" ) ) > -1 && mRedAttributeComboBox->findText( QStringLiteral( 
"Green" ) ) > -1 &&
 
  329          mRedAttributeComboBox->findText( QStringLiteral( 
"Blue" ) ) > -1 )
 
  331       mRedAttributeComboBox->setAttribute( QStringLiteral( 
"Red" ) );
 
  332       mGreenAttributeComboBox->setAttribute( QStringLiteral( 
"Green" ) );
 
  333       mBlueAttributeComboBox->setAttribute( QStringLiteral( 
"Blue" ) );
 
  337       mRedAttributeComboBox->setCurrentIndex( mRedAttributeComboBox->count() > 1 ? 1 : 0 );
 
  338       mGreenAttributeComboBox->setCurrentIndex( mGreenAttributeComboBox->count() > 2 ? 2 : 0 );
 
  339       mBlueAttributeComboBox->setCurrentIndex( mBlueAttributeComboBox->count() > 3 ? 3 : 0 );
 
  342   mBlockChangedSignal = 
false;