Subgroup: Layout
Class: QgsLayoutItemLabel¶
-
class
qgis.core.
QgsLayoutItemLabel
(layout: QgsLayout)¶ Bases:
qgis._core.QgsLayoutItem
Constructor for QgsLayoutItemLabel, with the specified parent
layout
.A layout item subclass for text labels.
New in version 3.0: Methods
adjustPointForReferencePosition
adjustSizeToText
Resizes the item so that the label’s text fits to the item. applyDataDefinedSize
applyItemSizeConstraint
boundingRect
childEvent
connectNotify
contextMenuEvent
create
Returns a new label item for the specified layout
.currentText
Returns the text as it appears on the label (with evaluated expressions and other dynamic content). customEvent
disconnectNotify
displayName
dragEnterEvent
dragLeaveEvent
dragMoveEvent
draw
drawBackground
drawDebugRect
drawFrame
dropEvent
focusInEvent
focusOutEvent
font
Returns the label’s current font. fontColor
Returns the label font color. hAlign
Returns the horizontal alignment of the label. hoverEnterEvent
hoverLeaveEvent
hoverMoveEvent
icon
inputMethodEvent
inputMethodQuery
isSignalConnected
itemChange
keyPressEvent
keyReleaseEvent
marginX
Returns the horizontal margin between the edge of the frame and the label contents, in layout units. marginY
Returns the vertical margin between the edge of the frame and the label contents, in layout units. mode
Returns the label’s current mode. mouseDoubleClickEvent
mouseMoveEvent
mousePressEvent
mouseReleaseEvent
positionAtReferencePoint
prepareGeometryChange
readObjectPropertiesFromElement
readPropertiesFromElement
receivers
refresh
refreshBackgroundColor
refreshBlendMode
refreshFrame
refreshItemPosition
refreshItemRotation
refreshItemSize
refreshOpacity
sceneEvent
sceneEventFilter
sender
senderSignalIndex
setFixedSize
setFont
Sets the label’s current font
.setFontColor
Sets the label font color
.setFrameEnabled
setFrameStrokeWidth
setHAlign
Sets the horizontal alignment
of the label.setMargin
Sets the margin
between the edge of the frame and the label contents.setMarginX
Sets the horizontal margin
between the edge of the frame and the label contents, in layout units.setMarginY
Sets the vertical margin
between the edge of the frame and the label contents, in layout units.setMinimumSize
setMode
Sets the label’s current mode
, allowing the label to switch between font based and HTML based rendering.setText
Sets the label’s preset text
.setVAlign
Sets for the vertical alignment
of the label.sizeForText
Returns the required item size (in layout units) for the label’s text to fill the item. text
Returns the label’s preset text. timerEvent
topLeftToReferencePoint
type
updateMicroFocus
vAlign
Returns for the vertical alignment of the label. wheelEvent
writeObjectPropertiesToElement
writePropertiesToElement
Signals
Attributes
ModeFont
ModeHtml
-
class
Mode
¶ Bases:
int
-
ModeFont
= 0¶
-
ModeHtml
= 1¶
-
adjustPointForReferencePosition
()¶
-
adjustSizeToText
(self)¶ Resizes the item so that the label’s text fits to the item. Keeps the top left point stationary.
See also
-
applyDataDefinedSize
()¶
-
applyItemSizeConstraint
()¶
-
boundingRect
(self) → QRectF¶
-
childEvent
()¶
-
connectNotify
()¶
-
contextMenuEvent
()¶
-
create
(layout: QgsLayout) → QgsLayoutItemLabel¶ Returns a new label item for the specified
layout
.The caller takes responsibility for deleting the returned object.
-
currentText
(self) → str¶ Returns the text as it appears on the label (with evaluated expressions and other dynamic content).
See also
-
customEvent
()¶
-
disconnectNotify
()¶
-
displayName
(self) → str¶
-
dragEnterEvent
()¶
-
dragLeaveEvent
()¶
-
dragMoveEvent
()¶
-
draw
(self, context: QgsLayoutItemRenderContext)¶
-
drawBackground
()¶
-
drawDebugRect
()¶
-
drawFrame
()¶
-
dropEvent
()¶
-
focusInEvent
()¶
-
focusOutEvent
()¶
-
fontColor
(self) → QColor¶ Returns the label font color.
See also
-
hAlign
(self) → Qt.AlignmentFlag¶ Returns the horizontal alignment of the label.
See also
See also
-
hoverEnterEvent
()¶
-
hoverLeaveEvent
()¶
-
hoverMoveEvent
()¶
-
icon
(self) → QIcon¶
-
inputMethodEvent
()¶
-
inputMethodQuery
()¶
-
isSignalConnected
()¶
-
itemChange
()¶
-
keyPressEvent
()¶
-
keyReleaseEvent
()¶
-
marginX
(self) → float¶ Returns the horizontal margin between the edge of the frame and the label contents, in layout units.
See also
See also
-
marginY
(self) → float¶ Returns the vertical margin between the edge of the frame and the label contents, in layout units.
See also
See also
-
mouseDoubleClickEvent
()¶
-
mouseMoveEvent
()¶
-
mousePressEvent
()¶
-
mouseReleaseEvent
()¶
-
positionAtReferencePoint
()¶
-
prepareGeometryChange
()¶
-
readObjectPropertiesFromElement
()¶
-
readPropertiesFromElement
(self, element: QDomElement, document: QDomDocument, context: QgsReadWriteContext) → bool¶
-
receivers
()¶
-
refresh
(self)¶
-
refreshBackgroundColor
()¶
-
refreshBlendMode
()¶
-
refreshFrame
()¶
-
refreshItemPosition
()¶
-
refreshItemRotation
()¶
-
refreshItemSize
()¶
-
refreshOpacity
()¶
-
sceneEvent
()¶
-
sceneEventFilter
()¶
-
sender
()¶
-
senderSignalIndex
()¶
-
setFixedSize
()¶
-
setFontColor
(self, color: Union[QColor, Qt.GlobalColor])¶ Sets the label font
color
.See also
-
setFrameEnabled
(self, drawFrame: bool)¶
-
setFrameStrokeWidth
(self, strokeWidth: QgsLayoutMeasurement)¶
-
setHAlign
(self, alignment: Qt.AlignmentFlag)¶ Sets the horizontal
alignment
of the label.See also
See also
-
setMargin
(self, margin: float)¶ Sets the
margin
between the edge of the frame and the label contents. This method sets both the horizontal and vertical margins to the same value. The margins can be individually controlled using the setMarginX() and setMarginY() methods.Margins are set using the current layout units.
See also
See also
-
setMarginX
(self, margin: float)¶ Sets the horizontal
margin
between the edge of the frame and the label contents, in layout units.See also
See also
-
setMarginY
(self, margin: float)¶ Sets the vertical
margin
between the edge of the frame and the label contents, in layout units.See also
See also
-
setMinimumSize
()¶
-
setMode
(self, mode: QgsLayoutItemLabel.Mode)¶ Sets the label’s current
mode
, allowing the label to switch between font based and HTML based rendering.See also
-
setVAlign
(self, alignment: Qt.AlignmentFlag)¶ Sets for the vertical
alignment
of the label.See also
See also
-
sizeForText
(self) → QSizeF¶ Returns the required item size (in layout units) for the label’s text to fill the item.
See also
-
text
(self) → str¶ Returns the label’s preset text.
See also
See also
-
timerEvent
()¶
-
topLeftToReferencePoint
()¶
-
type
(self) → int¶
-
updateMicroFocus
()¶
-
vAlign
(self) → Qt.AlignmentFlag¶ Returns for the vertical alignment of the label.
See also
See also
-
wheelEvent
()¶
-
writeObjectPropertiesToElement
()¶
-
writePropertiesToElement
(self, element: QDomElement, document: QDomDocument, context: QgsReadWriteContext) → bool¶
-
class