Class: QgsDataItemProvider¶
Interface for providers that add custom data items to the browser tree.
The method createDataItem()
is ever called only if
capabilities()
return non-zero value. There are two occasions
when createDataItem()
is called:
to create root items (passed path is empty, parent item is
None
).to create items in directory structure. For this capabilities have to return at least of the following:
QgsDataProvider
.Dir orQgsDataProvider
.File. Passed path is the file or directory being inspected, parent item is a validQgsDirectoryItem
Note
This is an abstract class, with methods which must be implemented by a subclass.
The following methods must be implemented: capabilities()
, createDataItem()
, name()
Abstract Methods
Returns combination of flags from |
|
Create a new instance of |
|
Human-readable name of the provider name |
Virtual Methods
In PyQGIS, only methods marked as virtual
can be safely overridden in a Python subclass of QgsDataItemProvider. See the FAQ for more details.
Create a vector of instances of |
|
Returns the data provider key (if the data item provider is associated with a data provider), the default implementation returns an empty string. |
|
Returns |
- class qgis.core.QgsDataItemProvider[source]¶
Bases:
object
- abstract capabilities(self) Qgis.DataItemProviderCapabilities [source]¶
Returns combination of flags from
QgsDataProvider
.DataCapabilities- Return type:
- abstract createDataItem(self, path: str | None, parentItem: QgsDataItem | None) QgsDataItem | None [source]¶
Create a new instance of
QgsDataItem
(orNone
) for given path and parent item. Caller takes responsibility of deleting created items.- Parameters:
path (Optional[str])
parentItem (Optional[QgsDataItem])
- Return type:
Optional[QgsDataItem]
- virtual createDataItems(self, path: str | None, parentItem: QgsDataItem | None) List[QgsDataItem] ¶
Create a vector of instances of
QgsDataItem
(orNone
) for given path and parent item. Caller takes responsibility of deleting created items.- Parameters:
path (Optional[str])
parentItem (Optional[QgsDataItem])
- Return type:
List[QgsDataItem]
- virtual dataProviderKey(self) str [source]¶
Returns the data provider key (if the data item provider is associated with a data provider), the default implementation returns an empty string.
Added in version 3.14.
- Return type:
str
- virtual handlesDirectoryPath(self, path: str | None) bool [source]¶
Returns
True
if the provider will handle the directory at the specifiedpath
.If the provider indicates that it will handle the directory, the default creation and population of directory items for the path will be avoided and it is left to the provider to correctly populate relevant entries for the path.
The default implementation returns
False
for all paths.- Parameters:
path (Optional[str])
- Return type:
bool