Subgroup: other

Class: QgsBrowserModel

class qgis.core.QgsBrowserModel(parent: QObject = None)

Bases: PyQt5.QtCore.QAbstractItemModel

Methods

addFavoriteDirectory Adds a directory to the favorites group.
addRootItems Populates the model
beginInsertColumns
beginInsertItems
beginInsertRows
beginMoveColumns
beginMoveRows
beginRemoveColumns
beginRemoveItems
beginRemoveRows
beginResetModel
blockSignals
buddy
canDropMimeData
canFetchMore
changePersistentIndex
changePersistentIndexList
childEvent
children
columnCount Provides the number of columns of data exposed by the model.
connectItem
connectNotify
createIndex
customEvent
data Used to supply item data to views and delegates.
dataItem
decodeData
deleteLater
disconnect
disconnectNotify
dropMimeData Handles the data supplied by a drag and drop operation that ended with the given action
dumpObjectInfo
dumpObjectTree
dynamicPropertyNames
encodeData
endInsertColumns
endInsertItems
endInsertRows
endMoveColumns
endMoveRows
endRemoveColumns
endRemoveItems
endRemoveRows
endResetModel
event
eventFilter
fetchMore
findChild findChild(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> QObject
findChildren findChildren(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject]
findItem
findPath Return index of item with given path.
flags Used by other components to obtain information about each item provided by the model.
hasChildren
hasIndex
headerData Provides views with information to show in their headers.
hidePath Hide the given path in the browser model
index Returns the index of the item in the model specified by the given row, column and parent index.
inherits
initialize Delayed initialization, needed because the provider registry must be already populated
initialized Returns true if the model has been initialized
insertColumn
insertColumns
insertRow
insertRows
installEventFilter
isSignalConnected
isWidgetType
isWindowType
itemData
itemDataChanged
itemStateChanged
killTimer
match
metaObject
mimeData Returns an object that contains serialized items of data corresponding to the list of indexes specified
mimeTypes Returns a list of mime that can describe model indexes
moveColumn
moveColumns
moveRow
moveRows
moveToThread
objectName
parent Returns the parent of the model item with the given index.
persistentIndexList
property
pyqtConfigure Each keyword argument is either the name of a Qt property or a Qt signal.
receivers
refresh Refresh item specified by path
reload Reload the whole model
removeColumn
removeColumns
removeEventFilter
removeFavorite Removes a favorite directory from its corresponding model index.
removeRootItems
removeRow
removeRows
resetInternalData
revert
roleNames
rowCount Provides the number of rows of data exposed by the model.
sender
senderSignalIndex
setData
setHeaderData
setItemData
setObjectName
setParent
setProperty
sibling
signalsBlocked
sort
span
startTimer
submit
supportedDragActions
supportedDropActions
thread
timerEvent
tr
updateProjectHome

Attributes

CommentRole
HorizontalSortHint
NoLayoutChangeHint
PathRole
SortRole
VerticalSortHint
columnsAboutToBeInserted columnsAboutToBeInserted(self, QModelIndex, int, int) [signal]
columnsAboutToBeMoved columnsAboutToBeMoved(self, QModelIndex, int, int, QModelIndex, int) [signal]
columnsAboutToBeRemoved columnsAboutToBeRemoved(self, QModelIndex, int, int) [signal]
columnsInserted columnsInserted(self, QModelIndex, int, int) [signal]
columnsMoved columnsMoved(self, QModelIndex, int, int, QModelIndex, int) [signal]
columnsRemoved columnsRemoved(self, QModelIndex, int, int) [signal]
connectionsChanged Connections changed in the browser, forwarded to the widget and used to
dataChanged dataChanged(self, QModelIndex, QModelIndex, Iterable[int] = []) [signal]
destroyed destroyed(self, QObject = None) [signal]
layoutAboutToBeChanged layoutAboutToBeChanged(self, object = QList<QPersistentModelIndex>(), QAbstractItemModel.LayoutChangeHint = QAbstractItemModel.NoLayoutChangeHint) [signal]
layoutChanged layoutChanged(self, Iterable[QPersistentModelIndex] = [], QAbstractItemModel.LayoutChangeHint = QAbstractItemModel.NoLayoutChangeHint) [signal]
modelAboutToBeReset modelAboutToBeReset(self) [signal]
modelReset modelReset(self) [signal]
objectNameChanged objectNameChanged(self, str) [signal]
rowsAboutToBeInserted rowsAboutToBeInserted(self, QModelIndex, int, int) [signal]
rowsAboutToBeMoved rowsAboutToBeMoved(self, QModelIndex, int, int, QModelIndex, int) [signal]
rowsAboutToBeRemoved rowsAboutToBeRemoved(self, QModelIndex, int, int) [signal]
rowsInserted rowsInserted(self, QModelIndex, int, int) [signal]
rowsMoved rowsMoved(self, QModelIndex, int, int, QModelIndex, int) [signal]
rowsRemoved rowsRemoved(self, QModelIndex, int, int) [signal]
stateChanged Emitted when item children fetch was finished [signal]
staticMetaObject
CommentRole = 257
class ItemDataRole

Bases: int

PathRole = 256
SortRole = 258
addFavoriteDirectory(self, directory: str, name: str = '')

Adds a directory to the favorites group.

If name is specified, it will be used as the favorite’s name. Otherwise the name will be set to match directory.

New in version 3.0.

See also

removeFavorite()

addRootItems(self)

Populates the model

beginInsertColumns()
beginInsertItems(self, parent: QgsDataItem, first: int, last: int)
beginInsertRows()
beginMoveColumns()
beginMoveRows()
beginRemoveColumns()
beginRemoveItems(self, parent: QgsDataItem, first: int, last: int)
beginRemoveRows()
beginResetModel()
canFetchMore(self, parent: QModelIndex) → bool
changePersistentIndex()
changePersistentIndexList()
childEvent()
columnCount(self, parent: QModelIndex = QModelIndex()) → int

Provides the number of columns of data exposed by the model. List models do not provide this function because it is already implemented in QAbstractListModel. *

connectItem(self, item: QgsDataItem)
connectNotify()
connectionsChanged

Connections changed in the browser, forwarded to the widget and used to notify the provider dialogs of a changed connection [signal]

createIndex()
customEvent()
data(self, index: QModelIndex, role: int = Qt.DisplayRole) → Any

Used to supply item data to views and delegates. Generally, models only need to supply data for Qt.DisplayRole and any application-specific user roles, but it is also good practice to provide data for Qt.ToolTipRole, Qt.AccessibleTextRole, and Qt.AccessibleDescriptionRole. See the Qt.ItemDataRole enum documentation for information about the types associated with each role. *

dataItem(self, idx: QModelIndex) → QgsDataItem
decodeData()
disconnectNotify()
dropMimeData(self, data: QMimeData, action: Qt.DropAction, row: int, column: int, parent: QModelIndex) → bool

Handles the data supplied by a drag and drop operation that ended with the given action

encodeData()
endInsertColumns()
endInsertItems(self)
endInsertRows()
endMoveColumns()
endMoveRows()
endRemoveColumns()
endRemoveItems(self)
endRemoveRows()
endResetModel()
fetchMore(self, parent: QModelIndex)
findItem(self, item: QgsDataItem, parent: QgsDataItem = None) → QModelIndex
findPath(self, path: str, matchFlag: Qt.MatchFlag = Qt.MatchExactly) → QModelIndex

Return index of item with given path. It only searches in currently fetched items, i.e. it does not fetch children.

Parameters:
  • path – item path
  • matchFlag – supported is Qt.MatchExactly and Qt.MatchStartsWith which has reverse meaning, i.e. find

item with the longest match from start with path (to get as close/deep as possible to deleted item).

Returns:model index, invalid if item not found *
flags(self, index: QModelIndex) → Qt.ItemFlags

Used by other components to obtain information about each item provided by the model. In many models, the combination of flags should include Qt.ItemIsEnabled and Qt.ItemIsSelectable. *

hasChildren(self, parent: QModelIndex = QModelIndex()) → bool
headerData(self, section: int, orientation: Qt.Orientation, role: int = Qt.DisplayRole) → Any

Provides views with information to show in their headers. The information is only retrieved by views that can display header information. *

hidePath(self, item: QgsDataItem)

Hide the given path in the browser model

index(self, row: int, column: int, parent: QModelIndex = QModelIndex()) → QModelIndex

Returns the index of the item in the model specified by the given row, column and parent index.

initialize(self)

Delayed initialization, needed because the provider registry must be already populated

initialized(self) → bool

Returns true if the model has been initialized

isSignalConnected()
itemDataChanged(self, item: QgsDataItem)
itemStateChanged(self, item: QgsDataItem, oldState: QgsDataItem.State)
mimeData(self, indexes: object) → QMimeData

Returns an object that contains serialized items of data corresponding to the list of indexes specified

mimeTypes(self) → List[str]

Returns a list of mime that can describe model indexes

parent(self, index: QModelIndex) → QModelIndex

Returns the parent of the model item with the given index. If the item has no parent, an invalid QModelIndex is returned.

persistentIndexList()
receivers()
refresh(self, path: str)

Refresh item specified by path

refresh(self, index: QModelIndex = QModelIndex()) Refresh item children

reload(self)

Reload the whole model

removeFavorite(self, index: QModelIndex)

Removes a favorite directory from its corresponding model index.

New in version 3.0.

removeRootItems(self)
resetInternalData()
rowCount(self, parent: QModelIndex = QModelIndex()) → int

Provides the number of rows of data exposed by the model.

sender()
senderSignalIndex()
stateChanged

Emitted when item children fetch was finished [signal]

timerEvent()
updateProjectHome(self)