24 this->layout()->setContentsMargins( 0, 0, 0, 0 );
26 mScalarDatasetComboBox->setModel( mDatasetScalarModel );
28 mVectorDatasetComboBox->setModel( mDatasetVectorModel );
41 mDatasetScalarModel->setMeshLayer( mLayer );
42 mDatasetVectorModel->setMeshLayer( mLayer );
43 setScalarDatasetGroup( mLayer->rendererSettings().activeScalarDatasetGroup() );
44 setVectorDatasetGroup( mLayer->rendererSettings().activeVectorDatasetGroup() );
55 if ( mScalarDatasetComboBox->count() == 1 )
58 scalarIndex = mScalarDatasetComboBox->currentIndex() - 1;
61 if ( mVectorDatasetComboBox->count() == 1 )
64 vectorIndex = mVectorDatasetComboBox->currentIndex() - 1;
66 mLayer->setStaticScalarDatasetIndex(
QgsMeshDatasetIndex( mScalarDatasetGroup, scalarIndex ) );
67 mLayer->setStaticVectorDatasetIndex(
QgsMeshDatasetIndex( mVectorDatasetGroup, vectorIndex ) );
72 mScalarDatasetGroup = index;
73 mDatasetScalarModel->setDatasetGroup( index );
74 mScalarDatasetComboBox->setEnabled( mScalarDatasetGroup >= 0 );
77 mScalarName->setText( mLayer->datasetGroupMetadata( index ).name() );
78 setScalarDatasetIndex( mLayer->staticScalarDatasetIndex().dataset() );
84 mVectorDatasetGroup = index;
85 mDatasetVectorModel->setDatasetGroup( index );
86 mVectorDatasetComboBox->setEnabled( mVectorDatasetGroup >= 0 );
89 mVectorName->setText( mLayer->datasetGroupMetadata( index ).name() );
90 setVectorDatasetIndex( mLayer->staticVectorDatasetIndex().dataset() );
94 void QgsMeshStaticDatasetWidget::setScalarDatasetIndex(
int index )
96 if ( index < mLayer->datasetCount( mScalarDatasetGroup ) )
97 mScalarDatasetComboBox->setCurrentIndex( index + 1 );
99 mScalarDatasetComboBox->setCurrentIndex( 0 );
102 void QgsMeshStaticDatasetWidget::setVectorDatasetIndex(
int index )
104 if ( index < mLayer->datasetCount( mVectorDatasetGroup ) )
105 mVectorDatasetComboBox->setCurrentIndex( index + 1 );
107 mVectorDatasetComboBox->setCurrentIndex( 0 );
123 mDatasetGroup = group;
139 if ( !index.isValid() )
142 if ( role == Qt::DisplayRole )
144 if ( !mLayer || mDatasetGroup < 0 || index.row() == 0 )
147 else if ( index.row() == 1 && mLayer->
datasetCount( mDatasetGroup ) == 1 )
149 return tr(
"Display dataset" );