QGIS API Documentation
3.26.3-Buenos Aires (65e4edfdad)
|
Go to the documentation of this file.
24 : QAbstractItemModel( parent )
54 if ( allowEmpty == mAllowEmpty )
59 beginInsertRows( QModelIndex(), 0, 0 );
65 beginRemoveRows( QModelIndex(), 0, 0 );
73 if ( !name.isEmpty() )
75 const int idx = mAttributes.
indexOf( name );
79 return index( 1 + idx, 0 );
81 return index( idx, 0 );
85 if ( mAllowEmpty && name.isEmpty() )
93 if ( hasIndex( row, column,
parent ) )
95 return createIndex( row, column, row );
104 return QModelIndex();
114 return ( mAllowEmpty ? 1 : 0 ) + mAttributes.
count();
125 if ( !
index.isValid() )
128 const bool isEmpty = mAllowEmpty &&
index.row() == 0;
129 const int fieldOffset = mAllowEmpty ? 1 : 0;
131 if ( !isEmpty && (
index.row() - fieldOffset >= mAttributes.
count() ) )
142 return mAttributes.
at(
index.row() - fieldOffset ).
name();
151 return index.row() - fieldOffset;
160 return static_cast< int >( mAttributes.
at(
index.row() - fieldOffset ).
size() );
169 return static_cast< int >( mAttributes.
at(
index.row() - fieldOffset ).
type() );
186 case Qt::DisplayRole:
188 case Qt::ToolTipRole:
194 else if ( role == Qt::ToolTipRole )
199 return mAttributes.
at(
index.row() - fieldOffset ).
name();
202 case Qt::DecorationRole:
218 QString toolTip = QStringLiteral(
"<b>%1</b>" ).arg( attribute.
name() );
220 toolTip += QStringLiteral(
"<br><font style='font-family:monospace; white-space: nowrap;'>%3</font>" ).arg( attribute.
displayType() );
258 : QSortFilterProxyModel( parent )
261 setSourceModel( mModel );
273 const QModelIndex index = sourceModel()->index( source_row, 0, source_parent );
275 if ( mFilters.testFlag(
AllTypes ) )
279 if ( typeVar.isNull() )
320 return leftId < rightId;
@ AttributeIndexRole
Attribute index if index corresponds to an attribute.
QString displayType() const
Returns the type to use when displaying this field.
DataType
Systems of unit measurement.
@ AttributeNameRole
Attribute name.
Represents a map layer supporting display of point clouds.
void setAttributes(const QgsPointCloudAttributeCollection &attributes)
Sets the attributes to include in the model.
const QgsPointCloudAttribute & at(int index) const
Returns the attribute at the specified index.
QgsPointCloudAttributeProxyModel * setFilters(QgsPointCloudAttributeProxyModel::Filters filters)
Set flags that affect how fields are filtered in the model.
QModelIndex parent(const QModelIndex &child) const override
static QString attributeToolTip(const QgsPointCloudAttribute &attribute)
Returns a HTML formatted tooltip string for a attribute, containing details like the attribute name a...
int rowCount(const QModelIndex &parent=QModelIndex()) const override
@ Char
Character attributes.
@ UInt32
Unsigned int32 4 bytes.
@ IsEmptyRole
true if the index corresponds to the empty value
QgsPointCloudLayer * layer()
Returns the layer associated with the model.
int count() const
Returns the number of attributes present in the collection.
QString name() const
Returns name of the attribute.
QModelIndex indexFromName(const QString &name)
Returns the index corresponding to a given attribute name.
static bool isNumeric(DataType type)
Returns true if the specified data type is numeric.
@ Short
Short int 2 bytes.
@ UInt64
Unsigned int64 8 bytes.
@ UShort
Unsigned short int 2 bytes.
@ Double
Double attributes.
Collection of point cloud attributes.
QgsPointCloudAttributeProxyModel(QgsPointCloudAttributeModel *source, QObject *parent=nullptr)
Constructor for QgsPointCloudAttributeProxyModel, with the specified source model and parent object.
Attribute for point cloud data pair of name and size in bytes.
QgsPointCloudAttributeCollection attributes() const
Returns the attributes available from the layer.
int columnCount(const QModelIndex &parent) const override
QgsPointCloudAttributeCollection attributes() const
Returns the attributes associated with the model.
@ AttributeSizeRole
Attribute size.
int indexOf(const QString &name) const
Returns the index of the attribute with the specified name.
A proxy model for filtering available attributes from a point cloud attribute model.
int size() const
Returns size of the attribute in bytes.
A model for display of available attributes from a point cloud.
@ AttributeTypeRole
Attribute type, see QgsPointCloudAttribute::DataType.
void setAllowEmptyAttributeName(bool allowEmpty)
Sets whether an optional empty attribute ("not set") option is present in the model.
Filters filters() const
Returns the filters controlling displayed attributes.
QgsPointCloudAttributeModel(QObject *parent=nullptr)
Constructor for QgsPointCloudAttributeModel, with the specified parent object.
void setLayer(QgsPointCloudLayer *layer)
Sets the layer associated with the model.
static QIcon iconForAttributeType(QgsPointCloudAttribute::DataType type)
Returns an icon corresponding to an attribute type.
@ IsNumericRole
true if the index corresponds to a numeric attributre
static QIcon getThemeIcon(const QString &name, const QColor &fillColor=QColor(), const QColor &strokeColor=QColor())
Helper to get a theme icon.
@ AllTypes
All attribute types.
QVariant data(const QModelIndex &index, int role) const override
@ UChar
Unsigned char 1 byte.
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
DataType type() const
Returns the data type.
bool lessThan(const QModelIndex &left, const QModelIndex &right) const override