23 #include <QAbstractItemView>
33 QStringList QgsBlendModeComboBox::blendModesList()
const
35 return QStringList() << tr(
"Normal" )
36 << QStringLiteral(
"-" )
41 << QStringLiteral(
"-" )
45 << QStringLiteral(
"-" )
49 << QStringLiteral(
"-" )
59 QStringList myBlendModesList = blendModesList();
60 QStringList::const_iterator blendModeIt = myBlendModesList.constBegin();
62 mBlendModeToListIndex.resize( myBlendModesList.count() );
63 mListIndexToBlendMode.resize( myBlendModesList.count() );
67 int blendModeIndex = 0;
68 for ( ; blendModeIt != myBlendModesList.constEnd(); ++blendModeIt )
70 if ( *blendModeIt == QLatin1String(
"-" ) )
73 insertSeparator( index );
79 addItem( *blendModeIt );
80 mListIndexToBlendMode[ index ] = blendModeIndex;
81 mBlendModeToListIndex[ blendModeIndex ] = index;
87 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.