Class: QgsHistoryEntryNode¶
- class qgis.gui.QgsHistoryEntryNode¶
Bases:
sip.wrapper
Base class for nodes representing a
QgsHistoryEntry
.New in version 3.32.
QgsHistoryEntryNode() Constructor for QgsHistoryEntryNode.
Methods
Returns the number of child nodes owned by this node.
Returns a new widget which should be shown to users when selecting the node.
Returns the node's data for the specified model
role
.Called when the node is double-clicked.
Returns a HTML formatted text string which should be shown to a user when selecting the node.
Returns true if the node matches the specified
searchString
, and should be shown in filtered results with that search string.Returns the node's parent node.
Allows the node to populate a context
menu
before display to the user.- childCount(self) int ¶
Returns the number of child nodes owned by this node.
- Return type:
int
- createWidget(self, context: QgsHistoryWidgetContext) QWidget ¶
Returns a new widget which should be shown to users when selecting the node.
If a
None
is returned, the node’shtml()
method will be called instead to create the node’s content.See also
- Parameters:
context (QgsHistoryWidgetContext) –
- Return type:
QWidget
- data(self, role: int = Qt.DisplayRole) Any ¶
Returns the node’s data for the specified model
role
.- Parameters:
role (int = Qt.DisplayRole) –
- Return type:
Any
- doubleClicked(self, context: QgsHistoryWidgetContext) bool ¶
Called when the node is double-clicked. The default implementation does nothing.
Returns
True
if the node handled the double-click event and it should not be further processed.- Parameters:
context (QgsHistoryWidgetContext) –
- Return type:
bool
- html(self, context: QgsHistoryWidgetContext) str ¶
Returns a HTML formatted text string which should be shown to a user when selecting the node.
Subclasses should implement this method or
createWidget()
, but not both.See also
- Parameters:
context (QgsHistoryWidgetContext) –
- Return type:
str
- matchesString(self, searchString: str) bool ¶
Returns true if the node matches the specified
searchString
, and should be shown in filtered results with that search string.The default implementation returns
True
if the string is contained within the node’s DisplayRole.- Parameters:
searchString (str) –
- Return type:
bool
- parent(self) QgsHistoryEntryGroup ¶
Returns the node’s parent node.
If parent is
None
, the node is a root node.- Return type:
- populateContextMenu(self, menu: QMenu, context: QgsHistoryWidgetContext)¶
Allows the node to populate a context
menu
before display to the user.Actions should be parented to the specified
menu
.- Parameters:
menu (QMenu) –
context (QgsHistoryWidgetContext) –