Subgroup: Text

Class: QgsTextPreview

class qgis.gui.QgsTextPreview

Bases: PyQt5.QtWidgets.QLabel

A widget for previewing text formatting settings.

QgsTextPreview provides a widget for previewing the appearance of text rendered using QgsTextRenderer. The preview includes all settings contained within a QgsTextFormat, including shadow, background and buffer.

In order to preview the exact appearance of text which uses sizes in map units, the scale and map units must be set by calling setScale() and setMapUnits().

New in version 3.0: Methods

acceptDrops
accessibleDescription
accessibleName
actionEvent
actions
activateWindow
addAction
addActions
adjustSize
alignment
autoFillBackground
backgroundRole
baseSize
blockSignals
buddy
changeEvent
childAt childAt(self, int, int) -> QWidget
childEvent
children
childrenRect
childrenRegion
clear
clearFocus
clearMask
close
closeEvent
colorCount
connectNotify
contentsMargins
contentsRect
contextMenuEvent
contextMenuPolicy
create
createWindowContainer
cursor
customEvent
deleteLater
depth
destroy
devType
devicePixelRatio
devicePixelRatioF
devicePixelRatioFScale
disconnect
disconnectNotify
dragEnterEvent
dragLeaveEvent
dragMoveEvent
drawFrame
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
format Returns the text format used for previewing text in the widget.
frameGeometry
frameRect
frameShadow
frameShape
frameSize
frameStyle
frameWidth
geometry
getContentsMargins
grab
grabGesture
grabKeyboard
grabMouse grabMouse(self, Union[QCursor, Qt.CursorShape])
grabShortcut
graphicsEffect
graphicsProxyWidget
hasFocus
hasHeightForWidth
hasMouseTracking
hasScaledContents
hasSelectedText
hasTabletTracking
height
heightForWidth
heightMM
hide
hideEvent
indent
inherits
initPainter
initStyleOption
inputMethodEvent
inputMethodHints
inputMethodQuery
insertAction
insertActions
installEventFilter
isActiveWindow
isAncestorOf
isEnabled
isEnabledTo
isFullScreen
isHidden
isLeftToRight
isMaximized
isMinimized
isModal
isRightToLeft
isSignalConnected
isVisible
isVisibleTo
isWidgetType
isWindow
isWindowModified
isWindowType
keyPressEvent
keyReleaseEvent
keyboardGrabber
killTimer
layout
layoutDirection
leaveEvent
lineWidth
locale
logicalDpiX
logicalDpiY
lower
mapFrom
mapFromGlobal
mapFromParent
mapTo
mapToGlobal
mapToParent
mapUnits Returns the map unit type used for previewing format sizes in map units.
margin
mask
maximumHeight
maximumSize
maximumWidth
metaObject
metric
midLineWidth
minimumHeight
minimumSize
minimumSizeHint
minimumWidth
mouseDoubleClickEvent
mouseGrabber
mouseMoveEvent
mousePressEvent
mouseReleaseEvent
move move(self, int, int)
moveEvent
moveToThread
movie
nativeEvent
nativeParentWidget
nextInFocusChain
normalGeometry
objectName
openExternalLinks
overrideWindowFlags
overrideWindowState
paintEngine
paintEvent
paintingActive
palette
parent
parentWidget
physicalDpiX
physicalDpiY
picture
pixmap
pos
previousInFocusChain
property
pyqtConfigure Each keyword argument is either the name of a Qt property or a Qt signal.
raise_
receivers
rect
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
scale Returns the scale used for previewing format sizes in map units.
scroll scroll(self, int, int, QRect)
selectedText
selectionStart
sender
senderSignalIndex
setAcceptDrops
setAccessibleDescription
setAccessibleName
setAlignment
setAttribute
setAutoFillBackground
setBackgroundRole
setBaseSize setBaseSize(self, QSize)
setBuddy
setContentsMargins setContentsMargins(self, QMargins)
setContextMenuPolicy
setCursor
setDisabled
setEnabled
setFixedHeight
setFixedSize setFixedSize(self, int, int)
setFixedWidth
setFocus setFocus(self, Qt.FocusReason)
setFocusPolicy
setFocusProxy
setFont
setForegroundRole
setFormat Sets the text format for previewing in the widget.
setFrameRect
setFrameShadow
setFrameShape
setFrameStyle
setGeometry setGeometry(self, int, int, int, int)
setGraphicsEffect
setHidden
setIndent
setInputMethodHints
setLayout
setLayoutDirection
setLineWidth
setLocale
setMapUnits Sets the map unit type for previewing format sizes in map units.
setMargin
setMask setMask(self, QRegion)
setMaximumHeight
setMaximumSize setMaximumSize(self, QSize)
setMaximumWidth
setMidLineWidth
setMinimumHeight
setMinimumSize setMinimumSize(self, QSize)
setMinimumWidth
setMouseTracking
setMovie
setNum setNum(self, int)
setObjectName
setOpenExternalLinks
setPalette
setParent setParent(self, QWidget, Union[Qt.WindowFlags, Qt.WindowType])
setPicture
setPixmap
setProperty
setScale Sets the scale to use for previewing format sizes in map units.
setScaledContents
setSelection
setShortcutAutoRepeat
setShortcutEnabled
setSizeIncrement setSizeIncrement(self, QSize)
setSizePolicy setSizePolicy(self, QSizePolicy.Policy, QSizePolicy.Policy)
setStatusTip
setStyle
setStyleSheet
setTabOrder
setTabletTracking
setText
setTextFormat
setTextInteractionFlags
setToolTip
setToolTipDuration
setUpdatesEnabled
setVisible
setWhatsThis
setWindowFilePath
setWindowFlag
setWindowFlags
setWindowIcon
setWindowIconText
setWindowModality
setWindowModified
setWindowOpacity
setWindowRole
setWindowState
setWindowTitle
setWordWrap
sharedPainter
show
showEvent
showFullScreen
showMaximized
showMinimized
showNormal
signalsBlocked
size
sizeHint
sizeIncrement
sizePolicy
stackUnder
startTimer
statusTip
style
styleSheet
tabletEvent
testAttribute
text
textFormat
textInteractionFlags
thread
timerEvent
toolTip
toolTipDuration
tr
underMouse
ungrabGesture
unsetCursor
unsetLayoutDirection
unsetLocale
update update(self, QRect)
updateGeometry
updateMicroFocus
updatesEnabled
visibleRegion
whatsThis
wheelEvent
width
widthMM
winId
window
windowFilePath
windowFlags
windowHandle
windowIcon
windowIconText
windowModality
windowOpacity
windowRole
windowState
windowTitle
windowType
wordWrap
x
y

Attributes

Box
DrawChildren
DrawWindowBackground
HLine
IgnoreMask
NoFrame
Panel
PdmDepth
PdmDevicePixelRatio
PdmDevicePixelRatioScaled
PdmDpiX
PdmDpiY
PdmHeight
PdmHeightMM
PdmNumColors
PdmPhysicalDpiX
PdmPhysicalDpiY
PdmWidth
PdmWidthMM
Plain
Raised
Shadow_Mask
Shape_Mask
StyledPanel
Sunken
VLine
WinPanel
customContextMenuRequested customContextMenuRequested(self, QPoint) [signal]
destroyed destroyed(self, QObject = None) [signal]
linkActivated linkActivated(self, str) [signal]
linkHovered linkHovered(self, str) [signal]
objectNameChanged objectNameChanged(self, str) [signal]
staticMetaObject
windowIconChanged windowIconChanged(self, QIcon) [signal]
windowIconTextChanged windowIconTextChanged(self, str) [signal]
windowTitleChanged windowTitleChanged(self, str) [signal]
actionEvent()
changeEvent()
childEvent()
closeEvent()
connectNotify()
contextMenuEvent()
create()
customEvent()
destroy()
disconnectNotify()
dragEnterEvent()
dragLeaveEvent()
dragMoveEvent()
drawFrame()
dropEvent()
enterEvent()
event()
focusInEvent()
focusNextChild()
focusNextPrevChild()
focusOutEvent()
focusPreviousChild()
format(self) → QgsTextFormat

Returns the text format used for previewing text in the widget.

See also

setFormat()

hideEvent()
initPainter()
initStyleOption()
inputMethodEvent()
isSignalConnected()
keyPressEvent()
keyReleaseEvent()
leaveEvent()
mapUnits(self) → QgsUnitTypes.DistanceUnit

Returns the map unit type used for previewing format sizes in map units.

See also

setMapUnits()

See also

scale()

metric()
mouseDoubleClickEvent()
mouseMoveEvent()
mousePressEvent()
mouseReleaseEvent()
moveEvent()
nativeEvent()
paintEvent(self, e: QPaintEvent)
receivers()
resizeEvent()
scale(self) → float

Returns the scale used for previewing format sizes in map units. The scale value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map.

See also

setScale()

See also

mapUnits()

sender()
senderSignalIndex()
setFormat(self, format: QgsTextFormat)

Sets the text format for previewing in the widget.

Parameters:format – text format

See also

format()

setMapUnits(self, unit: QgsUnitTypes.DistanceUnit)

Sets the map unit type for previewing format sizes in map units.

Parameters:unit – map units

See also

mapUnits()

See also

setScale()

setScale(self, scale: float)

Sets the scale to use for previewing format sizes in map units. The scale value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map.

See also

scale()

See also

setMapUnits()

sharedPainter()
showEvent()
tabletEvent()
timerEvent()
updateMicroFocus()
wheelEvent()