mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-01 00:46:20 -05:00
Load embedded group from qgz project
This commit is contained in:
parent
9a9778af41
commit
35c2a9a6f3
@ -2563,8 +2563,16 @@ bool QgsProject::createEmbeddedLayer( const QString &layerId, const QString &pro
|
|||||||
|
|
||||||
QgsLayerTreeGroup *QgsProject::createEmbeddedGroup( const QString &groupName, const QString &projectFilePath, const QStringList &invisibleLayers, QgsProject::ReadFlags flags )
|
QgsLayerTreeGroup *QgsProject::createEmbeddedGroup( const QString &groupName, const QString &projectFilePath, const QStringList &invisibleLayers, QgsProject::ReadFlags flags )
|
||||||
{
|
{
|
||||||
|
QString qgsProjectFile = projectFilePath;
|
||||||
|
QgsProjectArchive archive;
|
||||||
|
if ( projectFilePath.endsWith( QLatin1String( ".qgz" ), Qt::CaseInsensitive ) )
|
||||||
|
{
|
||||||
|
archive.unzip( projectFilePath );
|
||||||
|
qgsProjectFile = archive.projectFile();
|
||||||
|
}
|
||||||
|
|
||||||
// open project file, get layer ids in group, add the layers
|
// open project file, get layer ids in group, add the layers
|
||||||
QFile projectFile( projectFilePath );
|
QFile projectFile( qgsProjectFile );
|
||||||
if ( !projectFile.open( QIODevice::ReadOnly ) )
|
if ( !projectFile.open( QIODevice::ReadOnly ) )
|
||||||
{
|
{
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user