Class: QgsDataItemProvider¶
- class qgis.core.QgsDataItemProvider¶
Bases:
sip.wrapper
This is the interface for those who want to add custom data items to the browser tree.
The method
createDataItem()
is ever called only ifcapabilities()
return non-zero value. There are two occasions whencreateDataItem()
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 leastof the following:
QgsDataProvider
.Dir orQgsDataProvider
.File. Passed path is the file or directory being inspected, parent item is a validQgsDirectoryItem
Methods
Returns combination of flags from
QgsDataProvider
.DataCapabilitiesCreate a new instance of
QgsDataItem
(orNone
) for given path and parent item.Create a vector of instances of
QgsDataItem
(orNone
) for given path and parent item.Returns the data provider key (if the data item provider is associated with a data provider), the default implementation returns an empty string.
Returns
True
if the provider will handle the directory at the specifiedpath
.Human-readable name of the provider name
- capabilities(self) → int¶
Returns combination of flags from
QgsDataProvider
.DataCapabilities- Return type
int
- createDataItem(self, path: str, parentItem: QgsDataItem) → QgsDataItem¶
Create a new instance of
QgsDataItem
(orNone
) for given path and parent item. Caller takes responsibility of deleting created items.- Parameters
path (str) –
parentItem (QgsDataItem) –
- Return type
- createDataItems(self, path: str, parentItem: QgsDataItem) → object¶
Create a vector of instances of
QgsDataItem
(orNone
) for given path and parent item. Caller takes responsibility of deleting created items.- Parameters
path (str) –
parentItem (QgsDataItem) –
- Return type
object
- dataProviderKey(self) → str¶
Returns the data provider key (if the data item provider is associated with a data provider), the default implementation returns an empty string.
New in version 3.14.
- Return type
str
- handlesDirectoryPath(self, path: str) → bool¶
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.New in version 3.0.
- Parameters
path (str) –
- Return type
bool
- name(self) → str¶
Human-readable name of the provider name
- Return type
str