22#include "moc_qgspointcloudattributecombobox.cpp"
29 setModel( mProxyModel );
31 connect(
this,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::activated ),
this, &QgsPointCloudAttributeComboBox::indexChanged );
36 mProxyModel->setFilters(
filters );
41 mAttributeModel->setAllowEmptyAttributeName( allowEmpty );
46 return mAttributeModel->allowEmptyAttributeName();
53 setCurrentIndex( -1 );
54 mAttributeModel->setLayer(
nullptr );
59 mAttributeModel->setLayer( pcl );
64 return mAttributeModel->layer();
80 const QModelIndex idx = mAttributeModel->indexFromName( name );
83 const QModelIndex proxyIdx = mProxyModel->mapFromSource( idx );
84 if ( proxyIdx.isValid() )
86 setCurrentIndex( proxyIdx.row() );
90 setCurrentIndex( -1 );
95 setCurrentIndex( -1 );
104 const int i = currentIndex();
106 const QModelIndex proxyIndex = mProxyModel->index( i, 0 );
107 if ( !proxyIndex.isValid() )
115void QgsPointCloudAttributeComboBox::indexChanged(
int i )
Base class for all map layer types.
A collection of point cloud attributes.
QVector< QgsPointCloudAttribute > attributes() const
Returns all 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.
@ AttributeName
Attribute name.
A proxy model for filtering available attributes from a point cloud attribute model.
Represents a map layer supporting display of point clouds.