Skip to content
Permalink
Browse files

attribute table now shows either all features (default), all selected…

… features or all features in the current canvas.

(applies #1306)



git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@9689 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef
jef committed Nov 24, 2008
1 parent 9a0b259 commit 7a733aa1e59682e46e662779c13c37bd76cf212d
Showing with 57 additions and 6 deletions.
  1. +20 −6 src/app/qgsattributetable.cpp
  2. +9 −0 src/app/qgsoptions.cpp
  3. +28 −0 src/ui/qgsoptionsbase.ui
@@ -24,12 +24,15 @@
#include "qgslogger.h"
#include "qgsvectordataprovider.h"
#include "qgsvectorlayer.h"
#include "qgisapp.h"
#include "qgsmapcanvas.h"

#include <QApplication>
#include <QClipboard>
#include <QHeaderView>
#include <QKeyEvent>
#include <QMenu>
#include <QSettings>


QgsAttributeTableItemDelegate::QgsAttributeTableItemDelegate( QgsAttributeTable *table, QObject *parent )
@@ -477,18 +480,29 @@ void QgsAttributeTable::fillTable( QgsVectorLayer *layer )
}

QgsFeatureList features;
if ( layer->selectedFeatureCount() == 0 )

QSettings settings;
int behaviour = settings.value( "/qgis/attributeTableBehaviour", 0 ).toInt();

if ( behaviour == 1 )
{
layer->select( layer->pendingAllAttributesList(), QgsRectangle(), false );
features = layer->selectedFeatures();
}
else
{
QgsRectangle rect;
if( behaviour == 2 )
{
// current canvas only
rect = QgisApp::instance()->mapCanvas()->extent();
}

layer->select( layer->pendingAllAttributesList(), rect, false );

QgsFeature f;
while ( layer->nextFeature( f ) )
features << f;
}
else
{
features = layer->selectedFeatures();
}

setRowCount( features.size() );

@@ -64,6 +64,14 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) :
leProxyPassword->setText( settings.value( "proxy/proxyPassword", "" ).toString() );
// set the current theme
cmbTheme->setItemText( cmbTheme->currentIndex(), settings.value( "/Themes" ).toString() );

// set the attribute table behaviour
cmbAttrTableBehaviour->clear();
cmbAttrTableBehaviour->addItem( tr( "Show all features" ) );
cmbAttrTableBehaviour->addItem( tr( "Show selected features" ) );
cmbAttrTableBehaviour->addItem( tr( "Show features in current canvas" ) );
cmbAttrTableBehaviour->setCurrentIndex( settings.value( "/qgis/attributeTableBehaviour", 0 ).toInt() );

// set the display update threshold
spinBoxUpdateThreshold->setValue( settings.value( "/Map/updateThreshold" ).toInt() );
//set the default projection behaviour radio buttongs
@@ -257,6 +265,7 @@ void QgsOptions::saveOptions()
settings.setValue( "/qgis/showLegendClassifiers", cbxLegendClassifiers->isChecked() );
settings.setValue( "/qgis/hideSplash", cbxHideSplash->isChecked() );
settings.setValue( "/qgis/dockAttributeTable", cbxAttributeTableDocked->isChecked() );
settings.setValue( "/qgis/attributeTableBehaviour", cmbAttrTableBehaviour->currentIndex() );
settings.setValue( "/qgis/new_layers_visible", chkAddedVisibility->isChecked() );
settings.setValue( "/qgis/enable_anti_aliasing", chkAntiAliasing->isChecked() );
settings.setValue( "/qgis/use_qimage_to_render", !( chkUseQPixmap->isChecked() ) );
@@ -220,6 +220,34 @@
</property>
</widget>
</item>
<item row="6" column="0" >
<widget class="QLabel" name="textLabel1_6" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>Attribute table behaviour</string>
</property>
<property name="buddy" >
<cstring>cmbAttrTableBehaviour</cstring>
</property>
</widget>
</item>
<item row="6" column="1" >
<widget class="QComboBox" name="cmbAttrTableBehaviour" >
<property name="duplicatesEnabled" >
<bool>false</bool>
</property>
<item>
<property name="text" >
<string/>
</property>
</item>
</widget>
</item>
</layout>
</widget>
</item>

0 comments on commit 7a733aa

Please sign in to comment.