Class: QgsColorSchemeModel

class qgis.gui.QgsColorSchemeModel(scheme: QgsColorScheme, context: str = '', baseColor: Union[QColor, Qt.GlobalColor, QGradient] = QColor(), parent: QObject = None)

Bases: PyQt5.QtCore.QAbstractItemModel

Constructor

Parameters
  • scheme – color scheme for list

  • context – context string for color scheme

  • baseColor – base color for color scheme

  • parent – parent object

A model for colors in a color scheme

addColor(self, color: Union[QColor, Qt.GlobalColor, QGradient], label: str = '', allowDuplicate: bool = False)

Add a color to the list

Parameters
  • color – color to add

  • label – label for color

  • allowDuplicate – set to True to allow duplicate colors to be added (colors which are already present in the list)

baseColor(self) → QColor

Gets the base color for the color scheme used by the model

Returns

base color which is passed to scheme for color generation

See also

context()

beginInsertColumns()
beginInsertRows()
beginMoveColumns()
beginMoveRows()
beginRemoveColumns()
beginRemoveRows()
beginResetModel()
changePersistentIndex()
changePersistentIndexList()
childEvent()
colors(self) → object

Returns a list of colors shown in the widget

Returns

colors shown in the widget

columnCount(self, parent: QModelIndex = QModelIndex()) → int
connectNotify()
context(self) → str

Gets the current color scheme context for the model

Returns

context string which is passed to scheme for color generation

See also

baseColor()

createIndex()
customEvent()
data(self, index: QModelIndex, role: int = Qt.DisplayRole) → Any
decodeData()
disconnectNotify()
dropMimeData(self, data: QMimeData, action: Qt.DropAction, row: int, column: int, parent: QModelIndex) → bool
encodeData()
endInsertColumns()
endInsertRows()
endMoveColumns()
endMoveRows()
endRemoveColumns()
endRemoveRows()
endResetModel()
flags(self, index: QModelIndex) → Qt.ItemFlags
headerData(self, section: int, orientation: Qt.Orientation, role: int = Qt.DisplayRole) → Any
index(self, row: int, column: int, parent: QModelIndex = QModelIndex()) → QModelIndex
insertRows(self, row: int, count: int, parent: QModelIndex = QModelIndex()) → bool
isDirty(self) → bool

Returns whether the color scheme model has been modified

Returns

True if colors have been modified

isSignalConnected()
mimeData(self, indexes: object) → QMimeData
mimeTypes(self) → List[str]
parent(self, index: QModelIndex) → QModelIndex
persistentIndexList()
receivers()
removeRows(self, row: int, count: int, parent: QModelIndex = QModelIndex()) → bool
resetInternalData()
rowCount(self, parent: QModelIndex = QModelIndex()) → int
sender()
senderSignalIndex()
setData(self, index: QModelIndex, value: Any, role: int = Qt.EditRole) → bool
setScheme(self, scheme: QgsColorScheme, context: str = '', baseColor: Union[QColor, Qt.GlobalColor, QGradient] = QColor())

Sets the color scheme to show in the widget

Parameters
  • scheme – color scheme

  • context – context for color scheme

  • baseColor – base color for color scheme

supportedDropActions(self) → Qt.DropActions
timerEvent()