Class: QgsColorSchemeList

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

Bases: PyQt5.QtWidgets.QTreeView

Construct a new color swatch grid.

Parameters
  • parent (QWidget = None) – parent widget

  • scheme (QgsColorScheme = None) – QgsColorScheme for colors to show in the list

  • context (str = '') – context string provided to color scheme

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

An editable list of color swatches, taken from an associated QgsColorScheme.

Methods

actionEvent

addColor

Adds a color to the list

changeEvent

childEvent

closeEditor

closeEvent

columnCountChanged

columnMoved

columnResized

commitData

connectNotify

contextMenuEvent

copyColors

Copies colors from the list to the clipboard

create

currentChanged

customEvent

destroy

dirtyRegionOffset

disconnectNotify

dragEnterEvent

dragLeaveEvent

dragMoveEvent

drawBranches

drawFrame

drawRow

drawTree

dropEvent

dropIndicatorPosition

edit

editorDestroyed

enterEvent

event

eventFilter

executeDelayedItemsLayout

exportColorsToGpl

Export colors to a GPL palette file from the list

focusInEvent

focusNextChild

focusNextPrevChild

focusOutEvent

focusPreviousChild

hideEvent

horizontalOffset

horizontalScrollbarAction

horizontalScrollbarValueChanged

importColorsFromGpl

Import colors from a GPL palette file to the list

indexRowSizeHint

initPainter

initStyleOption

inputMethodEvent

isDirty

Returns whether the color scheme list has been modified

isIndexHidden

isSignalConnected

keyPressEvent

param event

keyReleaseEvent

leaveEvent

metric

mouseDoubleClickEvent

mouseMoveEvent

mousePressEvent

param event

mouseReleaseEvent

param event

moveCursor

moveEvent

nativeEvent

paintEvent

pasteColors

Pastes colors from clipboard to the list

receivers

reexpand

removeSelection

Removes any selected colors from the list

resizeEvent

rowHeight

rowsAboutToBeRemoved

rowsInserted

rowsRemoved

saveColorsToScheme

Saves the current colors shown in the list back to a color scheme, if supported by the color scheme.

scheduleDelayedItemsLayout

scheme

Returns the scheme currently selected in the list.

scrollContentsBy

scrollDirtyRegion

selectedIndexes

selectionChanged

selectionCommand

sender

senderSignalIndex

setDirtyRegion

setScheme

Sets the color scheme to show in the list

setSelection

setState

setViewportMargins

sharedPainter

showEvent

showExportColorsDialog

Displays a file picker dialog allowing users to export colors from the list into a file.

showImportColorsDialog

Displays a file picker dialog allowing users to import colors into the list from a file.

sizeHintForColumn

startDrag

state

tabletEvent

timerEvent

updateEditorData

updateEditorGeometries

updateGeometries

updateMicroFocus

verticalOffset

verticalScrollbarAction

verticalScrollbarValueChanged

viewOptions

viewportEvent

viewportMargins

viewportSizeHint

visualRegionForSelection

wheelEvent

Signals

colorSelected

Emitted when a color is selected from the list

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

Adds a color to the list

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

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

  • allowDuplicate (bool = False) – set to True to allow duplicate colors to be added, ie colors which already exist in the list

changeEvent()
childEvent()
closeEditor()
closeEvent()
colorSelected

Emitted when a color is selected from the list

Parameters

color (Union[QColor) – color selected [signal]

columnCountChanged()
columnMoved()
columnResized()
commitData()
connectNotify()
contextMenuEvent()
copyColors(self)

Copies colors from the list to the clipboard

See also

pasteColors()

create()
currentChanged()
customEvent()
destroy()
dirtyRegionOffset()
disconnectNotify()
dragEnterEvent()
dragLeaveEvent()
dragMoveEvent()
drawBranches()
drawFrame()
drawRow()
drawTree()
dropEvent()
dropIndicatorPosition()
edit()
editorDestroyed()
enterEvent()
event()
eventFilter()
executeDelayedItemsLayout()
exportColorsToGpl(self, file: QFile) → bool

Export colors to a GPL palette file from the list

Parameters

file (QFile) – destination file

Return type

bool

focusInEvent()
focusNextChild()
focusNextPrevChild()
focusOutEvent()
focusPreviousChild()
hideEvent()
horizontalOffset()
horizontalScrollbarAction()
horizontalScrollbarValueChanged()
importColorsFromGpl(self, file: QFile) → bool

Import colors from a GPL palette file to the list

Parameters

file (QFile) – file to import

Return type

bool

indexRowSizeHint()
initPainter()
initStyleOption()
inputMethodEvent()
isDirty(self) → bool

Returns whether the color scheme list has been modified

Return type

bool

Returns

True if colors have been modified

isIndexHidden()
isSignalConnected()
keyPressEvent(self, event: QKeyEvent)
Parameters

event (QKeyEvent) –

keyReleaseEvent()
leaveEvent()
metric()
mouseDoubleClickEvent()
mouseMoveEvent()
mousePressEvent(self, event: QMouseEvent)
Parameters

event (QMouseEvent) –

mouseReleaseEvent(self, event: QMouseEvent)
Parameters

event (QMouseEvent) –

moveCursor()
moveEvent()
nativeEvent()
paintEvent()
pasteColors(self)

Pastes colors from clipboard to the list

See also

copyColors()

receivers()
reexpand()
removeSelection(self)

Removes any selected colors from the list

resizeEvent()
rowHeight()
rowsAboutToBeRemoved()
rowsInserted()
rowsRemoved()
saveColorsToScheme(self) → bool

Saves the current colors shown in the list back to a color scheme, if supported by the color scheme.

Note

this method is only effective if the color scheme is editable

Return type

bool

scheduleDelayedItemsLayout()
scheme(self) → QgsColorScheme

Returns the scheme currently selected in the list.

See also

setScheme()

New in version 3.0.

Return type

QgsColorScheme

scrollContentsBy()
scrollDirtyRegion()
selectedIndexes()
selectionChanged()
selectionCommand()
sender()
senderSignalIndex()
setDirtyRegion()
setScheme(self, scheme: QgsColorScheme, context: str = '', baseColor: Union[QColor, Qt.GlobalColor, QGradient] = QColor())

Sets the color scheme to show in the list

Parameters
  • scheme (QgsColorScheme) – QgsColorScheme for colors to show in the list

  • context (str = '') – context string provided to color scheme

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

See also

scheme()

setSelection()
setState()
setViewportMargins()
sharedPainter()
showEvent()
showExportColorsDialog(self)

Displays a file picker dialog allowing users to export colors from the list into a file.

New in version 3.0.

showImportColorsDialog(self)

Displays a file picker dialog allowing users to import colors into the list from a file.

New in version 3.0.

sizeHintForColumn()
startDrag()
state()
tabletEvent()
timerEvent()
updateEditorData()
updateEditorGeometries()
updateGeometries()
updateMicroFocus()
verticalOffset()
verticalScrollbarAction()
verticalScrollbarValueChanged()
viewOptions()
viewportEvent()
viewportMargins()
viewportSizeHint()
visualRegionForSelection()
wheelEvent()