Class: QgsFieldsItem

class qgis.core.QgsFieldsItem

Bases: QgsDataItem

A collection of field items with some internal logic to retrieve the fields and a the vector layer instance from a connection URI, the schema and the table name.

New in version 3.16.

QgsFieldsItem(parent: QgsDataItem, path: str, connectionUri: str, providerKey: str, schema: str, tableName: str) Constructor for QgsFieldsItem, with the specified parent item.

The path argument gives the item path in the browser tree. The path string can take any form, but QgsDataItem items pointing to different logical locations should always use a different item path. The connectionUri argument is the connection part of the layer URI that it is used internally to create a connection and retrieve fields information. The providerKey string can be used to specify the key for the QgsDataItemProvider that created this item. The schema and tableName are used to retrieve the layer and field information from the connectionUri.

Methods

canRenameFields

Returns True if the connection supports renaming fields.

childEvent

connectNotify

connectionUri

Returns the connection URI

createChildren

rtype:

List[QgsDataItem]

customEvent

deferredDelete

The item is scheduled to be deleted.

disconnectNotify

icon

rtype:

QIcon

isSignalConnected

layer

Creates and returns a (possibly NULL) layer from the connection URI and schema/table information

populate

receivers

refresh

Refresh the items from a specified list of child items.

schema

Returns the schema name

sender

senderSignalIndex

tableName

Returns the table name

tableProperty

Returns the (possibly NULL) properties of the table this fields belong to.

timerEvent

updateIcon

Will request a repaint of this icon.

canRenameFields(self) bool

Returns True if the connection supports renaming fields.

New in version 3.28.

Return type:

bool

childEvent(self, QChildEvent)
connectNotify(self, QMetaMethod)
connectionUri(self) str

Returns the connection URI

Return type:

str

createChildren(self) List[QgsDataItem]
Return type:

List[QgsDataItem]

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), the deferredDelete() returns True and item will be deleted once Populating finished. Items with slow reateChildren() (for example network or database based) may check during createChildren() if deferredDelete() returns True and return from createChildren() immediately because result will be useless.

disconnectNotify(self, QMetaMethod)
icon(self) QIcon
Return type:

QIcon

isSignalConnected(self, QMetaMethod) bool
layer(self) QgsVectorLayer

Creates and returns a (possibly NULL) layer from the connection URI and schema/table information

Return type:

QgsVectorLayer

populate(self, children: Iterable[QgsDataItem])
populate(self, foreground: bool = False) None
receivers(self, PYQT_SIGNAL) int
refresh(self, children: Iterable[QgsDataItem])

Refresh the items from a specified list of child items.

refresh(self)

schema(self) str

Returns the schema name

Return type:

str

sender(self) QObject
senderSignalIndex(self) int
tableName(self) str

Returns the table name

Return type:

str

tableProperty(self) QgsAbstractDatabaseProviderConnection.TableProperty

Returns the (possibly NULL) properties of the table this fields belong to.

New in version 3.16.

Return type:

QgsAbstractDatabaseProviderConnection.TableProperty

timerEvent(self, QTimerEvent)
updateIcon(self)

Will request a repaint of this icon.