@@ -94,8 +94,8 @@ QgsWFSSourceSelect::QgsWFSSourceSelect( QWidget* parent, Qt::WFlags fl, bool emb
94
94
mModelProxy ->setSortCaseSensitivity ( Qt::CaseInsensitive );
95
95
treeView->setModel ( mModelProxy );
96
96
97
- connect ( treeView, SIGNAL ( doubleClicked (const QModelIndex&) ), this , SLOT ( on_treeWidget_itemDoubleClicked (const QModelIndex&) ) );
98
- connect ( treeView->selectionModel (), SIGNAL ( currentRowChanged ( QModelIndex, QModelIndex) ), this , SLOT ( on_treeWidget_currentRowChanged (const QModelIndex&, const QModelIndex&) ) );
97
+ connect ( treeView, SIGNAL ( doubleClicked ( const QModelIndex& ) ), this , SLOT ( on_treeWidget_itemDoubleClicked ( const QModelIndex& ) ) );
98
+ connect ( treeView->selectionModel (), SIGNAL ( currentRowChanged ( QModelIndex, QModelIndex ) ), this , SLOT ( on_treeWidget_currentRowChanged ( const QModelIndex&, const QModelIndex& ) ) );
99
99
}
100
100
101
101
QgsWFSSourceSelect::~QgsWFSSourceSelect ()
@@ -229,7 +229,7 @@ void QgsWFSSourceSelect::capabilitiesReplyFinished()
229
229
cachedItem->setCheckState ( Qt::Checked );
230
230
231
231
typedef QList< QStandardItem* > StandardItemList;
232
- mModel ->appendRow ( StandardItemList () << titleItem << nameItem << abstractItem << cachedItem << filterItem);
232
+ mModel ->appendRow ( StandardItemList () << titleItem << nameItem << abstractItem << cachedItem << filterItem );
233
233
234
234
// insert the available CRS into mAvailableCRS
235
235
std::list<QString> currentCRSList;
@@ -246,16 +246,16 @@ void QgsWFSSourceSelect::capabilitiesReplyFinished()
246
246
treeView->resizeColumnToContents ( 1 );
247
247
treeView->resizeColumnToContents ( 2 );
248
248
treeView->resizeColumnToContents ( 3 );
249
- for ( int i = 0 ; i < 2 ; i++ )
249
+ for ( int i = 0 ; i < 2 ; i++ )
250
250
{
251
- if ( treeView->columnWidth ( i ) > 300 )
252
- {
253
- treeView->setColumnWidth ( i, 300 );
254
- }
251
+ if ( treeView->columnWidth ( i ) > 300 )
252
+ {
253
+ treeView->setColumnWidth ( i, 300 );
254
+ }
255
255
}
256
256
if ( treeView->columnWidth ( 2 ) > 150 )
257
257
{
258
- treeView->setColumnWidth ( 2 , 150 );
258
+ treeView->setColumnWidth ( 2 , 150 );
259
259
}
260
260
btnChangeSpatialRefSys->setEnabled ( true );
261
261
treeView->selectionModel ()->select ( mModel ->index ( 0 , 0 ), QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows );
@@ -311,7 +311,7 @@ void QgsWFSSourceSelect::connectToServer()
311
311
btnConnect->setEnabled ( false );
312
312
if ( mModel )
313
313
{
314
- mModel ->removeRows ( 0 , mModel ->rowCount () );
314
+ mModel ->removeRows ( 0 , mModel ->rowCount () );
315
315
}
316
316
if ( mCapabilities )
317
317
{
@@ -382,7 +382,7 @@ void QgsWFSSourceSelect::addLayer()
382
382
QString layerName = typeName;
383
383
if ( cbxUseTitleLayerName->isChecked () && !titleName.isEmpty () )
384
384
{
385
- layerName = titleName;
385
+ layerName = titleName;
386
386
}
387
387
QgsDebugMsg ( " Layer " + typeName + " Filter is " + filter );
388
388
// is "cache features" checked?
@@ -401,44 +401,44 @@ void QgsWFSSourceSelect::addLayer()
401
401
402
402
void QgsWFSSourceSelect::buildQuery ( const QModelIndex& index )
403
403
{
404
- if ( !index.isValid () )
405
- {
406
- return ;
407
- }
408
- QModelIndex filterIndex = index.sibling ( index.row (), 4 );
409
- QString typeName = index.sibling ( index.row (), 1 ).data ().toString ();
410
-
411
- // get available fields for wfs layer
412
- QgsWFSProvider p ( " " ); // bypasses most provider instantiation logic
413
- QgsOWSConnection connection ( " WFS" , cmbConnections->currentText () );
414
- QgsWFSCapabilities conn ( connection.uri ().encodedUri () );
415
- QString uri = conn.uriDescribeFeatureType ( typeName );
416
-
417
- QgsFields fields;
418
- QString geometryAttribute;
419
- QGis::WkbType geomType;
420
- if ( p.describeFeatureType ( uri, geometryAttribute, fields, geomType ) != 0 )
421
- {
422
- return ;
423
- }
404
+ if ( !index.isValid () )
405
+ {
406
+ return ;
407
+ }
408
+ QModelIndex filterIndex = index.sibling ( index.row (), 4 );
409
+ QString typeName = index.sibling ( index.row (), 1 ).data ().toString ();
424
410
425
- // show expression builder
426
- QgsExpressionBuilderDialog d ( 0 , filterIndex.data ().toString () );
411
+ // get available fields for wfs layer
412
+ QgsWFSProvider p ( " " ); // bypasses most provider instantiation logic
413
+ QgsOWSConnection connection ( " WFS" , cmbConnections->currentText () );
414
+ QgsWFSCapabilities conn ( connection.uri ().encodedUri () );
415
+ QString uri = conn.uriDescribeFeatureType ( typeName );
427
416
428
- // add available attributes to expression builder
429
- QgsExpressionBuilderWidget* w = d.expressionBuilder ();
430
- if ( !w )
431
- {
432
- return ;
433
- }
417
+ QgsFields fields;
418
+ QString geometryAttribute;
419
+ QGis::WkbType geomType;
420
+ if ( p.describeFeatureType ( uri, geometryAttribute, fields, geomType ) != 0 )
421
+ {
422
+ return ;
423
+ }
434
424
435
- w->loadFieldNames ( fields );
425
+ // show expression builder
426
+ QgsExpressionBuilderDialog d ( 0 , filterIndex.data ().toString () );
436
427
437
- if ( d.exec () == QDialog::Accepted )
438
- {
439
- QgsDebugMsg ( " Expression text = " + w->expressionText () );
440
- mModelProxy ->setData ( filterIndex, QVariant ( w->expressionText () ) );
441
- }
428
+ // add available attributes to expression builder
429
+ QgsExpressionBuilderWidget* w = d.expressionBuilder ();
430
+ if ( !w )
431
+ {
432
+ return ;
433
+ }
434
+
435
+ w->loadFieldNames ( fields );
436
+
437
+ if ( d.exec () == QDialog::Accepted )
438
+ {
439
+ QgsDebugMsg ( " Expression text = " + w->expressionText () );
440
+ mModelProxy ->setData ( filterIndex, QVariant ( w->expressionText () ) );
441
+ }
442
442
}
443
443
444
444
void QgsWFSSourceSelect::changeCRS ()
@@ -452,7 +452,7 @@ void QgsWFSSourceSelect::changeCRS()
452
452
453
453
void QgsWFSSourceSelect::changeCRSFilter ()
454
454
{
455
- QgsDebugMsg (" changeCRSFilter called" );
455
+ QgsDebugMsg ( " changeCRSFilter called" );
456
456
// evaluate currently selected typename and set the CRS filter in mProjectionSelector
457
457
QModelIndex currentIndex = treeView->selectionModel ()->currentIndex ();
458
458
if ( currentIndex.isValid () )
@@ -527,7 +527,7 @@ void QgsWFSSourceSelect::on_treeWidget_itemDoubleClicked( const QModelIndex& ind
527
527
buildQuery ( index );
528
528
}
529
529
530
- void QgsWFSSourceSelect::on_treeWidget_currentRowChanged ( const QModelIndex & current, const QModelIndex & previous)
530
+ void QgsWFSSourceSelect::on_treeWidget_currentRowChanged ( const QModelIndex & current, const QModelIndex & previous )
531
531
{
532
532
Q_UNUSED ( previous )
533
533
QgsDebugMsg ( " treeWidget_currentRowChanged called" );
@@ -542,7 +542,7 @@ void QgsWFSSourceSelect::on_mBuildQueryButton_clicked()
542
542
buildQuery ( treeView->selectionModel ()->currentIndex () );
543
543
}
544
544
545
- void QgsWFSSourceSelect::filterChanged (QString text)
545
+ void QgsWFSSourceSelect::filterChanged ( QString text )
546
546
{
547
547
QgsDebugMsg ( " WFS FeatureType filter changed to :" + text );
548
548
QRegExp::PatternSyntax mySyntax = QRegExp::PatternSyntax ( QRegExp::RegExp );
@@ -552,16 +552,16 @@ void QgsWFSSourceSelect::filterChanged(QString text)
552
552
mModelProxy ->sort ( mModelProxy ->sortColumn (), mModelProxy ->sortOrder () );
553
553
}
554
554
555
- QSize QgsWFSItemDelegate::sizeHint ( const QStyleOptionViewItem & option, const QModelIndex & index ) const
555
+ QSize QgsWFSItemDelegate::sizeHint ( const QStyleOptionViewItem & option, const QModelIndex & index ) const
556
556
{
557
- QVariant indexData;
558
- indexData = index.data (Qt::DisplayRole);
559
- if ( indexData.isNull () )
560
- {
561
- return QSize ();
562
- }
563
- QString data = indexData.toString ();
564
- QSize size = option.fontMetrics .boundingRect (data).size ();
565
- size.setHeight (size.height () + 2 );
566
- return size;
557
+ QVariant indexData;
558
+ indexData = index.data ( Qt::DisplayRole );
559
+ if ( indexData.isNull () )
560
+ {
561
+ return QSize ();
562
+ }
563
+ QString data = indexData.toString ();
564
+ QSize size = option.fontMetrics .boundingRect ( data ).size ();
565
+ size.setHeight ( size.height () + 2 );
566
+ return size;
567
567
}
0 commit comments