Class: QgsColorSchemeModel¶
- class qgis.gui.QgsColorSchemeModel¶
Bases:
PyQt5.QtCore.QAbstractItemModel
A model for colors in a color scheme
See also
New in version 2.5.
QgsColorSchemeModel(scheme:
QgsColorScheme
, context: str = ‘’, baseColor: Union[QColor, Qt.GlobalColor, QGradient] = QColor(), parent: 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
beginInsertColumns
beginInsertRows
beginMoveColumns
beginMoveRows
beginRemoveColumns
beginRemoveRows
changePersistentIndex
Returns a list of colors shown in the widget
- param parent
Gets the current color scheme context for the model
createIndex
- param index
decodeData
- 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: 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
- QgsColorSchemeModel.beginInsertColumns(self, QModelIndex, int, int)
- QgsColorSchemeModel.beginInsertRows(self, QModelIndex, int, int)
- QgsColorSchemeModel.beginMoveColumns(self, QModelIndex, int, int, QModelIndex, int) -> bool
- QgsColorSchemeModel.beginMoveRows(self, QModelIndex, int, int, QModelIndex, int) -> bool
- QgsColorSchemeModel.beginRemoveColumns(self, QModelIndex, int, int)
- QgsColorSchemeModel.beginRemoveRows(self, QModelIndex, int, int)
- beginResetModel(self)¶
- QgsColorSchemeModel.changePersistentIndex(self, QModelIndex, QModelIndex)
- changePersistentIndexList(self, Iterable[QModelIndex], Iterable[QModelIndex])¶
- childEvent(self, QChildEvent)¶
- 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, 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
- QgsColorSchemeModel.createIndex(self, int, int, object: object = 0) -> QModelIndex
- customEvent(self, QEvent)¶
- data(self, index: QModelIndex, role: int = Qt.DisplayRole) Any ¶
- Parameters
index (QModelIndex) –
role (int = Qt.DisplayRole) –
- Return type
Any
- QgsColorSchemeModel.decodeData(self, int, int, QModelIndex, QDataStream) -> bool
- disconnectNotify(self, QMetaMethod)¶
- 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(self, Iterable[QModelIndex], 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, QMetaMethod) bool ¶
- mimeData(self, indexes: Iterable[QModelIndex]) QMimeData ¶
- Parameters
indexes (Iterable[QModelIndex]) –
- Return type
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, 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 ¶
- 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, 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(self, QTimerEvent)¶