Subgroup: Property

Class: QgsPropertyOverrideButton

class qgis.gui.QgsPropertyOverrideButton

Bases: PyQt5.QtWidgets.QToolButton

A button for controlling property overrides which may apply to a widget.

QgsPropertyOverrideButton is designed to be used alongside the QGIS properties framework (QgsProperty, QgsPropertyDefinition and QgsPropertyCollection).

It allows users to specify field or expression based overrides which should be applied to a property of an object. Eg, this widget is used for controlling data defined overrides in symbology, labeling and layouts.

New in version 3.0: Methods

acceptDrops
accessibleDescription
accessibleName
actionEvent
actions
activateWindow
addAction
addActions
adjustSize
animateClick
arrowType
autoExclusive
autoFillBackground
autoRaise
autoRepeat
autoRepeatDelay
autoRepeatInterval
backgroundRole
baseSize
blockSignals
changeEvent
checkStateSet
childAt childAt(self, int, int) -> QWidget
childEvent
children
childrenRect
childrenRegion
clearFocus
clearMask
click
close
closeEvent
colorCount
connectNotify
contentsMargins
contentsRect
contextMenuEvent
contextMenuPolicy
create
createWindowContainer
cursor
customEvent
defaultAction
deleteLater
depth
destroy
devType
devicePixelRatio
devicePixelRatioF
devicePixelRatioFScale
disconnect
disconnectNotify
dragEnterEvent
dragLeaveEvent
dragMoveEvent
dropEvent
dumpObjectInfo
dumpObjectTree
dynamicPropertyNames
effectiveWinId
ensurePolished
enterEvent
event
eventFilter
find
findChild findChild(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> QObject
findChildren findChildren(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject]
focusInEvent
focusNextChild
focusNextPrevChild
focusOutEvent
focusPolicy
focusPreviousChild
focusProxy
focusWidget
font
fontInfo
fontMetrics
foregroundRole
frameGeometry
frameSize
fullDescription Returns the full definition description and current definition (internally generated on a contextual basis).
geometry
getContentsMargins
grab
grabGesture
grabKeyboard
grabMouse grabMouse(self, Union[QCursor, Qt.CursorShape])
grabShortcut
graphicsEffect
graphicsProxyWidget
group
hasFocus
hasHeightForWidth
hasMouseTracking
hasTabletTracking
height
heightForWidth
heightMM
hide
hideEvent
hitButton
icon
iconSize
inherits
init Initialize a newly constructed property button (useful if button was included in a UI layout).
initPainter
initStyleOption
inputMethodEvent
inputMethodHints
inputMethodQuery
insertAction
insertActions
installEventFilter
isActive Returns true if the button has an active property.
isActiveWindow
isAncestorOf
isCheckable
isChecked
isDown
isEnabled
isEnabledTo
isFullScreen
isHidden
isLeftToRight
isMaximized
isMinimized
isModal
isRightToLeft
isSignalConnected
isVisible
isVisibleTo
isWidgetType
isWindow
isWindowModified
isWindowType
keyPressEvent
keyReleaseEvent
keyboardGrabber
killTimer
layout
layoutDirection
leaveEvent
locale
logicalDpiX
logicalDpiY
lower
mapFrom
mapFromGlobal
mapFromParent
mapTo
mapToGlobal
mapToParent
mask
maximumHeight
maximumSize
maximumWidth
menu
metaObject
metric
minimumHeight
minimumSize
minimumSizeHint
minimumWidth
mouseDoubleClickEvent
mouseGrabber
mouseMoveEvent
mousePressEvent
mouseReleaseEvent
move move(self, int, int)
moveEvent
moveToThread
nativeEvent
nativeParentWidget
nextCheckState
nextInFocusChain
normalGeometry
objectName
overrideWindowFlags
overrideWindowState
paintEngine
paintEvent
paintingActive
palette
parent
parentWidget
physicalDpiX
physicalDpiY
popupMode
pos
previousInFocusChain
property
propertyKey Returns the property key linked to the button.
pyqtConfigure Each keyword argument is either the name of a Qt property or a Qt signal.
raise_
receivers
rect
registerCheckedWidget Register a sibling widget that gets checked when the property is active.
registerEnabledWidget Register a sibling widget that gets enabled when the property is active, and disabled when the property is inactive.
registerExpressionContextGenerator Register an expression context generator class that will be used to retrieve an expression context for the button when required.
registerExpressionWidget Register a sibling widget (line edit, text edit) that will receive the property as an expression
registerVisibleWidget Register a sibling widget that gets visible when the property is active, and hidden when the property is inactive.
releaseKeyboard
releaseMouse
releaseShortcut
removeAction
removeEventFilter
render render(self, QPainter, targetOffset: QPoint = QPoint(), sourceRegion: QRegion = QRegion(), flags: Union[QWidget.RenderFlags, QWidget.RenderFlag] = QWidget.RenderFlags(QWidget.DrawWindowBackground|QWidget.DrawChildren))
repaint repaint(self, int, int, int, int)
resize resize(self, int, int)
resizeEvent
restoreGeometry
saveGeometry
scroll scroll(self, int, int, QRect)
sender
senderSignalIndex
setAcceptDrops
setAccessibleDescription
setAccessibleName
setActive Set whether the current property override definition is to be used
setArrowType
setAttribute
setAutoExclusive
setAutoFillBackground
setAutoRaise
setAutoRepeat
setAutoRepeatDelay
setAutoRepeatInterval
setBackgroundRole
setBaseSize setBaseSize(self, QSize)
setCheckable
setChecked
setContentsMargins setContentsMargins(self, QMargins)
setContextMenuPolicy
setCursor
setDefaultAction
setDisabled
setDown
setEnabled
setFixedHeight
setFixedSize setFixedSize(self, int, int)
setFixedWidth
setFocus setFocus(self, Qt.FocusReason)
setFocusPolicy
setFocusProxy
setFont
setForegroundRole
setGeometry setGeometry(self, int, int, int, int)
setGraphicsEffect
setHidden
setIcon
setIconSize
setInputMethodHints
setLayout
setLayoutDirection
setLocale
setMask setMask(self, QRegion)
setMaximumHeight
setMaximumSize setMaximumSize(self, QSize)
setMaximumWidth
setMenu
setMinimumHeight
setMinimumSize setMinimumSize(self, QSize)
setMinimumWidth
setMouseTracking
setObjectName
setPalette
setParent setParent(self, QWidget, Union[Qt.WindowFlags, Qt.WindowType])
setPopupMode
setProperty
setShortcut
setShortcutAutoRepeat
setShortcutEnabled
setSizeIncrement setSizeIncrement(self, QSize)
setSizePolicy setSizePolicy(self, QSizePolicy.Policy, QSizePolicy.Policy)
setStatusTip
setStyle
setStyleSheet
setTabOrder
setTabletTracking
setText
setToProperty Sets the widget to reflect the current state of a QgsProperty.
setToolButtonStyle
setToolTip
setToolTipDuration
setUpdatesEnabled
setUsageInfo Set the usage information for the property.
setVectorLayer Sets the vector layer associated with the button.
setVisible
setWhatsThis
setWindowFilePath
setWindowFlag
setWindowFlags
setWindowIcon
setWindowIconText
setWindowModality
setWindowModified
setWindowOpacity
setWindowRole
setWindowState
setWindowTitle
sharedPainter
shortcut
show
showEvent
showFullScreen
showMaximized
showMenu
showMinimized
showNormal
signalsBlocked
size
sizeHint
sizeIncrement
sizePolicy
stackUnder
startTimer
statusTip
style
styleSheet
tabletEvent
testAttribute
text
thread
timerEvent
toProperty Returns a QgsProperty object encapsulating the current state of the widget.
toggle
toolButtonStyle
toolTip
toolTipDuration
tr
underMouse
ungrabGesture
unsetCursor
unsetLayoutDirection
unsetLocale
update update(self, QRect)
updateFieldLists Updates list of fields.
updateGeometry
updateMicroFocus
updatesEnabled
usageInfo Returns usage information for the property.
validDataType Returns the data type which the widget will accept.
vectorLayer Returns the vector layer associated with the button.
visibleRegion
whatsThis
wheelEvent
width
widthMM
winId
window
windowFilePath
windowFlags
windowHandle
windowIcon
windowIconText
windowModality
windowOpacity
windowRole
windowState
windowTitle
windowType
x
y

Attributes

DelayedPopup
DrawChildren
DrawWindowBackground
IgnoreMask
InstantPopup
MenuButtonPopup
PdmDepth
PdmDevicePixelRatio
PdmDevicePixelRatioScaled
PdmDpiX
PdmDpiY
PdmHeight
PdmHeightMM
PdmNumColors
PdmPhysicalDpiX
PdmPhysicalDpiY
PdmWidth
PdmWidthMM
activated Emitted when the activated status of the widget changes [signal]
changed Emitted when property definition changes [signal]
clicked clicked(self, bool = False) [signal]
createAuxiliaryField Emitted when creating a new auxiliary field [signal]
customContextMenuRequested customContextMenuRequested(self, QPoint) [signal]
destroyed destroyed(self, QObject = None) [signal]
objectNameChanged objectNameChanged(self, str) [signal]
pressed pressed(self) [signal]
released released(self) [signal]
staticMetaObject
toggled toggled(self, bool) [signal]
triggered triggered(self, QAction) [signal]
windowIconChanged windowIconChanged(self, QIcon) [signal]
windowIconTextChanged windowIconTextChanged(self, str) [signal]
windowTitleChanged windowTitleChanged(self, str) [signal]
actionEvent()
activated

Emitted when the activated status of the widget changes [signal]

changeEvent()
changed

Emitted when property definition changes [signal]

checkStateSet()
childEvent()
closeEvent()
connectNotify()
contextMenuEvent()
create()
createAuxiliaryField

Emitted when creating a new auxiliary field [signal]

customEvent()
destroy()
disconnectNotify()
dragEnterEvent()
dragLeaveEvent()
dragMoveEvent()
dropEvent()
enterEvent()
event()
focusInEvent()
focusNextChild()
focusNextPrevChild()
focusOutEvent()
focusPreviousChild()
fullDescription(self) → str

Returns the full definition description and current definition (internally generated on a contextual basis).

hideEvent()
hitButton()
init(self, propertyKey: int, property: QgsProperty, definitions: object, layer: QgsVectorLayer = None, auxiliaryStorageEnabled: bool = False)

Initialize a newly constructed property button (useful if button was included in a UI layout).

Parameters:
  • propertyKey – key for corresponding property
  • property – initial value of associated property to show in widget
  • definitions – properties definitions for corresponding collection
  • layer – associated vector layer
  • auxiliaryStorageEnabled – If true, activate the button to store data defined in auxiliary storage

init(self, propertyKey: int, property: QgsProperty, definition: QgsPropertyDefinition, layer: QgsVectorLayer = None, auxiliaryStorageEnabled: bool = False) Initialize a newly constructed property button (useful if button was included in a UI layout).

Parameters:
  • propertyKey – key for corresponding property
  • property – initial value of associated property to show in widget
  • definition – properties definition for button
  • layer – associated vector layer
  • auxiliaryStorageEnabled – If true, activate the button to store data defined in auxiliary storage

init(self, propertyKey: int, collection: QgsAbstractPropertyCollection, definitions: object, layer: QgsVectorLayer = None, auxiliaryStorageEnabled: bool = False) Initialize a newly constructed property button (useful if button was included in a UI layout).

Parameters:
  • propertyKey – key for corresponding property
  • collection – associated property collection
  • definitions – properties definitions for collection
  • layer – associated vector layer
  • auxiliaryStorageEnabled – If true, activate the button to store data defined in auxiliary storage
initPainter()
initStyleOption()
inputMethodEvent()
isActive(self) → bool

Returns true if the button has an active property.

isSignalConnected()
keyPressEvent()
keyReleaseEvent()
leaveEvent()
metric()
mouseDoubleClickEvent()
mouseMoveEvent()
mousePressEvent()
mouseReleaseEvent(self, event: QMouseEvent)
moveEvent()
nativeEvent()
nextCheckState()
paintEvent()
propertyKey(self) → int

Returns the property key linked to the button.

receivers()
registerCheckedWidget(self, widget: QWidget, natural: bool = True)

Register a sibling widget that gets checked when the property is active. if natural is false, widget gets unchecked when the property is active.

Note

this should be called after calling init() to be correctly initialized.

registerEnabledWidget(self, widget: QWidget, natural: bool = True)

Register a sibling widget that gets enabled when the property is active, and disabled when the property is inactive. if natural is false, widget gets disabled when the property is active, and enabled when the property is inactive.

Note

this should be called after calling init() to be correctly initialized.

registerExpressionContextGenerator(self, generator: QgsExpressionContextGenerator)

Register an expression context generator class that will be used to retrieve an expression context for the button when required.

registerExpressionWidget(self, widget: QWidget)

Register a sibling widget (line edit, text edit) that will receive the property as an expression

Note

this should be called after calling init() to be correctly initialized.

registerVisibleWidget(self, widget: QWidget, natural: bool = True)

Register a sibling widget that gets visible when the property is active, and hidden when the property is inactive. if natural is false, widget gets hidden when the property is active, and visible when the property is inactive.

Note

this should be called after calling init() to be correctly initialized.

resizeEvent()
sender()
senderSignalIndex()
setActive(self, active: bool)

Set whether the current property override definition is to be used

setToProperty(self, property: QgsProperty)

Sets the widget to reflect the current state of a QgsProperty.

setUsageInfo(self, info: str)

Set the usage information for the property.

See also

usageInfo()

setVectorLayer(self, layer: QgsVectorLayer)

Sets the vector layer associated with the button. This controls which fields are displayed within the widget’s pop up menu.

See also

vectorLayer()

sharedPainter()
showEvent()
tabletEvent()
timerEvent()
toProperty(self) → QgsProperty

Returns a QgsProperty object encapsulating the current state of the widget.

See also

setToProperty()

updateFieldLists(self)

Updates list of fields.

New in version 3.0.

updateMicroFocus()
usageInfo(self) → str

Returns usage information for the property.

See also

setUsageInfo()

validDataType(self) → QgsPropertyDefinition.DataType

Returns the data type which the widget will accept. This is used to filter out fields from the associated vector layer to only show fields which are compatible with the property.

vectorLayer(self) → QgsVectorLayer

Returns the vector layer associated with the button. This controls which fields are displayed within the widget’s pop up menu.

See also

setVectorLayer()

wheelEvent()