~ubuntu-branches/ubuntu/wily/qgis/wily

« back to all changes in this revision

Viewing changes to src/app/qgsogrsublayersdialog.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Johan Van de Wauw
  • Date: 2010-07-11 20:23:24 UTC
  • mfrom: (3.1.4 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100711202324-5ktghxa7hracohmr
Tags: 1.4.0+12730-3ubuntu1
* Merge from Debian unstable (LP: #540941).
* Fix compilation issues with QT 4.7
* Add build-depends on libqt4-webkit-dev 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
    qgsogrsublayersdialog.cpp  - dialog for selecting ogr sublayers
 
3
    ---------------------
 
4
    begin                : January 2009
 
5
    copyright            : (C) 2009 by Florian El Ahdab
 
6
    email                : felahdab at gmail dot com
 
7
 ***************************************************************************
 
8
 *                                                                         *
 
9
 *   This program is free software; you can redistribute it and/or modify  *
 
10
 *   it under the terms of the GNU General Public License as published by  *
 
11
 *   the Free Software Foundation; either version 2 of the License, or     *
 
12
 *   (at your option) any later version.                                   *
 
13
 *                                                                         *
 
14
 ***************************************************************************/
 
15
/* $Id$ */
 
16
 
 
17
#include "qgsogrsublayersdialog.h"
 
18
 
 
19
#include <QTableWidgetItem>
 
20
 
 
21
 
 
22
QgsOGRSublayersDialog::QgsOGRSublayersDialog( QWidget* parent, Qt::WFlags fl )
 
23
    : QDialog( parent, fl )
 
24
{
 
25
  setupUi( this );
 
26
  QStringList labels = QStringList() << "Layer ID" << "Layer name" << "Nb of features" << "Geometry type";
 
27
  layersTable->setHeaderLabels( labels );
 
28
}
 
29
 
 
30
QgsOGRSublayersDialog::~QgsOGRSublayersDialog()
 
31
{
 
32
}
 
33
 
 
34
QStringList QgsOGRSublayersDialog::getSelection()
 
35
{
 
36
  QStringList list = QStringList();
 
37
  for ( int i = 0; i < layersTable-> selectedItems().size(); i++ )
 
38
  {
 
39
    QString theItem = layersTable-> selectedItems().at( i )->text( 1 );
 
40
    list.append( theItem );
 
41
  }
 
42
  return list;
 
43
}
 
44
 
 
45
void QgsOGRSublayersDialog::populateLayerTable( QStringList theList )
 
46
{
 
47
  for ( int i = 0; i < theList.size(); i++ )
 
48
  {
 
49
    QString ligne = theList.at( i );
 
50
    QStringList elements = ligne.split( ":" );
 
51
    QStringList item = QStringList();
 
52
    item << elements.at( 0 ) << elements.at( 1 ) << elements.at( 2 ) << elements.at( 3 );
 
53
    layersTable -> addTopLevelItem( new QTreeWidgetItem( item ) );
 
54
  }
 
55
}