Subgroup: Message

Class: QgsMessageBar

class qgis.gui.QgsMessageBar

Bases: PyQt5.QtWidgets.QFrame

A bar for displaying non-blocking messages to the user.

Methods

acceptDrops
accessibleDescription
accessibleName
actionEvent
actions
activateWindow
addAction
addActions
adjustSize
autoFillBackground
backgroundRole
baseSize
blockSignals
changeEvent
childAt childAt(self, int, int) -> QWidget
childEvent
children
childrenRect
childrenRegion
clearFocus
clearMask
clearWidgets Remove all items from the bar’s widget list
close
closeEvent
colorCount
connectNotify
contentsMargins
contentsRect
contextMenuEvent
contextMenuPolicy
create
createMessage make out a widget containing a message to be displayed on the bar
createWindowContainer
currentItem
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
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
hasTabletTracking
height
heightForWidth
heightMM
hide
hideEvent
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
mask
maximumHeight
maximumSize
maximumWidth
metaObject
metric
midLineWidth
minimumHeight
minimumSize
minimumSizeHint
minimumWidth
mouseDoubleClickEvent
mouseGrabber
mouseMoveEvent
mousePressEvent
mouseReleaseEvent
move move(self, int, int)
moveEvent
moveToThread
nativeEvent
nativeParentWidget
nextInFocusChain
normalGeometry
objectName
overrideWindowFlags
overrideWindowState
paintEngine
paintEvent
paintingActive
palette
parent
parentWidget
physicalDpiX
physicalDpiY
popWidget Remove the passed widget from the bar (if previously added),
pos
previousInFocusChain
property
pushCritical Pushes a critical warning with default timeout to the message bar
pushInfo Pushes a information message with default timeout to the message bar
pushItem Display a message item on the bar after hiding the currently visible one and putting it in a stack.
pushMessage convenience method for pushing a message to the bar
pushSuccess Pushes a success message with default timeout to the message bar
pushWarning Pushes a warning with default timeout to the message bar
pushWidget Display a widget as a message on the bar after hiding the currently visible one and putting it in a stack.
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
scroll scroll(self, int, int, QRect)
sender
senderSignalIndex
setAcceptDrops
setAccessibleDescription
setAccessibleName
setAttribute
setAutoFillBackground
setBackgroundRole
setBaseSize setBaseSize(self, QSize)
setContentsMargins setContentsMargins(self, QMargins)
setContextMenuPolicy
setCursor
setDisabled
setEnabled
setFixedHeight
setFixedSize setFixedSize(self, int, int)
setFixedWidth
setFocus setFocus(self, Qt.FocusReason)
setFocusPolicy
setFocusProxy
setFont
setForegroundRole
setFrameRect
setFrameShadow
setFrameShape
setFrameStyle
setGeometry setGeometry(self, int, int, int, int)
setGraphicsEffect
setHidden
setInputMethodHints
setLayout
setLayoutDirection
setLineWidth
setLocale
setMask setMask(self, QRegion)
setMaximumHeight
setMaximumSize setMaximumSize(self, QSize)
setMaximumWidth
setMidLineWidth
setMinimumHeight
setMinimumSize setMinimumSize(self, QSize)
setMinimumWidth
setMouseTracking
setObjectName
setPalette
setParent setParent(self, QWidget, Union[Qt.WindowFlags, Qt.WindowType])
setProperty
setShortcutAutoRepeat
setShortcutEnabled
setSizeIncrement setSizeIncrement(self, QSize)
setSizePolicy setSizePolicy(self, QSizePolicy.Policy, QSizePolicy.Policy)
setStatusTip
setStyle
setStyleSheet
setTabOrder
setTabletTracking
setToolTip
setToolTipDuration
setUpdatesEnabled
setVisible
setWhatsThis
setWindowFilePath
setWindowFlag
setWindowFlags
setWindowIcon
setWindowIconText
setWindowModality
setWindowModified
setWindowOpacity
setWindowRole
setWindowState
setWindowTitle
sharedPainter
show
showEvent
showFullScreen
showMaximized
showMinimized
showNormal
signalsBlocked
size
sizeHint
sizeIncrement
sizePolicy
stackUnder
startTimer
statusTip
style
styleSheet
tabletEvent
testAttribute
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
x
y

Attributes

Box
CRITICAL
DrawChildren
DrawWindowBackground
HLine
INFO
IgnoreMask
NoFrame
Panel
PdmDepth
PdmDevicePixelRatio
PdmDevicePixelRatioScaled
PdmDpiX
PdmDpiY
PdmHeight
PdmHeightMM
PdmNumColors
PdmPhysicalDpiX
PdmPhysicalDpiY
PdmWidth
PdmWidthMM
Plain
Raised
SUCCESS
Shadow_Mask
Shape_Mask
StyledPanel
Sunken
VLine
WARNING
WinPanel
customContextMenuRequested customContextMenuRequested(self, QPoint) [signal]
destroyed destroyed(self, QObject = None) [signal]
objectNameChanged objectNameChanged(self, str) [signal]
staticMetaObject
widgetAdded emitted when a message widget is added to the bar [signal]
widgetRemoved emitted when a message widget was removed from the bar [signal]
windowIconChanged windowIconChanged(self, QIcon) [signal]
windowIconTextChanged windowIconTextChanged(self, str) [signal]
windowTitleChanged windowTitleChanged(self, str) [signal]
CRITICAL = 2
INFO = 0
class MessageLevel

Bases: int

SUCCESS = 3
WARNING = 1
actionEvent()
changeEvent()
childEvent()
clearWidgets(self) → bool

Remove all items from the bar’s widget list

Returns:true if all items were removed, false otherwise
closeEvent()
connectNotify()
contextMenuEvent()
create()
createMessage(text: str, parent: QWidget = None) → QgsMessageBarItem

make out a widget containing a message to be displayed on the bar

createMessage(title: str, text: str, parent: QWidget = None) -> QgsMessageBarItem make out a widget containing title and message to be displayed on the bar

createMessage(widget: QWidget, parent: QWidget = None) -> QgsMessageBarItem make out a widget containing title and message to be displayed on the bar

currentItem(self) → QgsMessageBarItem
customEvent()
destroy()
disconnectNotify()
dragEnterEvent()
dragLeaveEvent()
dragMoveEvent()
drawFrame()
dropEvent()
enterEvent()
event()
focusInEvent()
focusNextChild()
focusNextPrevChild()
focusOutEvent()
focusPreviousChild()
hideEvent()
initPainter()
initStyleOption()
inputMethodEvent()
isSignalConnected()
keyPressEvent()
keyReleaseEvent()
leaveEvent()
metric()
mouseDoubleClickEvent()
mouseMoveEvent()
mousePressEvent(self, e: QMouseEvent)
mouseReleaseEvent()
moveEvent()
nativeEvent()
paintEvent()
popWidget(self, item: QgsMessageBarItem) → bool

Remove the passed widget from the bar (if previously added), then display the next one in the stack if any or hide the bar

Parameters:item – item to remove
Returns:true if the widget was removed, false otherwise

popWidget(self) -> bool Remove the currently displayed widget from the bar and display the next in the stack if any or hide the bar.

Returns:true if the widget was removed, false otherwise
pushCritical(self, title: str, message: str)

Pushes a critical warning with default timeout to the message bar

Parameters:
  • title – title string for message
  • message – The message to be displayed

New in version 2.8.

pushInfo(self, title: str, message: str)

Pushes a information message with default timeout to the message bar

Parameters:
  • title – title string for message
  • message – The message to be displayed

New in version 2.8.

pushItem(self, item: QgsMessageBarItem)

Display a message item on the bar after hiding the currently visible one and putting it in a stack. The message bar will take ownership of the item.

Parameters:item – Item to display
pushMessage(self, text: str, level: QgsMessageBar.MessageLevel = QgsMessageBar.INFO, duration: int = 5)

convenience method for pushing a message to the bar

pushMessage(self, title: str, text: str, level: QgsMessageBar.MessageLevel = QgsMessageBar.INFO, duration: int = 5) convenience method for pushing a message with title to the bar

pushSuccess(self, title: str, message: str)

Pushes a success message with default timeout to the message bar

Parameters:
  • title – title string for message
  • message – The message to be displayed

New in version 2.8.

pushWarning(self, title: str, message: str)

Pushes a warning with default timeout to the message bar

Parameters:
  • title – title string for message
  • message – The message to be displayed

New in version 2.8.

pushWidget(self, widget: QWidget, level: QgsMessageBar.MessageLevel = QgsMessageBar.INFO, duration: int = 0) → QgsMessageBarItem

Display a widget as a message on the bar after hiding the currently visible one and putting it in a stack.

Parameters:
  • widget – message widget to display
  • level – is QgsMessageBar.INFO, WARNING, CRITICAL or SUCCESS
  • duration – timeout duration of message in seconds, 0 value indicates no timeout
receivers()
resizeEvent()
sender()
senderSignalIndex()
sharedPainter()
showEvent()
tabletEvent()
timerEvent()
updateMicroFocus()
wheelEvent()
widgetAdded

emitted when a message widget is added to the bar [signal]

widgetRemoved

emitted when a message widget was removed from the bar [signal]