23
23
#include < QMessageBox>
24
24
#include < QSettings>
25
25
26
- QgsProjectLayerGroupDialog::QgsProjectLayerGroupDialog ( QWidget * parent, const QString& projectFile, Qt::WindowFlags f ): QDialog( parent, f )
26
+ QgsProjectLayerGroupDialog::QgsProjectLayerGroupDialog ( QWidget * parent, const QString& projectFile, Qt::WindowFlags f ): QDialog( parent, f ),
27
+ mShowEmbeddedContent( false )
27
28
{
28
29
setupUi ( this );
29
30
@@ -36,6 +37,7 @@ QgsProjectLayerGroupDialog::QgsProjectLayerGroupDialog( QWidget * parent, const
36
37
mProjectFileLabel ->hide ();
37
38
mProjectFileLineEdit ->hide ();
38
39
mBrowseFileToolButton ->hide ();
40
+ mShowEmbeddedContent = true ;
39
41
changeProjectFile ();
40
42
}
41
43
@@ -50,52 +52,52 @@ QgsProjectLayerGroupDialog::~QgsProjectLayerGroupDialog()
50
52
51
53
QStringList QgsProjectLayerGroupDialog::selectedGroups () const
52
54
{
53
- QStringList groups;
54
- QList<QTreeWidgetItem*> items = mTreeWidget ->selectedItems ();
55
- QList<QTreeWidgetItem*>::iterator itemIt = items.begin ();
56
- for ( ; itemIt != items.end (); ++itemIt )
55
+ QStringList groups;
56
+ QList<QTreeWidgetItem*> items = mTreeWidget ->selectedItems ();
57
+ QList<QTreeWidgetItem*>::iterator itemIt = items.begin ();
58
+ for ( ; itemIt != items.end (); ++itemIt )
59
+ {
60
+ if (( *itemIt )->data ( 0 , Qt::UserRole ).toString () == " group" )
57
61
{
58
- if (( *itemIt )->data ( 0 , Qt::UserRole ).toString () == " group" )
59
- {
60
- groups.push_back ( ( *itemIt )->text ( 0 ) );
61
- }
62
+ groups.push_back (( *itemIt )->text ( 0 ) );
62
63
}
63
- return groups;
64
+ }
65
+ return groups;
64
66
}
65
67
66
68
QStringList QgsProjectLayerGroupDialog::selectedLayerIds () const
67
69
{
68
- QStringList layerIds;
69
- QList<QTreeWidgetItem*> items = mTreeWidget ->selectedItems ();
70
- QList<QTreeWidgetItem*>::iterator itemIt = items.begin ();
71
- for ( ; itemIt != items.end (); ++itemIt )
70
+ QStringList layerIds;
71
+ QList<QTreeWidgetItem*> items = mTreeWidget ->selectedItems ();
72
+ QList<QTreeWidgetItem*>::iterator itemIt = items.begin ();
73
+ for ( ; itemIt != items.end (); ++itemIt )
74
+ {
75
+ if (( *itemIt )->data ( 0 , Qt::UserRole ).toString () == " layer" )
72
76
{
73
- if (( *itemIt )->data ( 0 , Qt::UserRole ).toString () == " layer" )
74
- {
75
- layerIds.push_back ( ( *itemIt )->data ( 0 , Qt::UserRole + 1 ).toString () );
76
- }
77
+ layerIds.push_back (( *itemIt )->data ( 0 , Qt::UserRole + 1 ).toString () );
77
78
}
78
- return layerIds;
79
+ }
80
+ return layerIds;
79
81
}
80
82
81
83
QStringList QgsProjectLayerGroupDialog::selectedLayerNames () const
82
84
{
83
- QStringList layerNames;
84
- QList<QTreeWidgetItem*> items = mTreeWidget ->selectedItems ();
85
- QList<QTreeWidgetItem*>::iterator itemIt = items.begin ();
86
- for ( ; itemIt != items.end (); ++itemIt )
85
+ QStringList layerNames;
86
+ QList<QTreeWidgetItem*> items = mTreeWidget ->selectedItems ();
87
+ QList<QTreeWidgetItem*>::iterator itemIt = items.begin ();
88
+ for ( ; itemIt != items.end (); ++itemIt )
89
+ {
90
+ if (( *itemIt )->data ( 0 , Qt::UserRole ).toString () == " layer" )
87
91
{
88
- if (( *itemIt )->data ( 0 , Qt::UserRole ).toString () == " layer" )
89
- {
90
- layerNames.push_back ( ( *itemIt )->text ( 0 ) );
91
- }
92
+ layerNames.push_back (( *itemIt )->text ( 0 ) );
92
93
}
93
- return layerNames;
94
+ }
95
+ return layerNames;
94
96
}
95
97
96
98
QString QgsProjectLayerGroupDialog::selectedProjectFile () const
97
99
{
98
- return mProjectFileLineEdit ->text ();
100
+ return mProjectFileLineEdit ->text ();
99
101
}
100
102
101
103
void QgsProjectLayerGroupDialog::on_mBrowseFileToolButton_clicked ()
@@ -186,7 +188,7 @@ void QgsProjectLayerGroupDialog::addLegendGroupToTreeWidget( const QDomElement&
186
188
QDomNodeList groupChildren = groupElem.childNodes ();
187
189
QDomElement currentChildElem;
188
190
189
- if ( groupElem.attribute ( " embedded" ) == " 1" )
191
+ if ( ! mShowEmbeddedContent && groupElem.attribute ( " embedded" ) == " 1" )
190
192
{
191
193
return ;
192
194
}
@@ -220,7 +222,7 @@ void QgsProjectLayerGroupDialog::addLegendGroupToTreeWidget( const QDomElement&
220
222
221
223
void QgsProjectLayerGroupDialog::addLegendLayerToTreeWidget ( const QDomElement& layerElem, QTreeWidgetItem* parent )
222
224
{
223
- if ( layerElem.attribute ( " embedded" ) == " 1" )
225
+ if ( ! mShowEmbeddedContent && layerElem.attribute ( " embedded" ) == " 1" )
224
226
{
225
227
return ;
226
228
}
0 commit comments