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 (QgsColorScheme) – color scheme for list

  • context (str = '') – context string for color scheme

  • baseColor (Union[QColor) – base color for color scheme

  • parent (QObject = None) – parent object

A model for colors in a color scheme

Methods

addColor

Add a color to the list

baseColor

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

beginInsertColumns

beginInsertRows

beginMoveColumns

beginMoveRows

beginRemoveColumns

beginRemoveRows

beginResetModel

changePersistentIndex

changePersistentIndexList

childEvent

colors

Returns a list of colors shown in the widget

columnCount

param parent

connectNotify

context

Gets the current color scheme context for the model

createIndex

customEvent

data

param index

decodeData

disconnectNotify

dropMimeData

param data

encodeData

endInsertColumns

endInsertRows

endMoveColumns

endMoveRows

endRemoveColumns

endRemoveRows

endResetModel

flags

param index

headerData

param section

index

param row

insertRows

param row

isDirty

Returns whether the color scheme model has been modified

isSignalConnected

mimeData

param indexes

mimeTypes

rtype

List[str]

parent

param index

persistentIndexList

receivers

removeRows

param row

resetInternalData

rowCount

param parent

sender

senderSignalIndex

setData

param index

setScheme

Sets the color scheme to show in the widget

supportedDropActions

rtype

Qt.DropActions

timerEvent

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

Add a color to the list

Parameters
  • color (Union[QColor) – color to add

  • label (str = '') – label for color

  • allowDuplicate (bool = False) – 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

Return type

QColor

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

Return type

object

Returns

colors shown in the widget

columnCount(self, parent: QModelIndex = QModelIndex()) → int
Parameters

parent (QModelIndex = QModelIndex()) –

Return type

int

connectNotify()
context(self) → str

Gets the current color scheme context for the model

Return type

str

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
Parameters
  • index (QModelIndex) –

  • role (int = Qt.DisplayRole) –

Return type

Any

decodeData()
disconnectNotify()
dropMimeData(self, data: QMimeData, action: Qt.DropAction, row: int, column: int, parent: QModelIndex) → bool
Parameters
  • data (QMimeData) –

  • action (Qt.DropAction) –

  • row (int) –

  • column (int) –

  • parent (QModelIndex) –

Return type

bool

encodeData()
endInsertColumns()
endInsertRows()
endMoveColumns()
endMoveRows()
endRemoveColumns()
endRemoveRows()
endResetModel()
flags(self, index: QModelIndex) → Qt.ItemFlags
Parameters

index (QModelIndex) –

Return type

Qt.ItemFlags

headerData(self, section: int, orientation: Qt.Orientation, role: int = Qt.DisplayRole) → Any
Parameters
  • section (int) –

  • orientation (Qt.Orientation) –

  • role (int = Qt.DisplayRole) –

Return type

Any

index(self, row: int, column: int, parent: QModelIndex = QModelIndex()) → QModelIndex
Parameters
  • row (int) –

  • column (int) –

  • parent (QModelIndex = QModelIndex()) –

Return type

QModelIndex

insertRows(self, row: int, count: int, parent: QModelIndex = QModelIndex()) → bool
Parameters
  • row (int) –

  • count (int) –

  • parent (QModelIndex = QModelIndex()) –

Return type

bool

isDirty(self) → bool

Returns whether the color scheme model has been modified

Return type

bool

Returns

true if colors have been modified

isSignalConnected()
mimeData(self, indexes: object) → QMimeData
Parameters

indexes (object) –

Return type

QMimeData

mimeTypes(self) → List[str]
Return type

List[str]

parent(self, index: QModelIndex) → QModelIndex
Parameters

index (QModelIndex) –

Return type

QModelIndex

persistentIndexList()
receivers()
removeRows(self, row: int, count: int, parent: QModelIndex = QModelIndex()) → bool
Parameters
  • row (int) –

  • count (int) –

  • parent (QModelIndex = QModelIndex()) –

Return type

bool

resetInternalData()
rowCount(self, parent: QModelIndex = QModelIndex()) → int
Parameters

parent (QModelIndex = QModelIndex()) –

Return type

int

sender()
senderSignalIndex()
setData(self, index: QModelIndex, value: Any, role: int = Qt.EditRole) → bool
Parameters
  • index (QModelIndex) –

  • value (Any) –

  • role (int = Qt.EditRole) –

Return type

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 (QgsColorScheme) – color scheme

  • context (str = '') – context for color scheme

  • baseColor (Union[QColor) – base color for color scheme

supportedDropActions(self) → Qt.DropActions
Return type

Qt.DropActions

timerEvent()