Class: QgsHistoryEntryNode¶
Base class for nodes representing a QgsHistoryEntry.
Added in version 3.32.
Note
This is an abstract class, with methods which must be implemented by a subclass.
The following methods must be implemented: data()
Class Hierarchy¶
Subclasses¶
Base class for history entry “group” nodes, which contain children of their own. |
Abstract Methods
Returns the node's data for the specified model role. |
Methods
Returns the node's parent node. |
Virtual Methods
In PyQGIS, only methods marked as virtual can be safely overridden in a Python subclass of QgsHistoryEntryNode. See the FAQ for more details.
Returns the number of child nodes owned by this node. |
|
Returns a new widget which should be shown to users when selecting the node. |
|
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. |
|
Allows the node to populate a context menu before display to the user. |
- class qgis.gui.QgsHistoryEntryNode[source]¶
Bases:
object- virtual childCount(self) int[source]¶
Returns the number of child nodes owned by this node.
- Return type:
int
- virtual createWidget(self, context: QgsHistoryWidgetContext) QWidget | None[source]¶
Returns a new widget which should be shown to users when selecting the node.
If a
Noneis returned, the node’shtml()method will be called instead to create the node’s content.See also
- Parameters:
context (QgsHistoryWidgetContext)
- Return type:
Optional[QWidget]
- abstract data(self, role: int = Qt.DisplayRole) Any[source]¶
Returns the node’s data for the specified model
role.- Parameters:
role (int = Qt.DisplayRole)
- Return type:
Any
- virtual doubleClicked(self, context: QgsHistoryWidgetContext) bool[source]¶
Called when the node is double-clicked. The default implementation does nothing.
Returns
Trueif the node handled the double-click event and it should not be further processed.- Parameters:
context (QgsHistoryWidgetContext)
- Return type:
bool
- virtual html(self, context: QgsHistoryWidgetContext) str[source]¶
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
- virtual matchesString(self, searchString: str | None) bool[source]¶
Returns true if the node matches the specified
searchString, and should be shown in filtered results with that search string.The default implementation returns
Trueif the string is contained within the node’s DisplayRole.- Parameters:
searchString (Optional[str])
- Return type:
bool
- parent(self) QgsHistoryEntryGroup | None[source]¶
Returns the node’s parent node.
If parent is
None, the node is a root node.- Return type:
Optional[QgsHistoryEntryGroup]
- virtual populateContextMenu(self, menu: QMenu | None, context: QgsHistoryWidgetContext)[source]¶
Allows the node to populate a context
menubefore display to the user.Actions should be parented to the specified
menu.- Parameters:
menu (Optional[QMenu])
context (QgsHistoryWidgetContext)