@@ -65,14 +65,12 @@ void QgsAttributeTypeLoadDialog::setVectorLayer( QgsVectorLayer *layer )
65
65
66
66
void QgsAttributeTypeLoadDialog::previewButtonPushed ()
67
67
{
68
- createPreview ( valueComboBox->currentIndex (), true );
68
+ createPreview ( valueComboBox->currentIndex (), true );
69
69
}
70
70
71
71
void QgsAttributeTypeLoadDialog::fillLayerList ()
72
72
{
73
73
layerComboBox->clear ();
74
- int i = 0 ;
75
- QgsMapLayer* dataLayer;
76
74
QMap<QString, QgsMapLayer*>::iterator layer_it = QgsMapLayerRegistry::instance ()->mapLayers ().begin ();
77
75
for ( ; layer_it != QgsMapLayerRegistry::instance ()->mapLayers ().end (); layer_it++ )
78
76
{
@@ -86,47 +84,47 @@ void QgsAttributeTypeLoadDialog::fillComboBoxes( int layerIndex )
86
84
keyComboBox->clear ();
87
85
valueComboBox->clear ();
88
86
89
- if (layerIndex < 0 )
87
+ if ( layerIndex < 0 )
90
88
{
91
89
return ;
92
90
}
93
91
94
92
QgsMapLayer* dataLayer = QgsMapLayerRegistry::instance ()->mapLayer ( layerComboBox->currentText () );
95
93
QgsVectorLayer* vLayer = dynamic_cast <QgsVectorLayer *>( dataLayer );
96
- if (vLayer == NULL )
94
+ if ( vLayer == NULL )
97
95
{
98
- return ;
96
+ return ;
99
97
}
100
98
QMap<QString, int > fieldMap = vLayer->dataProvider ()->fieldNameMap ();
101
99
QMap<QString, int >::iterator it = fieldMap.begin ();
102
- for (; it != fieldMap.end (); it++)
100
+ for ( ; it != fieldMap.end (); it++ )
103
101
{
104
- keyComboBox->addItem (it.key (), it.value ());
105
- valueComboBox->addItem (it.key (), it.value ());
102
+ keyComboBox->addItem ( it.key (), it.value () );
103
+ valueComboBox->addItem ( it.key (), it.value () );
106
104
}
107
105
108
106
}
109
107
110
- void QgsAttributeTypeLoadDialog::createPreview ( int fieldIndex, bool full)
108
+ void QgsAttributeTypeLoadDialog::createPreview ( int fieldIndex, bool full )
111
109
{
112
110
previewTableWidget->clearContents ();
113
111
114
- for (int i = previewTableWidget->rowCount () -1 ; i > 0 ; i--)
112
+ for ( int i = previewTableWidget->rowCount () - 1 ; i > 0 ; i-- )
115
113
{
116
- previewTableWidget->removeRow (i );
114
+ previewTableWidget->removeRow ( i );
117
115
}
118
- if (layerComboBox->currentIndex () < 0 || fieldIndex < 0 )
116
+ if ( layerComboBox->currentIndex () < 0 || fieldIndex < 0 )
119
117
{
120
118
// when nothing is selected there is no reason for preview
121
119
return ;
122
120
}
123
- int idx = keyComboBox->itemData (keyComboBox->currentIndex ()).toInt ();
124
- int idx2 = valueComboBox->itemData (valueComboBox->currentIndex ()).toInt ();
121
+ int idx = keyComboBox->itemData ( keyComboBox->currentIndex () ).toInt ();
122
+ int idx2 = valueComboBox->itemData ( valueComboBox->currentIndex () ).toInt ();
125
123
QgsMapLayer* dataLayer = QgsMapLayerRegistry::instance ()->mapLayer ( layerComboBox->currentText () );
126
124
QgsVectorLayer* vLayer = dynamic_cast <QgsVectorLayer *>( dataLayer );
127
- if (vLayer == NULL )
125
+ if ( vLayer == NULL )
128
126
{
129
- return ;
127
+ return ;
130
128
}
131
129
132
130
QgsVectorDataProvider* dataProvider = vLayer->dataProvider ();
@@ -144,12 +142,12 @@ void QgsAttributeTypeLoadDialog::createPreview( int fieldIndex, bool full)
144
142
QVariant val1 = f.attributeMap ()[idx];
145
143
QVariant val2 = f.attributeMap ()[idx2];
146
144
if ( val1.isValid () && !val1.isNull () && !val1.toString ().isEmpty ()
147
- && val2.isValid () && !val2.isNull () && !val2.toString ().isEmpty () )
145
+ && val2.isValid () && !val2.isNull () && !val2.toString ().isEmpty () )
148
146
{
149
- valueMap.insert (val1.toString (), val2.toString () );
147
+ valueMap.insert ( val1.toString (), val2.toString () );
150
148
}
151
- if (!full && valueMap.size () > 8 )
152
- break ; // just first entries all on button
149
+ if ( !full && valueMap.size () > 8 )
150
+ break ; // just first entries all on button
153
151
}
154
152
int row = 0 ;
155
153
for ( QMap<QString, QVariant>::iterator mit = valueMap.begin (); mit != valueMap.end (); mit++, row++ )
@@ -170,13 +168,13 @@ QMap<QString, QVariant> &QgsAttributeTypeLoadDialog::valueMap()
170
168
void QgsAttributeTypeLoadDialog::loadDataToValueMap ()
171
169
{
172
170
mValueMap .clear ();
173
- int idx = keyComboBox->itemData (keyComboBox->currentIndex ()).toInt ();
174
- int idx2 = valueComboBox->itemData (valueComboBox->currentIndex ()).toInt ();
171
+ int idx = keyComboBox->itemData ( keyComboBox->currentIndex () ).toInt ();
172
+ int idx2 = valueComboBox->itemData ( valueComboBox->currentIndex () ).toInt ();
175
173
QgsMapLayer* dataLayer = QgsMapLayerRegistry::instance ()->mapLayer ( layerComboBox->currentText () );
176
174
QgsVectorLayer* vLayer = dynamic_cast <QgsVectorLayer *>( dataLayer );
177
- if (vLayer == NULL )
175
+ if ( vLayer == NULL )
178
176
{
179
- return ;
177
+ return ;
180
178
}
181
179
182
180
QgsVectorDataProvider* dataProvider = vLayer->dataProvider ();
@@ -193,7 +191,7 @@ void QgsAttributeTypeLoadDialog::loadDataToValueMap()
193
191
QVariant val = f.attributeMap ()[idx];
194
192
if ( val.isValid () && !val.isNull () && !val.toString ().isEmpty () )
195
193
{
196
- mValueMap .insert (f.attributeMap ()[idx2].toString (), val );
194
+ mValueMap .insert ( f.attributeMap ()[idx2].toString (), val );
197
195
}
198
196
}
199
197
dataProvider->enableGeometrylessFeatures ( false );
0 commit comments