Class: QgsColorSchemeModel¶
- class qgis.gui.QgsColorSchemeModel¶
Bases:
PyQt5.QtCore.QAbstractItemModel
A model for colors in a color scheme
See also
QgsColorSchemeModel(scheme: Optional[QgsColorScheme], context: Optional[str] = ‘’, baseColor: Union[QColor, Qt.GlobalColor] = QColor(), parent: Optional[QObject] = None) Constructor
- Parameters:
scheme – color scheme for list
context – context string for color scheme
baseColor – base color for color scheme
parent –
parent object
Methods
Add a color to the list
Gets the base color for the color scheme used by the model
Returns a list of colors shown in the widget
- param parent:
Gets the current color scheme context for the model
- param index:
- param data:
- param index:
- param section:
- param row:
- param row:
Returns whether the color scheme model has been modified
- param indexes:
- rtype:
List[str]
- param index:
- param row:
- param parent:
- param index:
Sets the color scheme to show in the widget
- rtype:
Qt.DropActions
- addColor(self, color: QColor | Qt.GlobalColor, label: str | None = '', allowDuplicate: bool = False)¶
Add a color to the list
- Parameters:
color (Union[QColor) – color to add
label (Optional[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
- beginInsertColumns(self, parent: QModelIndex, first: int, last: int)¶
- beginInsertRows(self, parent: QModelIndex, first: int, last: int)¶
- beginMoveColumns(self, sourceParent: QModelIndex, sourceFirst: int, sourceLast: int, destinationParent: QModelIndex, destinationColumn: int) bool ¶
- beginMoveRows(self, sourceParent: QModelIndex, sourceFirst: int, sourceLast: int, destinationParent: QModelIndex, destinationRow: int) bool ¶
- beginRemoveColumns(self, parent: QModelIndex, first: int, last: int)¶
- beginRemoveRows(self, parent: QModelIndex, first: int, last: int)¶
- beginResetModel(self)¶
- changePersistentIndex(self, from_: QModelIndex, to: QModelIndex)¶
- changePersistentIndexList(self, from_: Iterable[QModelIndex], to: Iterable[QModelIndex])¶
- childEvent(self, a0: QChildEvent | None)¶
- colors(self) List[Tuple[QColor, str]] ¶
Returns a list of colors shown in the widget
- Return type:
List[Tuple[QColor, str]]
- Returns:
colors shown in the widget
- columnCount(self, parent: QModelIndex = QModelIndex()) int ¶
- Parameters:
parent (QModelIndex = QModelIndex())
- Return type:
int
- connectNotify(self, signal: QMetaMethod)¶
- 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
- createIndex(self, row: int, column: int, object: Any = None) QModelIndex ¶
- customEvent(self, a0: QEvent | None)¶
- data(self, index: QModelIndex, role: int = Qt.DisplayRole) Any ¶
- Parameters:
index (QModelIndex)
role (int = Qt.DisplayRole)
- Return type:
Any
- decodeData(self, row: int, column: int, parent: QModelIndex, stream: QDataStream) bool ¶
- disconnectNotify(self, signal: QMetaMethod)¶
- dropMimeData(self, data: QMimeData | None, action: Qt.DropAction, row: int, column: int, parent: QModelIndex) bool ¶
- Parameters:
data (Optional[QMimeData])
action (Qt.DropAction)
row (int)
column (int)
parent (QModelIndex)
- Return type:
bool
- encodeData(self, indexes: Iterable[QModelIndex], stream: QDataStream)¶
- endInsertColumns(self)¶
- endInsertRows(self)¶
- endMoveColumns(self)¶
- endMoveRows(self)¶
- endRemoveColumns(self)¶
- endRemoveRows(self)¶
- endResetModel(self)¶
- 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(self, signal: QMetaMethod) bool ¶
- mimeData(self, indexes: Iterable[QModelIndex]) QMimeData | None ¶
- Parameters:
indexes (Iterable[QModelIndex])
- Return type:
Optional[QMimeData]
- mimeTypes(self) List[str] ¶
- Return type:
List[str]
- parent(self, index: QModelIndex) QModelIndex ¶
- Parameters:
index (QModelIndex)
- Return type:
QModelIndex
- persistentIndexList(self) List[QModelIndex] ¶
- receivers(self, signal: PYQT_SIGNAL) int ¶
- removeRows(self, row: int, count: int, parent: QModelIndex = QModelIndex()) bool ¶
- Parameters:
row (int)
count (int)
parent (QModelIndex = QModelIndex())
- Return type:
bool
- resetInternalData(self)¶
- rowCount(self, parent: QModelIndex = QModelIndex()) int ¶
- Parameters:
parent (QModelIndex = QModelIndex())
- Return type:
int
- sender(self) QObject | None ¶
- senderSignalIndex(self) int ¶
- 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 | None, context: str | None = '', baseColor: QColor | Qt.GlobalColor = QColor())¶
Sets the color scheme to show in the widget
- Parameters:
scheme (Optional[QgsColorScheme]) – color scheme
context (Optional[str] = '') – context for color scheme
baseColor (Union[QColor) – base color for color scheme
- supportedDropActions(self) Qt.DropActions ¶
- Return type:
Qt.DropActions
- timerEvent(self, a0: QTimerEvent | None)¶