28  mCombo = 
new QComboBox();
 
   29  mCombo->setSizeAdjustPolicy( QComboBox::AdjustToMinimumContentsLengthWithIcon );
 
   37  QHBoxLayout *hLayout = 
new QHBoxLayout();
 
   38  hLayout->setContentsMargins( 0, 0, 0, 0 );
 
   39  hLayout->addWidget( mCombo, 1 );
 
   44  mWarningLabelContainer = 
new QWidget();
 
   45  QHBoxLayout *warningLayout = 
new QHBoxLayout();
 
   46  warningLayout->setContentsMargins( 0, 0, 0, 0 );
 
   47  mWarningLabel = 
new QLabel();
 
   49  const int size = 
static_cast<int>( std::max( 24.0, mCombo->minimumSize().height() * 0.5 ) );
 
   50  mWarningLabel->setPixmap( icon.pixmap( icon.actualSize( QSize( size, size ) ) ) );
 
   51  const int labelMargin = 
static_cast<int>( std::round( mCombo->fontMetrics().horizontalAdvance( 
'X' ) ) );
 
   52  warningLayout->insertSpacing( 0, labelMargin / 2 );
 
   53  warningLayout->insertWidget( 1, mWarningLabel );
 
   54  mWarningLabelContainer->setLayout( warningLayout );
 
   55  hLayout->addWidget( mWarningLabelContainer );
 
   56  mWarningLabelContainer->hide();
 
   60  setFocusPolicy( Qt::FocusPolicy::StrongFocus );
 
   61  setFocusProxy( mCombo );
 
   64  connect( mCombo, qOverload<int>( &QComboBox::currentIndexChanged ), 
this, &QgsScaleMethodWidget::updateWarning );