23 #include <QAbstractItemView>
30 setSizeAdjustPolicy( QComboBox::AdjustToMinimumContentsLengthWithIcon );
34 QStringList QgsBlendModeComboBox::blendModesList()
const
36 return QStringList() << tr(
"Normal" )
37 << QStringLiteral(
"-" )
42 << QStringLiteral(
"-" )
46 << QStringLiteral(
"-" )
50 << QStringLiteral(
"-" )
60 const QStringList myBlendModesList = blendModesList();
61 QStringList::const_iterator blendModeIt = myBlendModesList.constBegin();
63 mBlendModeToListIndex.resize( myBlendModesList.count() );
64 mListIndexToBlendMode.resize( myBlendModesList.count() );
68 int blendModeIndex = 0;
69 for ( ; blendModeIt != myBlendModesList.constEnd(); ++blendModeIt )
71 if ( *blendModeIt == QLatin1String(
"-" ) )
74 insertSeparator( index );
80 addItem( *blendModeIt );
81 mListIndexToBlendMode[ index ] = blendModeIndex;
82 mBlendModeToListIndex[ blendModeIndex ] = index;
88 blockSignals(
false );
void setBlendMode(QPainter::CompositionMode blendMode)
Function to set the selected blend mode from QPainter::CompositionMode.
QgsBlendModeComboBox(QWidget *parent=nullptr)
Constructor for QgsBlendModeComboBox.
void updateModes()
Populates the blend mode combo box, and sets up mapping for blend modes to combo box indexes.
QPainter::CompositionMode blendMode()
Function to read the selected blend mode as QPainter::CompositionMode.
static QgsPainting::BlendMode getBlendModeEnum(QPainter::CompositionMode blendMode)
Returns a BlendMode corresponding to a QPainter::CompositionMode.
static QPainter::CompositionMode getCompositionMode(QgsPainting::BlendMode blendMode)
Returns a QPainter::CompositionMode corresponding to a BlendMode.
BlendMode
Blending modes enum defining the available composition modes that can be used when rendering a layer.