Class: QgsDirectoryItem¶
- class qgis.core.QgsDirectoryItem(parent: QgsDataItem, name: str, path: str)¶
Bases:
QgsDataCollectionItem
Constructor for
QgsDirectoryItem
, with the specifiedparent
item.The
name
argument specifies the text to show in the model for the item. This is usually the directory name, but in certain cases may differ for special directories (e.g. “Home”). If a non-directory-name text is used, it should be a translated string when appropriate.The
path
argument specifies the directory path in the file system (e.g. “/home/gsherman/stuff”). A valid directory path must be specified.QgsDirectoryItem(parent:
QgsDataItem
, name: str, dirPath: str, path: str, providerKey: str = ‘’) Constructor forQgsDirectoryItem
, with the specifiedparent
item.The
name
argument specifies the text to show in the model for the item. This is usually the directory name, but in certain cases may differ for special directories (e.g. “Home”). If a non-directory-name text is used, it should be a translated string when appropriate.The
dirPath
argument specifies the directory path in the file system (e.g. “/home/gsherman/stuff”). A valid directory path must be specified.The
path
argument gives the item path in the browser tree. Thepath
string can take any form, but is usually the same asdirPath
ordirPath
with a prefix, e.g. “favorites:/home/gsherman/Downloads”). QgsDirectoryItem items pointing to differentdirPaths
should always use a different itempath
.The optional
providerKey
string can be used to specify the key for theQgsDataItemProvider
that created this item.A directory: contains subdirectories and layers
Methods
- rtype
object
The item is scheduled to be deleted.
Returns the full path to the directory the item represents.
- param other
- rtype
bool
Check if the given path is hidden from the browser model
Shared home directory icon.
- rtype
QIcon
- rtype
List[QgsMimeDataUtils.Uri]
Shared open directory icon.
- rtype
QWidget
Refresh the items from a specified list of child items.
- param state
Will request a repaint of this icon.
- childEvent(self, QChildEvent)¶
- childrenCreated(self)¶
- connectNotify(self, QMetaMethod)¶
- createChildren(self) → object¶
- Return type
object
- customEvent(self, QEvent)¶
- deferredDelete(self) → bool¶
The item is scheduled to be deleted. E.g. if
deleteLater()
is called when item is in Populating state (createChildren()
running in another thread), thedeferredDelete()
returnsTrue
and item will be deleted once Populating finished. Items with slowreateChildren()
(for example network or database based) may check duringcreateChildren()
ifdeferredDelete()
returnsTrue
and return fromcreateChildren()
immediately because result will be useless.
- dirPath(self) → str¶
Returns the full path to the directory the item represents.
- Return type
str
- directoryChanged(self)¶
- disconnectNotify(self, QMetaMethod)¶
- equal(self, other: QgsDataItem) → bool¶
- Parameters
other (QgsDataItem) –
- Return type
bool
- hasDragEnabled(self) → bool¶
- Return type
bool
Check if the given path is hidden from the browser model
- Parameters
path (str) –
- Return type
bool
- homeDirIcon() → QIcon¶
Shared home directory icon.
New in version 3.4.
- icon(self) → QIcon¶
- Return type
QIcon
- init(self)¶
- isSignalConnected(self, QMetaMethod) → bool¶
- mimeUris(self) → List[QgsMimeDataUtils.Uri]¶
- Return type
List[QgsMimeDataUtils.Uri]
- openDirIcon() → QIcon¶
Shared open directory icon.
New in version 3.4.
- paramWidget(self) → QWidget¶
- Return type
QWidget
- populate(self, children: object)¶
- populate(self, foreground: bool = False) → None
- receivers(self, PYQT_SIGNAL) → int¶
- refresh(self, children: object)¶
Refresh the items from a specified list of child items.
refresh(self)
- sender(self) → QObject¶
- senderSignalIndex(self) → int¶
- setState(self, state: QgsDataItem.State)¶
- Parameters
state (QgsDataItem.State) –
- timerEvent(self, QTimerEvent)¶
- updateIcon(self)¶
Will request a repaint of this icon.
New in version 3.0.