26 setModel( mProxyModel );
28 connect(
this,
static_cast < void ( QComboBox::* )(
int )
> ( &QComboBox::activated ),
this, &QgsPointCloudAttributeComboBox::indexChanged );
54 return mAttributeModel->
layer();
73 QModelIndex proxyIdx = mProxyModel->mapFromSource( idx );
74 if ( proxyIdx.isValid() )
76 setCurrentIndex( proxyIdx.row() );
80 setCurrentIndex( -1 );
85 setCurrentIndex( -1 );
94 int i = currentIndex();
96 const QModelIndex proxyIndex = mProxyModel->index( i, 0 );
97 if ( !proxyIndex.isValid() )
105 void QgsPointCloudAttributeComboBox::indexChanged(
int i )
Base class for all map layer types.
Collection of point cloud attributes.
void setLayer(QgsMapLayer *layer)
Sets the layer for which fields are listed in the combobox.
void setAttributes(const QgsPointCloudAttributeCollection &attributes)
Manually sets the attributes to use for the combo box.
QgsPointCloudAttributeProxyModel::Filters filters
void setAllowEmptyAttributeName(bool allowEmpty)
Sets whether an optional empty attribute ("not set") option is shown in the combo box.
QgsPointCloudAttributeCollection attributes() const
Returns the attributes currently shown in the combobox.
void attributeChanged(const QString &name)
Emitted when the currently selected attribute changes.
QgsPointCloudAttributeComboBox(QWidget *parent=nullptr)
QgsPointCloudAttributeComboBox creates a combo box to display the fields of a layer.
bool allowEmptyAttributeName
QgsPointCloudLayer * layer() const
Returns the layer currently associated with the combobox.
QString currentAttribute() const
Returns the currently selected attribute.
void setAttribute(const QString &name)
Sets the currently selected attribute by name.
void setFilters(QgsPointCloudAttributeProxyModel::Filters filters)
Sets filters to allow filtering available attributes according to the attribute properties.
A model for display of available attributes from a point cloud.
QgsPointCloudAttributeCollection attributes() const
Returns the attributes associated with the model.
void setAllowEmptyAttributeName(bool allowEmpty)
Sets whether an optional empty attribute ("not set") option is present in the model.
void setLayer(QgsPointCloudLayer *layer)
Sets the layer associated with the model.
void setAttributes(const QgsPointCloudAttributeCollection &attributes)
Sets the attributes to include in the model.
QModelIndex indexFromName(const QString &name)
Returns the index corresponding to a given attribute name.
@ AttributeNameRole
Attribute name.
QgsPointCloudLayer * layer()
Returns the layer associated with the model.
bool allowEmptyAttributeName() const
Returns true if the model allows the empty attribute ("not set") choice.
A proxy model for filtering available attributes from a point cloud attribute model.
QgsPointCloudAttributeProxyModel * setFilters(QgsPointCloudAttributeProxyModel::Filters filters)
Set flags that affect how fields are filtered in the model.
Represents a map layer supporting display of point clouds.