Class: QgsSymbolButton¶
-
class
qgis.gui.
QgsSymbolButton
(parent: QWidget = None, dialogTitle: str = '')¶ Bases:
PyQt5.QtWidgets.QToolButton
Construct a new symbol button. Use
dialogTitle
string to define the title to show in the symbol settings dialog.A button for creating and modifying QgsSymbol settings.
The button shows a preview icon for the current symbol, and will open a detailed symbol editor dialog (or panel widget) when clicked.
New in version 3.0: Enums
Methods
Copies the current symbol color to the clipboard.
Copies the current symbol to the clipboard.
Returns the title for the symbol settings dialog window.
Returns the layer associated with the widget.
Returns the map canvas associated with the widget.
Returns the message bar associated with the widget.
Pastes a color from the clipboard to the symbol.
Pastes a symbol from the clipboard.
Register an expression context generator class that will be used to retrieve an expression context for the button when required.
Sets the current
color
for the symbol.Sets the
title
for the symbol settings dialog window.Sets a
layer
to associate with the widget.Sets a map
canvas
to associate with the widget.Sets the message
bar
associated with the widget.Sets the
symbol
for the button.Sets the symbol
type
which the button requires.Returns the current symbol defined by the button.
Returns the symbol type which the button requires.
Signals
Emitted when the symbol’s settings are changed.
Attributes
-
actionEvent
()¶
-
changeEvent
(self, e: QEvent)¶
-
changed
¶ Emitted when the symbol’s settings are changed.
See also
See also
setSymbol()
[signal]
-
checkStateSet
()¶
-
childEvent
()¶
-
closeEvent
()¶
-
connectNotify
()¶
-
contextMenuEvent
()¶
-
copyColor
(self)¶ Copies the current symbol color to the clipboard.
See also
-
copySymbol
(self)¶ Copies the current symbol to the clipboard.
See also
-
create
()¶
-
customEvent
()¶
-
destroy
()¶
-
dialogTitle
(self) → str¶ Returns the title for the symbol settings dialog window.
See also
-
disconnectNotify
()¶
-
dragEnterEvent
(self, e: QDragEnterEvent)¶
-
dragLeaveEvent
(self, e: QDragLeaveEvent)¶
-
dragMoveEvent
()¶
-
dropEvent
(self, e: QDropEvent)¶
-
enterEvent
()¶
-
event
()¶
-
focusInEvent
()¶
-
focusNextChild
()¶
-
focusNextPrevChild
()¶
-
focusOutEvent
()¶
-
focusPreviousChild
()¶
-
hideEvent
()¶
-
hitButton
()¶
-
initPainter
()¶
-
initStyleOption
()¶
-
inputMethodEvent
()¶
-
isSignalConnected
()¶
-
keyPressEvent
()¶
-
keyReleaseEvent
()¶
-
layer
(self) → QgsVectorLayer¶ Returns the layer associated with the widget.
See also
-
leaveEvent
()¶
-
mapCanvas
(self) → QgsMapCanvas¶ Returns the map canvas associated with the widget.
See also
-
messageBar
(self) → QgsMessageBar¶ Returns the message bar associated with the widget.
See also
New in version 3.6.
-
metric
()¶
-
minimumSizeHint
(self) → QSize¶
-
mouseDoubleClickEvent
()¶
-
mouseMoveEvent
(self, e: QMouseEvent)¶
-
mousePressEvent
(self, e: QMouseEvent)¶
-
mouseReleaseEvent
()¶
-
moveEvent
()¶
-
nativeEvent
()¶
-
nextCheckState
()¶
-
paintEvent
()¶
-
pasteColor
(self)¶ Pastes a color from the clipboard to the symbol. If clipboard does not contain a valid color or string representation of a color, then no change is applied.
See also
-
pasteSymbol
(self)¶ Pastes a symbol from the clipboard. If clipboard does not contain a valid symbol then no change is applied.
See also
-
receivers
()¶
-
registerExpressionContextGenerator
(self, generator: QgsExpressionContextGenerator)¶ Register an expression context generator class that will be used to retrieve an expression context for the button when required.
-
resizeEvent
(self, event: QResizeEvent)¶
-
sender
()¶
-
senderSignalIndex
()¶
-
setColor
(self, color: Union[QColor, Qt.GlobalColor, QGradient])¶ Sets the current
color
for the symbol. Will emit a changed() signal if the color is different to the previous symbol color.
-
setDialogTitle
(self, title: str)¶ Sets the
title
for the symbol settings dialog window.See also
-
setLayer
(self, layer: QgsVectorLayer)¶ Sets a
layer
to associate with the widget. This allows the widget to setup layer related settings within the symbol settings dialog, such as correctly populating data defined override buttons.See also
-
setMapCanvas
(self, canvas: QgsMapCanvas)¶ Sets a map
canvas
to associate with the widget. This allows the widget to fetch current settings from the map canvas, such as current scale.See also
-
setMessageBar
(self, bar: QgsMessageBar)¶ Sets the message
bar
associated with the widget. This allows the widget to push feedback messages to the appropriate message bar.See also
New in version 3.6.
-
setSymbol
(self, symbol: QgsSymbol)¶ Sets the
symbol
for the button. Ownership ofsymbol
is transferred to the button.See also
See also
-
setSymbolType
(self, type: QgsSymbol.SymbolType)¶ Sets the symbol
type
which the button requires. If the type differs from the current symbol type, the symbol will be reset to a default symbol style of the new type.See also
-
showEvent
(self, e: QShowEvent)¶
-
sizeHint
(self) → QSize¶
-
symbol
(self) → QgsSymbol¶ Returns the current symbol defined by the button.
See also
See also
-
symbolType
(self) → QgsSymbol.SymbolType¶ Returns the symbol type which the button requires.
See also
-
tabletEvent
()¶
-
timerEvent
()¶
-
updateMicroFocus
()¶
-
wheelEvent
()¶
-