Class: QgsCptCityDataItem

Base class for all items in the model

Class Hierarchy

Inheritance diagram of qgis.core.QgsCptCityDataItem

Base classes

QObject

Subclasses

QgsCptCityCollectionItem

A Collection: logical collection of subcollections and color ramps

QgsCptCityColorRampItem

Item that represents a layer that can be opened with one of the

Methods

acceptDrop

Returns True if the item accepts drag & dropped layers - e.g. for import.

addChildItem

Inserts a new child using alphabetical order based on mName, emits necessary signal to model before and after, sets parent and connects signals.

createChildren

Returns a vector of children items.

deleteChildItem

Removes and deletes a child item, signals to browser are emitted.

equal

Returns True if this item is equal to an other item.

handleDrop

Tries to process the data dropped on this item.

hasChildren

icon

info

isPopulated

Returns True if the item is already populated.

isValid

leafCount

Returns the total count of "leaf" items (all children which are end nodes).

name

paramWidget

path

populate

Populates children using children vector created by createChildren().

refresh

removeChildItem

Removes a child item but doesn't delete it, signals to browser are emitted.

rowCount

setIcon

setToolTip

shortInfo

toolTip

type

Static Methods

findItem

Finds a child index in vector of items using '==' operator.

Signals

beginInsertItems

Emitted before child items are added to this item.

beginRemoveItems

Emitted before child items are removed from this data item.

endInsertItems

Emitted after child items have been added to this data item.

endRemoveItems

Emitted after child items have been removed from this data item.

Attributes

AllRamps

Collection

ColorRamp

Directory

Selection

class qgis.core.QgsCptCityDataItem[source]

Bases: QObject

AllRamps = 4
Collection = 1
ColorRamp = 0
Directory = 2
Selection = 3
class Type

Bases: int

acceptDrop(self) bool[source]

Returns True if the item accepts drag & dropped layers - e.g. for import.

Deprecated since version 3.40: Is unused and will be removed in QGIS 4.0.

Return type:

bool

addChildItem(self, child: QgsCptCityDataItem | None, refresh: bool = False)[source]

Inserts a new child using alphabetical order based on mName, emits necessary signal to model before and after, sets parent and connects signals.

The refresh argument will refresh the populated item by emitting signals to the model.

Parameters:
signal beginInsertItems(parent: QgsCptCityDataItem, first: int, last: int)[source]

Emitted before child items are added to this item.

This signal must be followed by endInsertItems().

Parameters:
  • parent (QgsCptCityDataItem) – the parent item having children added

  • first (int) – index of first child item to be added

  • last (int) – index last child item, after the addition has occurred

See also

endInsertItems()

signal beginRemoveItems(parent: QgsCptCityDataItem, first: int, last: int)[source]

Emitted before child items are removed from this data item.

This signal must be followed by endRemoveItems().

Parameters:
  • parent (QgsCptCityDataItem) – the parent item having children removed

  • first (int) – index of first child item to be removed

  • last (int) – index of the last child item to be removed

See also

endRemoveItems()

createChildren(self) List[QgsCptCityDataItem]

Returns a vector of children items.

Return type:

List[QgsCptCityDataItem]

deleteChildItem(self, child: QgsCptCityDataItem | None)[source]

Removes and deletes a child item, signals to browser are emitted.

Parameters:

child (Optional[QgsCptCityDataItem])

signal endInsertItems[source]

Emitted after child items have been added to this data item.

This signal will always be preceded by beginInsertItems().

signal endRemoveItems[source]

Emitted after child items have been removed from this data item.

This signal will always be preceded by beginRemoveItems().

equal(self, other: QgsCptCityDataItem | None) bool[source]

Returns True if this item is equal to an other item.

Parameters:

other (Optional[QgsCptCityDataItem])

Return type:

bool

static findItem(items: Iterable[QgsCptCityDataItem], item: QgsCptCityDataItem | None) int[source]

Finds a child index in vector of items using ‘==’ operator.

Parameters:
Return type:

int

handleDrop(self, data: QMimeData | None, action: Qt.DropAction) bool[source]

Tries to process the data dropped on this item.

Deprecated since version 3.40: Is unused and will be removed in QGIS 4.0.

Parameters:
  • data (Optional[QMimeData])

  • action (Qt.DropAction)

Return type:

bool

hasChildren(self) bool[source]
Return type:

bool

icon(self) QIcon[source]
icon(self, size: QSize) QIcon
Return type:

QIcon

icon(self, size: QSize) QIcon[source]
Parameters:

size (QSize)

Return type:

QIcon

info(self) str[source]
Return type:

str

isPopulated(self) bool[source]

Returns True if the item is already populated.

Return type:

bool

isValid(self) bool[source]
Return type:

bool

leafCount(self) int[source]

Returns the total count of “leaf” items (all children which are end nodes).

Return type:

int

name(self) str[source]
Return type:

str

paramWidget(self) QWidget | None[source]

Deprecated since version 3.40.

Is unused and will be removed in QGIS 4.0.

Return type:

Optional[QWidget]

path(self) str[source]
Return type:

str

populate(self)[source]

Populates children using children vector created by createChildren().

refresh(self)[source]
removeChildItem(self, child: QgsCptCityDataItem | None) QgsCptCityDataItem | None[source]

Removes a child item but doesn’t delete it, signals to browser are emitted.

Return type:

Optional[QgsCptCityDataItem]

Returns:

pointer to the removed item or None if no such item was found

Parameters:

child (Optional[QgsCptCityDataItem])

rowCount(self) int[source]
Return type:

int

setIcon(self, icon: QIcon)[source]
Parameters:

icon (QIcon)

setToolTip(self, msg: str | None)[source]
Parameters:

msg (Optional[str])

shortInfo(self) str[source]
Return type:

str

toolTip(self) str[source]
Return type:

str

type(self) QgsCptCityDataItem.Type[source]
Return type:

QgsCptCityDataItem.Type