A class for displaying logging messages.
LogWidget is a simple class to be plugged in a LogView.
It displays lines of text without interpretation of richtext or html tags.
Neither are special characters like newlines or tabs interpreted.
The widget can either store all the strings sent to it (the default) or
can limit the number of lines to store. In this case the oldest lines
are discarded when new lines arrive.
To use a LogWidget create an instance of LogView and add the
LogWidgets to this object (a LogView can hold more than a single
LogWidget).
Methods
|
|
__init__
append
clear
handleSetMaxLines
paintEvent
preferredBackgroundColor
|
|
__init__
|
__init__ (
self,
parent=None,
name=None,
)
Constructor
Arguments
- parent
- parent widget (QWidget)
- name
- name of this widget (string or QString)
|
|
append
|
append ( self, text )
Public method to append text to the messages.
When the LogWidget is already
scrolled to the bottom, it will further scroll down to display the newly
added line. If the scrolling position is not at the end, this position is
not changed.
Arguments
- text
- text to be appended (string or QString)
|
|
clear
|
clear ( self )
Public method to delete all strings from the internal buffer and clears the display.
|
|
handleSetMaxLines
|
handleSetMaxLines ( self, val )
Sets the maximum number of lines to be shown.
Arguments
- val
- maximum number of lines to be displayed
If val is <= 0 then there will be no limit. If the maximum number
of lines is appended, the oldest are discarded.
|
|
paintEvent
|
paintEvent ( self, evt )
Reimplemented for custom painting.
|
|
preferredBackgroundColor
|
preferredBackgroundColor ( self )
Reimplemented to return colorgroup().base().
Returns
preferred background colour (QColor)
|
|