Subgroup: Color

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 – parent widget
  • scheme – QgsColorScheme for colors to show in the list
  • context – context string provided to color scheme
  • baseColor – base color for color scheme

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

New in version 2.5: 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
keyReleaseEvent
leaveEvent
metric
mouseDoubleClickEvent
mouseMoveEvent
mousePressEvent
mouseReleaseEvent
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

Attributes

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

Adds a color to the list

Parameters:
  • color – color to add
  • label – optional label for color
  • allowDuplicate – 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 – 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 – destination file
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 – file to import
indexRowSizeHint()
initPainter()
initStyleOption()
inputMethodEvent()
isDirty(self) → bool

Returns whether the color scheme list has been modified

Returns:true if colors have been modified
isIndexHidden()
isSignalConnected()
keyPressEvent(self, event: QKeyEvent)
keyReleaseEvent()
leaveEvent()
metric()
mouseDoubleClickEvent()
mouseMoveEvent()
mousePressEvent(self, event: QMouseEvent)
mouseReleaseEvent(self, 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

scheduleDelayedItemsLayout()
scheme(self) → QgsColorScheme

Returns the scheme currently selected in the list.

New in version 3.0.

See also

setScheme()

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 for colors to show in the list
  • context – context string provided to color scheme
  • baseColor – 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()