<div dir="ltr">My assumption is that it a Provider would be a major source to gather the needed information an set QgsLayerMetadata.<br>I am doing this now for the new QgsSpatiaLiteProvider.<br><br>QgsDataProvider does not contain (at present) a mMetadata; member as QgsMapLayer does.<br><br>So when setDataProvider runs in QgsVectorLayer and QgsRasterLayer, any Metadata gathered by a provider (in the form of QgsLayerMetadata) cannot be set.<div><br></div><div>So the practical usage of QgsLayerMetadata is not quite complete.</div><div><br></div><div><a href="https://github.com/qgis/QGIS-Enhancement-Proposals/issues/91">https://github.com/qgis/QGIS-Enhancement-Proposals/issues/91</a></div><div><br></div><div>---</div><div>Also there seems to be, alternative and different, 'metadata' still in place - preventing an unified way of dealing with metadata:<br><div><br></div><div>QgsRasterDataProvider has a QString based  metadata() function</div><div>-     virtual QString metadata() = 0;</div><div>QgsVectorDataProvider has a  QVariantMap metadata() function<br></div><div>-     virtual QVariantMap metadata() const { return QVariantMap(); }</div><div><br><div><br></div></div></div></div>